44474 lines
No EOL
1.9 MiB
44474 lines
No EOL
1.9 MiB
|
|
' 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= "<a onclick='gPersist=true;' class='truncatedText' onmouseout='detailRolloverPopupClose();' " _
|
|
& "onmouseover='SaveMousePosition(event); delayRolloverPopup(""PageMethods.GetRecordFieldValue(\""Persons.Business.PersonalDDTable, App_Code\"",\""" _
|
|
& (HttpUtility.UrlEncode(Me.DataSource.GetID.ToString())).Replace("\","\\\\") & "\"", \""Mission\"", \""Mission\"", \""" & NetUtils.EncodeStringForHtmlDisplay(name.Substring(0, name.Length)) &"\"", false, 200," _
|
|
& " 300, true, PopupDisplayWindowCallBackWith20);"", 500);'>" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength))
|
|
|
|
If (maxLength = CType(100, Integer)) Then
|
|
formattedValue = formattedValue & "..." & "</a>"
|
|
Else
|
|
formattedValue = formattedValue & "</a>"
|
|
|
|
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= "<a onclick='gPersist=true;' class='truncatedText' onmouseout='detailRolloverPopupClose();' " _
|
|
& "onmouseover='SaveMousePosition(event); delayRolloverPopup(""PageMethods.GetRecordFieldValue(\""Persons.Business.PersonalDDTable, App_Code\"",\""" _
|
|
& (HttpUtility.UrlEncode(Me.DataSource.GetID.ToString())).Replace("\","\\\\") & "\"", \""Ref\"", \""Ref1\"", \""" & NetUtils.EncodeStringForHtmlDisplay(name.Substring(0, name.Length)) &"\"", false, 200," _
|
|
& " 300, true, PopupDisplayWindowCallBackWith20);"", 500);'>" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength))
|
|
|
|
If (maxLength = CType(100, Integer)) Then
|
|
formattedValue = formattedValue & "..." & "</a>"
|
|
Else
|
|
formattedValue = formattedValue & "</a>"
|
|
|
|
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= "<a onclick='gPersist=true;' class='truncatedText' onmouseout='detailRolloverPopupClose();' " _
|
|
& "onmouseover='SaveMousePosition(event); delayRolloverPopup(""PageMethods.GetRecordFieldValue(\""Persons.Business.PersonalExtWorkTable, App_Code\"",\""" _
|
|
& (HttpUtility.UrlEncode(Me.DataSource.GetID.ToString())).Replace("\","\\\\") & "\"", \""Command\"", \""Command1\"", \""" & NetUtils.EncodeStringForHtmlDisplay(name.Substring(0, name.Length)) &"\"", false, 200," _
|
|
& " 300, true, PopupDisplayWindowCallBackWith20);"", 500);'>" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength))
|
|
|
|
If (maxLength = CType(100, Integer)) Then
|
|
formattedValue = formattedValue & "..." & "</a>"
|
|
Else
|
|
formattedValue = formattedValue & "</a>"
|
|
|
|
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= "<a onclick='gPersist=true;' class='truncatedText' onmouseout='detailRolloverPopupClose();' " _
|
|
& "onmouseover='SaveMousePosition(event); delayRolloverPopup(""PageMethods.GetRecordFieldValue(\""Persons.Business.PersonalExtWorkTable, App_Code\"",\""" _
|
|
& (HttpUtility.UrlEncode(Me.DataSource.GetID.ToString())).Replace("\","\\\\") & "\"", \""Description\"", \""Description\"", \""" & NetUtils.EncodeStringForHtmlDisplay(name.Substring(0, name.Length)) &"\"", false, 200," _
|
|
& " 300, true, PopupDisplayWindowCallBackWith20);"", 500);'>" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength))
|
|
|
|
If (maxLength = CType(100, Integer)) Then
|
|
formattedValue = formattedValue & "..." & "</a>"
|
|
Else
|
|
formattedValue = formattedValue & "</a>"
|
|
|
|
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= "<a onclick='gPersist=true;' class='truncatedText' onmouseout='detailRolloverPopupClose();' " _
|
|
& "onmouseover='SaveMousePosition(event); delayRolloverPopup(""PageMethods.GetRecordFieldValue(\""Persons.Business.PersonalExtWorkTable, App_Code\"",\""" _
|
|
& (HttpUtility.UrlEncode(Me.DataSource.GetID.ToString())).Replace("\","\\\\") & "\"", \""Place\"", \""Place\"", \""" & NetUtils.EncodeStringForHtmlDisplay(name.Substring(0, name.Length)) &"\"", false, 200," _
|
|
& " 300, true, PopupDisplayWindowCallBackWith20);"", 500);'>" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength))
|
|
|
|
If (maxLength = CType(100, Integer)) Then
|
|
formattedValue = formattedValue & "..." & "</a>"
|
|
Else
|
|
formattedValue = formattedValue & "</a>"
|
|
|
|
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= "<a onclick='gPersist=true;' class='truncatedText' onmouseout='detailRolloverPopupClose();' " _
|
|
& "onmouseover='SaveMousePosition(event); delayRolloverPopup(""PageMethods.GetRecordFieldValue(\""Persons.Business.PersonalRankTable, App_Code\"",\""" _
|
|
& (HttpUtility.UrlEncode(Me.DataSource.GetID.ToString())).Replace("\","\\\\") & "\"", \""Ref\"", \""Ref3\"", \""" & NetUtils.EncodeStringForHtmlDisplay(name.Substring(0, name.Length)) &"\"", false, 200," _
|
|
& " 300, true, PopupDisplayWindowCallBackWith20);"", 500);'>" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength))
|
|
|
|
If (maxLength = CType(100, Integer)) Then
|
|
formattedValue = formattedValue & "..." & "</a>"
|
|
Else
|
|
formattedValue = formattedValue & "</a>"
|
|
|
|
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= "<a onclick='gPersist=true;' class='truncatedText' onmouseout='detailRolloverPopupClose();' " _
|
|
& "onmouseover='SaveMousePosition(event); delayRolloverPopup(""PageMethods.GetRecordFieldValue(\""Persons.Business.PersonalTitleTable, App_Code\"",\""" _
|
|
& (HttpUtility.UrlEncode(Me.DataSource.GetID.ToString())).Replace("\","\\\\") & "\"", \""Title\"", \""Title\"", \""" & NetUtils.EncodeStringForHtmlDisplay(name.Substring(0, name.Length)) &"\"", false, 200," _
|
|
& " 300, true, PopupDisplayWindowCallBackWith20);"", 500);'>" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength))
|
|
|
|
If (maxLength = CType(100, Integer)) Then
|
|
formattedValue = formattedValue & "..." & "</a>"
|
|
Else
|
|
formattedValue = formattedValue & "</a>"
|
|
|
|
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= "<a onclick='gPersist=true;' class='truncatedText' onmouseout='detailRolloverPopupClose();' " _
|
|
& "onmouseover='SaveMousePosition(event); delayRolloverPopup(""PageMethods.GetRecordFieldValue(\""Persons.Business.PersonRelativeTable, App_Code\"",\""" _
|
|
& (HttpUtility.UrlEncode(Me.DataSource.GetID.ToString())).Replace("\","\\\\") & "\"", \""Ref\"", \""Ref4\"", \""" & NetUtils.EncodeStringForHtmlDisplay(name.Substring(0, name.Length)) &"\"", false, 200," _
|
|
& " 300, true, PopupDisplayWindowCallBackWith20);"", 500);'>" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength))
|
|
|
|
If (maxLength = CType(100, Integer)) Then
|
|
formattedValue = formattedValue & "..." & "</a>"
|
|
Else
|
|
formattedValue = formattedValue & "</a>"
|
|
|
|
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= "<a onclick='gPersist=true;' class='truncatedText' onmouseout='detailRolloverPopupClose();' " _
|
|
& "onmouseover='SaveMousePosition(event); delayRolloverPopup(""PageMethods.GetRecordFieldValue(\""Persons.Business.PersonRelativeTable, App_Code\"",\""" _
|
|
& (HttpUtility.UrlEncode(Me.DataSource.GetID.ToString())).Replace("\","\\\\") & "\"", \""RStatusRef\"", \""RStatusRef\"", \""" & NetUtils.EncodeStringForHtmlDisplay(name.Substring(0, name.Length)) &"\"", false, 200," _
|
|
& " 300, true, PopupDisplayWindowCallBackWith20);"", 500);'>" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength))
|
|
|
|
If (maxLength = CType(100, Integer)) Then
|
|
formattedValue = formattedValue & "..." & "</a>"
|
|
Else
|
|
formattedValue = formattedValue & "</a>"
|
|
|
|
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= "<a onclick='gPersist=true;' class='truncatedText' onmouseout='detailRolloverPopupClose();' " _
|
|
& "onmouseover='SaveMousePosition(event); delayRolloverPopup(""PageMethods.GetRecordFieldValue(\""Persons.Business.PersonalIdTable, App_Code\"",\""" _
|
|
& (HttpUtility.UrlEncode(Me.DataSource.GetID.ToString())).Replace("\","\\\\") & "\"", \""Addr\"", \""Addr\"", \""" & NetUtils.EncodeStringForHtmlDisplay(name.Substring(0, name.Length)) &"\"", false, 200," _
|
|
& " 300, true, PopupDisplayWindowCallBackWith20);"", 500);'>" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength))
|
|
|
|
If (maxLength = CType(100, Integer)) Then
|
|
formattedValue = formattedValue & "..." & "</a>"
|
|
Else
|
|
formattedValue = formattedValue & "</a>"
|
|
|
|
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= "<a onclick='gPersist=true;' class='truncatedText' onmouseout='detailRolloverPopupClose();' " _
|
|
& "onmouseover='SaveMousePosition(event); delayRolloverPopup(""PageMethods.GetRecordFieldValue(\""Persons.Business.PersonalIdTable, App_Code\"",\""" _
|
|
& (HttpUtility.UrlEncode(Me.DataSource.GetID.ToString())).Replace("\","\\\\") & "\"", \""Commission\"", \""Commission\"", \""" & NetUtils.EncodeStringForHtmlDisplay(name.Substring(0, name.Length)) &"\"", false, 200," _
|
|
& " 300, true, PopupDisplayWindowCallBackWith20);"", 500);'>" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength))
|
|
|
|
If (maxLength = CType(100, Integer)) Then
|
|
formattedValue = formattedValue & "..." & "</a>"
|
|
Else
|
|
formattedValue = formattedValue & "</a>"
|
|
|
|
formattedValue = "<table border=""0"" cellpadding=""0"" cellspacing=""0""><tr><td>" & formattedValue & "</td></tr></table>"
|
|
End If
|
|
Else
|
|
If maxLength = CType(100, Integer) Then
|
|
formattedValue= NetUtils.EncodeStringForHtmlDisplay(formattedValue.SubString(0,MaxLength))
|
|
formattedValue = formattedValue & "..."
|
|
|
|
Else
|
|
|
|
formattedValue = "<table border=""0"" cellpadding=""0"" cellspacing=""0""><tr><td>" & formattedValue & "</td></tr></table>"
|
|
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= "<a onclick='gPersist=true;' class='truncatedText' onmouseout='detailRolloverPopupClose();' " _
|
|
& "onmouseover='SaveMousePosition(event); delayRolloverPopup(""PageMethods.GetRecordFieldValue(\""Persons.Business.PersonalIdTable, App_Code\"",\""" _
|
|
& (HttpUtility.UrlEncode(Me.DataSource.GetID.ToString())).Replace("\","\\\\") & "\"", \""PlaceOfBirth\"", \""PlaceOfBirth\"", \""" & NetUtils.EncodeStringForHtmlDisplay(name.Substring(0, name.Length)) &"\"", false, 200," _
|
|
& " 300, true, PopupDisplayWindowCallBackWith20);"", 500);'>" & NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, maxLength))
|
|
|
|
If (maxLength = CType(100, Integer)) Then
|
|
formattedValue = formattedValue & "..." & "</a>"
|
|
Else
|
|
formattedValue = formattedValue & "</a>"
|
|
|
|
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
|
|
|
|
|