home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
66.142.0.142
/
66.142.0.142.tar
/
66.142.0.142
/
ltgFixtureNoteadd.aspx.vb
< prev
next >
Wrap
Text File
|
2014-01-25
|
25KB
|
788 lines
Imports System.Data
Imports System.Data.Common
Imports System.Xml
Imports System.IO
Imports System.Data.OleDb
'
' ASP.NET code-behind class (Page)
'
Partial Class ltgFixtureNoteadd
Inherits AspNetMaker7_tfpssnet
' Page object
Public ltgFixtureNote_add As cltgFixtureNote_add
'
' Page Class
'
Class cltgFixtureNote_add
Inherits AspNetMakerPage
Implements IDisposable
' Used by system generated functions
Private RsWrk As Object, sSqlWrk As String, sWhereWrk As String
Private arwrk As Object
Private armultiwrk() As String
' Page URL
Public ReadOnly Property PageUrl() As String
Get
Dim Url As String = ew_CurrentPage() & "?"
If ltgFixtureNote.UseTokenInUrl Then Url = Url & "t=" & ltgFixtureNote.TableVar & "&" ' Add page token
Return Url
End Get
End Property
' Validate page request
Public Function IsPageRequest() As Boolean
Dim Result As Boolean
If ltgFixtureNote.UseTokenInUrl Then
Result = False
If ObjForm IsNot Nothing Then
Result = (ltgFixtureNote.TableVar = ObjForm.GetValue("t"))
End If
If ew_Get("t") <> "" Then
Result = (ltgFixtureNote.TableVar = ew_Get("t"))
End If
Return Result
End If
Return True
End Function
' ltgFixtureNote
Public Property ltgFixtureNote() As cltgFixtureNote
Get
Return ParentPage.ltgFixtureNote
End Get
Set(ByVal v As cltgFixtureNote)
ParentPage.ltgFixtureNote = v
End Set
End Property
' ltgFixtureNote
Public Property tblEmployees() As ctblEmployees
Get
Return ParentPage.tblEmployees
End Get
Set(ByVal v As ctblEmployees)
ParentPage.tblEmployees = v
End Set
End Property
' ltgFixtureNote
Public Property ltgFixtureMaster() As cltgFixtureMaster
Get
Return ParentPage.ltgFixtureMaster
End Get
Set(ByVal v As cltgFixtureMaster)
ParentPage.ltgFixtureMaster = v
End Set
End Property
'
' Constructor
' - init objects
' - open connection
'
Public Sub New(ByRef APage As AspNetMaker7_tfpssnet)
m_ParentPage = APage
m_Page = Me
m_PageID = "add"
m_PageObjName = "ltgFixtureNote_add"
m_PageObjTypeName = "cltgFixtureNote_add"
' Table Name
m_TableName = "ltgFixtureNote"
' Initialize table object
ltgFixtureNote = New cltgFixtureNote(Me)
tblEmployees = New ctblEmployees(Me)
ltgFixtureMaster = New cltgFixtureMaster(Me)
' Connect to database
Conn = New cConnection()
End Sub
'
' Subroutine Page_Init
' - called before page main
' - check Security
' - set up response header
' - call page load events
'
Public Sub Page_Init()
Security = New cAdvancedSecurity(Me)
If Not Security.IsLoggedIn() Then Security.AutoLogin()
If Not Security.IsLoggedIn() Then
Security.SaveLastUrl()
Page_Terminate("login.aspx")
End If
' Table Permission loading event
Security.TablePermission_Loading()
Security.LoadCurrentUserLevel(TableName)
' Table Permission loaded event
Security.TablePermission_Loaded()
If Not Security.CanAdd Then
Security.SaveLastUrl()
Page_Terminate("ltgFixtureNotelist.aspx")
End If
' User ID loading event
Security.UserID_Loading()
If Security.IsLoggedIn() Then Call Security.LoadUserID()
' User ID loaded event
Security.UserID_Loaded()
' Global page loading event (in ewglobal*.vb)
ParentPage.Page_Loading()
' Page load event, used in current page
Page_Load()
End Sub
'
' Class terminate
' - clean up page object
'
Public Sub Dispose() Implements IDisposable.Dispose
Page_Terminate("")
End Sub
'
' Sub Page_Terminate
' - called when exit page
' - clean up connection and objects
' - if URL specified, redirect to URL
'
Sub Page_Terminate(url As String)
' Page unload event, used in current page
Page_Unload()
' Global page unloaded event (in ewglobal*.vb)
ParentPage.Page_Unloaded()
' Close connection
Conn.Dispose()
Security = Nothing
ltgFixtureNote.Dispose()
tblEmployees.Dispose()
ltgFixtureMaster.Dispose()
' Go to URL if specified
If url <> "" Then
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.Redirect(url)
End If
End Sub
Public x_ewPriv As Integer
'
' Page main processing
'
Sub Page_Main()
' Load key values from QueryString
Dim bCopy As Boolean = True
If ew_Get("notID") <> "" Then
ltgFixtureNote.notID.QueryStringValue = ew_Get("notID")
Else
bCopy = False
End If
' Create form object
ObjForm = New cFormObj
' Process form if post back
If ObjForm.GetValue("a_add") <> "" Then
ltgFixtureNote.CurrentAction = ObjForm.GetValue("a_add") ' Get form action
LoadFormValues() ' Load form values
' Validate Form
If Not ValidateForm() Then
ltgFixtureNote.CurrentAction = "I" ' Form error, reset action
Message = ParentPage.gsFormError
End If
' Not post back
Else
If bCopy Then
ltgFixtureNote.CurrentAction = "C" ' Copy Record
Else
ltgFixtureNote.CurrentAction = "I" ' Display Blank Record
LoadDefaultValues() ' Load default values
End If
End If
' Perform action based on action code
Select Case ltgFixtureNote.CurrentAction
Case "I" ' Blank record, no action required
Case "C" ' Copy an existing record
If Not LoadRow() Then ' Load record based on key
Message = "No records found" ' No record found
Page_Terminate("ltgFixtureNotelist.aspx") ' No matching record, return to list
End If
Case "A" ' Add new record
ltgFixtureNote.SendEmail = True ' Send email on add success
If AddRow() Then ' Add successful
Message = "Add succeeded" ' Set up success message
Dim sReturnUrl As String = ltgFixtureNote.ReturnUrl
Page_Terminate(sReturnUrl) ' Clean up and return
Else
RestoreFormValues() ' Add failed, restore form values
End If
End Select
' Render row based on row type
ltgFixtureNote.RowType = EW_ROWTYPE_ADD ' Render add type
' Render row
RenderRow()
End Sub
'
' Get upload file
'
Sub GetUploadFiles()
' Get upload data
End Sub
'
' Load default values
'
Sub LoadDefaultValues()
ltgFixtureNote.notIsActive.CurrentValue = 1
End Sub
'
' Load form values
'
Sub LoadFormValues()
ltgFixtureNote.notFixID.FormValue = ObjForm.GetValue("x_notFixID")
ltgFixtureNote.notFixID.OldValue = ObjForm.GetValue("o_notFixID")
ltgFixtureNote.notTypeID.FormValue = ObjForm.GetValue("x_notTypeID")
ltgFixtureNote.notTypeID.OldValue = ObjForm.GetValue("o_notTypeID")
ltgFixtureNote.notDate.FormValue = ObjForm.GetValue("x_notDate")
ltgFixtureNote.notDate.CurrentValue = ew_UnFormatDateTime(ltgFixtureNote.notDate.CurrentValue, 6)
ltgFixtureNote.notDate.OldValue = ObjForm.GetValue("o_notDate")
ltgFixtureNote.notShortDesc.FormValue = ObjForm.GetValue("x_notShortDesc")
ltgFixtureNote.notShortDesc.OldValue = ObjForm.GetValue("o_notShortDesc")
ltgFixtureNote.notNote.FormValue = ObjForm.GetValue("x_notNote")
ltgFixtureNote.notNote.OldValue = ObjForm.GetValue("o_notNote")
ltgFixtureNote.notLPRStatusID.FormValue = ObjForm.GetValue("x_notLPRStatusID")
ltgFixtureNote.notLPRStatusID.OldValue = ObjForm.GetValue("o_notLPRStatusID")
ltgFixtureNote.notPriority.FormValue = ObjForm.GetValue("x_notPriority")
ltgFixtureNote.notPriority.OldValue = ObjForm.GetValue("o_notPriority")
ltgFixtureNote.notIsActive.FormValue = ObjForm.GetValue("x_notIsActive")
ltgFixtureNote.notIsActive.OldValue = ObjForm.GetValue("o_notIsActive")
ltgFixtureNote.notID.FormValue = ObjForm.GetValue("x_notID")
End Sub
'
' Restore form values
'
Sub RestoreFormValues()
ltgFixtureNote.notFixID.CurrentValue = ltgFixtureNote.notFixID.FormValue
ltgFixtureNote.notTypeID.CurrentValue = ltgFixtureNote.notTypeID.FormValue
ltgFixtureNote.notDate.CurrentValue = ltgFixtureNote.notDate.FormValue
ltgFixtureNote.notDate.CurrentValue = ew_UnFormatDateTime(ltgFixtureNote.notDate.CurrentValue, 6)
ltgFixtureNote.notShortDesc.CurrentValue = ltgFixtureNote.notShortDesc.FormValue
ltgFixtureNote.notNote.CurrentValue = ltgFixtureNote.notNote.FormValue
ltgFixtureNote.notLPRStatusID.CurrentValue = ltgFixtureNote.notLPRStatusID.FormValue
ltgFixtureNote.notPriority.CurrentValue = ltgFixtureNote.notPriority.FormValue
ltgFixtureNote.notIsActive.CurrentValue = ltgFixtureNote.notIsActive.FormValue
ltgFixtureNote.notID.CurrentValue = ltgFixtureNote.notID.FormValue
End Sub
'
' Load row based on key values
'
Function LoadRow() As Boolean
Dim RsRow As OleDbDataReader
Dim sFilter As String = ltgFixtureNote.KeyFilter
' Row Selecting event
ltgFixtureNote.Row_Selecting(sFilter)
' Load SQL based on filter
ltgFixtureNote.CurrentFilter = sFilter
Dim sSql As String = ltgFixtureNote.SQL
' Write SQL for debug
If EW_DEBUG_ENABLED Then ew_Write(sSql)
Try
RsRow = Conn.GetTempDataReader(sSql)
If Not RsRow.Read() Then
Return False
Else
LoadRowValues(RsRow) ' Load row values
' Row Selected event
ltgFixtureNote.Row_Selected(RsRow)
Return True
End If
Catch
If EW_DEBUG_ENABLED Then Throw
Return False
Finally
Conn.CloseTempDataReader()
End Try
End Function
'
' Load row values from recordset
'
Sub LoadRowValues(ByRef RsRow As OleDbDataReader)
ltgFixtureNote.notID.DbValue = RsRow("notID")
ltgFixtureNote.notFixID.DbValue = RsRow("notFixID")
ltgFixtureNote.notTypeID.DbValue = RsRow("notTypeID")
ltgFixtureNote.notDate.DbValue = RsRow("notDate")
ltgFixtureNote.notShortDesc.DbValue = RsRow("notShortDesc")
ltgFixtureNote.notNote.DbValue = RsRow("notNote")
ltgFixtureNote.notLPRStatusID.DbValue = RsRow("notLPRStatusID")
ltgFixtureNote.notPriority.DbValue = RsRow("notPriority")
ltgFixtureNote.notIsActive.DbValue = IIf(ew_ConvertToBool(RsRow("notIsActive")), "1", "0")
ltgFixtureNote.notCreatedBy.DbValue = RsRow("notCreatedBy")
ltgFixtureNote.notCreatedOn.DbValue = RsRow("notCreatedOn")
ltgFixtureNote.notModifiedBy.DbValue = RsRow("notModifiedBy")
ltgFixtureNote.notModifiedOn.DbValue = RsRow("notModifiedOn")
End Sub
'
' Render row values based on field settings
'
Sub RenderRow()
' Row Rendering event
ltgFixtureNote.Row_Rendering()
'
' Common render codes for all row types
'
' notFixID
ltgFixtureNote.notFixID.CellCssStyle = ""
ltgFixtureNote.notFixID.CellCssClass = ""
' notTypeID
ltgFixtureNote.notTypeID.CellCssStyle = ""
ltgFixtureNote.notTypeID.CellCssClass = ""
' notDate
ltgFixtureNote.notDate.CellCssStyle = ""
ltgFixtureNote.notDate.CellCssClass = ""
' notShortDesc
ltgFixtureNote.notShortDesc.CellCssStyle = ""
ltgFixtureNote.notShortDesc.CellCssClass = ""
' notNote
ltgFixtureNote.notNote.CellCssStyle = ""
ltgFixtureNote.notNote.CellCssClass = ""
' notLPRStatusID
ltgFixtureNote.notLPRStatusID.CellCssStyle = ""
ltgFixtureNote.notLPRStatusID.CellCssClass = ""
' notPriority
ltgFixtureNote.notPriority.CellCssStyle = ""
ltgFixtureNote.notPriority.CellCssClass = ""
' notIsActive
ltgFixtureNote.notIsActive.CellCssStyle = ""
ltgFixtureNote.notIsActive.CellCssClass = ""
'
' View Row
'
If ltgFixtureNote.RowType = EW_ROWTYPE_VIEW Then ' View row
' notID
ltgFixtureNote.notID.ViewValue = ltgFixtureNote.notID.CurrentValue
ltgFixtureNote.notID.CssStyle = ""
ltgFixtureNote.notID.CssClass = ""
ltgFixtureNote.notID.ViewCustomAttributes = ""
' notFixID
ltgFixtureNote.notFixID.ViewValue = ltgFixtureNote.notFixID.CurrentValue
ltgFixtureNote.notFixID.CssStyle = ""
ltgFixtureNote.notFixID.CssClass = ""
ltgFixtureNote.notFixID.ViewCustomAttributes = ""
' notTypeID
If ew_NotEmpty(ltgFixtureNote.notTypeID.CurrentValue) Then
sSqlWrk = "SELECT [ntyDescription] FROM [ltgFixtureNoteType] WHERE [ntyID] = " & ew_AdjustSql(ltgFixtureNote.notTypeID.CurrentValue) & ""
sSqlWrk = sSqlWrk & " AND (" & "[ntyIsActive]=True" & ")"
sSqlWrk = sSqlWrk & " ORDER BY [ntyDescription] "
RsWrk = Conn.GetTempDataReader(sSqlWrk)
If RsWrk.Read() Then
ltgFixtureNote.notTypeID.ViewValue = RsWrk("ntyDescription")
Else
ltgFixtureNote.notTypeID.ViewValue = ltgFixtureNote.notTypeID.CurrentValue
End If
Conn.CloseTempDataReader()
Else
ltgFixtureNote.notTypeID.ViewValue = System.DBNull.Value
End If
ltgFixtureNote.notTypeID.CssStyle = ""
ltgFixtureNote.notTypeID.CssClass = ""
ltgFixtureNote.notTypeID.ViewCustomAttributes = ""
' notDate
ltgFixtureNote.notDate.ViewValue = ltgFixtureNote.notDate.CurrentValue
ltgFixtureNote.notDate.ViewValue = ew_FormatDateTime(ltgFixtureNote.notDate.ViewValue, 6)
ltgFixtureNote.notDate.CssStyle = ""
ltgFixtureNote.notDate.CssClass = ""
ltgFixtureNote.notDate.ViewCustomAttributes = ""
' notShortDesc
ltgFixtureNote.notShortDesc.ViewValue = ltgFixtureNote.notShortDesc.CurrentValue
ltgFixtureNote.notShortDesc.CssStyle = ""
ltgFixtureNote.notShortDesc.CssClass = ""
ltgFixtureNote.notShortDesc.ViewCustomAttributes = ""
' notNote
ltgFixtureNote.notNote.ViewValue = ltgFixtureNote.notNote.CurrentValue
ltgFixtureNote.notNote.CssStyle = ""
ltgFixtureNote.notNote.CssClass = ""
ltgFixtureNote.notNote.ViewCustomAttributes = ""
' notLPRStatusID
If ew_NotEmpty(ltgFixtureNote.notLPRStatusID.CurrentValue) Then
sSqlWrk = "SELECT [lstDescription] FROM [tblLPRStatus] WHERE [lstID] = " & ew_AdjustSql(ltgFixtureNote.notLPRStatusID.CurrentValue) & ""
sSqlWrk = sSqlWrk & " AND (" & "[lstIsActive]=True" & ")"
sSqlWrk = sSqlWrk & " ORDER BY [lstDescription] "
RsWrk = Conn.GetTempDataReader(sSqlWrk)
If RsWrk.Read() Then
ltgFixtureNote.notLPRStatusID.ViewValue = RsWrk("lstDescription")
Else
ltgFixtureNote.notLPRStatusID.ViewValue = ltgFixtureNote.notLPRStatusID.CurrentValue
End If
Conn.CloseTempDataReader()
Else
ltgFixtureNote.notLPRStatusID.ViewValue = System.DBNull.Value
End If
ltgFixtureNote.notLPRStatusID.CssStyle = ""
ltgFixtureNote.notLPRStatusID.CssClass = ""
ltgFixtureNote.notLPRStatusID.ViewCustomAttributes = ""
' notPriority
If Not IsDBNull(ltgFixtureNote.notPriority.CurrentValue) Then
Select Case ltgFixtureNote.notPriority.CurrentValue
Case "1"
ltgFixtureNote.notPriority.ViewValue = "High"
Case "2"
ltgFixtureNote.notPriority.ViewValue = "Medium"
Case "3"
ltgFixtureNote.notPriority.ViewValue = "Low"
Case Else
ltgFixtureNote.notPriority.ViewValue = ltgFixtureNote.notPriority.CurrentValue
End Select
Else
ltgFixtureNote.notPriority.ViewValue = System.DBNull.Value
End If
ltgFixtureNote.notPriority.CssStyle = ""
ltgFixtureNote.notPriority.CssClass = ""
ltgFixtureNote.notPriority.ViewCustomAttributes = ""
' notIsActive
If Convert.ToString(ltgFixtureNote.notIsActive.CurrentValue) = "1" Then
ltgFixtureNote.notIsActive.ViewValue = "Yes"
Else
ltgFixtureNote.notIsActive.ViewValue = "No"
End If
ltgFixtureNote.notIsActive.CssStyle = ""
ltgFixtureNote.notIsActive.CssClass = ""
ltgFixtureNote.notIsActive.ViewCustomAttributes = ""
' notCreatedBy
ltgFixtureNote.notCreatedBy.ViewValue = ltgFixtureNote.notCreatedBy.CurrentValue
ltgFixtureNote.notCreatedBy.CssStyle = ""
ltgFixtureNote.notCreatedBy.CssClass = ""
ltgFixtureNote.notCreatedBy.ViewCustomAttributes = ""
' notCreatedOn
ltgFixtureNote.notCreatedOn.ViewValue = ltgFixtureNote.notCreatedOn.CurrentValue
ltgFixtureNote.notCreatedOn.ViewValue = ew_FormatDateTime(ltgFixtureNote.notCreatedOn.ViewValue, 6)
ltgFixtureNote.notCreatedOn.CssStyle = ""
ltgFixtureNote.notCreatedOn.CssClass = ""
ltgFixtureNote.notCreatedOn.ViewCustomAttributes = ""
' notModifiedBy
ltgFixtureNote.notModifiedBy.ViewValue = ltgFixtureNote.notModifiedBy.CurrentValue
ltgFixtureNote.notModifiedBy.CssStyle = ""
ltgFixtureNote.notModifiedBy.CssClass = ""
ltgFixtureNote.notModifiedBy.ViewCustomAttributes = ""
' notModifiedOn
ltgFixtureNote.notModifiedOn.ViewValue = ltgFixtureNote.notModifiedOn.CurrentValue
ltgFixtureNote.notModifiedOn.ViewValue = ew_FormatDateTime(ltgFixtureNote.notModifiedOn.ViewValue, 6)
ltgFixtureNote.notModifiedOn.CssStyle = ""
ltgFixtureNote.notModifiedOn.CssClass = ""
ltgFixtureNote.notModifiedOn.ViewCustomAttributes = ""
' View refer script
' notFixID
ltgFixtureNote.notFixID.HrefValue = ""
' notTypeID
ltgFixtureNote.notTypeID.HrefValue = ""
' notDate
ltgFixtureNote.notDate.HrefValue = ""
' notShortDesc
ltgFixtureNote.notShortDesc.HrefValue = ""
' notNote
ltgFixtureNote.notNote.HrefValue = ""
' notLPRStatusID
ltgFixtureNote.notLPRStatusID.HrefValue = ""
' notPriority
ltgFixtureNote.notPriority.HrefValue = ""
' notIsActive
ltgFixtureNote.notIsActive.HrefValue = ""
'
' Add Row
'
ElseIf ltgFixtureNote.RowType = EW_ROWTYPE_ADD Then ' Add row
' notFixID
ltgFixtureNote.notFixID.EditCustomAttributes = ""
If ltgFixtureNote.notFixID.SessionValue <> "" Then
ltgFixtureNote.notFixID.CurrentValue = ltgFixtureNote.notFixID.SessionValue
ltgFixtureNote.notFixID.ViewValue = ltgFixtureNote.notFixID.CurrentValue
ltgFixtureNote.notFixID.CssStyle = ""
ltgFixtureNote.notFixID.CssClass = ""
ltgFixtureNote.notFixID.ViewCustomAttributes = ""
Else
ltgFixtureNote.notFixID.EditValue = ew_HtmlEncode(ltgFixtureNote.notFixID.CurrentValue)
End If
' notTypeID
ltgFixtureNote.notTypeID.EditCustomAttributes = ""
sSqlWrk = "SELECT [ntyID], [ntyDescription], '' AS Disp2Fld, '' AS SelectFilterFld FROM [ltgFixtureNoteType]"
sWhereWrk = ""
If sWhereWrk <> "" Then sWhereWrk = "(" & sWhereWrk & ") AND "
sWhereWrk = sWhereWrk & "(" & "[ntyIsActive]=True" & ")"
If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
sSqlWrk = sSqlWrk & " ORDER BY [ntyDescription] "
arwrk = Conn.GetRows(sSqlWrk)
arwrk.Insert(0, New Object(){"", "Please Select"})
ltgFixtureNote.notTypeID.EditValue = arwrk
' notDate
' notShortDesc
ltgFixtureNote.notShortDesc.EditCustomAttributes = ""
ltgFixtureNote.notShortDesc.EditValue = ew_HtmlEncode(ltgFixtureNote.notShortDesc.CurrentValue)
' notNote
ltgFixtureNote.notNote.EditCustomAttributes = ""
ltgFixtureNote.notNote.EditValue = ew_HtmlEncode(ltgFixtureNote.notNote.CurrentValue)
' notLPRStatusID
ltgFixtureNote.notLPRStatusID.EditCustomAttributes = ""
sSqlWrk = "SELECT [lstID], [lstDescription], '' AS Disp2Fld, '' AS SelectFilterFld FROM [tblLPRStatus]"
sWhereWrk = ""
If sWhereWrk <> "" Then sWhereWrk = "(" & sWhereWrk & ") AND "
sWhereWrk = sWhereWrk & "(" & "[lstIsActive]=True" & ")"
If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
sSqlWrk = sSqlWrk & " ORDER BY [lstDescription] "
arwrk = Conn.GetRows(sSqlWrk)
arwrk.Insert(0, New Object(){"", "Please Select"})
ltgFixtureNote.notLPRStatusID.EditValue = arwrk
' notPriority
ltgFixtureNote.notPriority.EditCustomAttributes = ""
arwrk = New ArrayList
arwrk.Add(New String() {"1", "High"})
arwrk.Add(New String() {"2", "Medium"})
arwrk.Add(New String() {"3", "Low"})
arwrk.Insert(0, New String() {"", "Please Select"})
ltgFixtureNote.notPriority.EditValue = arwrk
' notIsActive
ltgFixtureNote.notIsActive.EditCustomAttributes = ""
End If
' Row Rendered event
ltgFixtureNote.Row_Rendered()
End Sub
'
' Validate form
'
Function ValidateForm() As Boolean
' Initialize
ParentPage.gsFormError = ""
' Check if validation required
If Not EW_SERVER_VALIDATE Then Return (ParentPage.gsFormError = "")
If ew_Empty(ltgFixtureNote.notFixID.FormValue) Then
If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
ParentPage.gsFormError = ParentPage.gsFormError & "Please enter required field - Fixture"
End If
If Not ew_CheckInteger(ltgFixtureNote.notFixID.FormValue) Then
If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
ParentPage.gsFormError = ParentPage.gsFormError & "Incorrect integer - Fixture"
End If
If ew_Empty(ltgFixtureNote.notTypeID.FormValue) Then
If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
ParentPage.gsFormError = ParentPage.gsFormError & "Please enter required field - Note Type"
End If
If ew_Empty(ltgFixtureNote.notShortDesc.FormValue) Then
If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
ParentPage.gsFormError = ParentPage.gsFormError & "Please enter required field - Short Desc"
End If
' Return validate result
Dim Valid As Boolean = (ParentPage.gsFormError = "")
' Form_CustomValidate event
Dim sFormCustomError As String = ""
Valid = Valid And Form_CustomValidate(sFormCustomError)
If sFormCustomError <> "" Then
If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
ParentPage.gsFormError = ParentPage.gsFormError & sFormCustomError
End If
Return Valid
End Function
'
' Add record
'
Function AddRow() As Boolean
Dim Rs As New OrderedDictionary
Dim sSql As String, sFilter As String
Dim bInsertRow As Boolean
Dim RsChk As OleDbDataReader
Dim sIdxErrMsg As String
Dim LastInsertId As Object
' notFixID
ltgFixtureNote.notFixID.SetDbValue(ltgFixtureNote.notFixID.CurrentValue, System.DBNull.Value)
Rs("notFixID") = ltgFixtureNote.notFixID.DbValue
' notTypeID
ltgFixtureNote.notTypeID.SetDbValue(ltgFixtureNote.notTypeID.CurrentValue, System.DBNull.Value)
Rs("notTypeID") = ltgFixtureNote.notTypeID.DbValue
' notDate
ltgFixtureNote.notDate.DbValue = ew_CurrentDate()
Rs("notDate") = ltgFixtureNote.notDate.DbValue
' notShortDesc
ltgFixtureNote.notShortDesc.SetDbValue(ltgFixtureNote.notShortDesc.CurrentValue, System.DBNull.Value)
Rs("notShortDesc") = ltgFixtureNote.notShortDesc.DbValue
' notNote
ltgFixtureNote.notNote.SetDbValue(ltgFixtureNote.notNote.CurrentValue, System.DBNull.Value)
Rs("notNote") = ltgFixtureNote.notNote.DbValue
' notLPRStatusID
ltgFixtureNote.notLPRStatusID.SetDbValue(ltgFixtureNote.notLPRStatusID.CurrentValue, System.DBNull.Value)
Rs("notLPRStatusID") = ltgFixtureNote.notLPRStatusID.DbValue
' notPriority
ltgFixtureNote.notPriority.SetDbValue(ltgFixtureNote.notPriority.CurrentValue, System.DBNull.Value)
Rs("notPriority") = ltgFixtureNote.notPriority.DbValue
' notIsActive
ltgFixtureNote.notIsActive.SetDbValue((ltgFixtureNote.notIsActive.CurrentValue <> "" And Not IsDBNull(ltgFixtureNote.notIsActive.CurrentValue)), System.DBNull.Value)
Rs("notIsActive") = ltgFixtureNote.notIsActive.DbValue
' Row Inserting event
bInsertRow = ltgFixtureNote.Row_Inserting(Rs)
If bInsertRow Then
Try
ltgFixtureNote.Insert(Rs)
AddRow = True
Catch e As Exception
If EW_DEBUG_ENABLED Then Throw
Message = e.Message
AddRow = False
End Try
Else
If ltgFixtureNote.CancelMessage <> "" Then
Message = ltgFixtureNote.CancelMessage
ltgFixtureNote.CancelMessage = ""
Else
Message = "Insert cancelled"
End If
AddRow = False
End If
If AddRow Then
LastInsertId = Conn.GetLastInsertId()
ltgFixtureNote.notID.DbValue = LastInsertId
Rs("notID") = ltgFixtureNote.notID.DbValue
' Row Inserted event
ltgFixtureNote.Row_Inserted(Rs)
End If
End Function
' Page Load event
Public Sub Page_Load()
'HttpContext.Current.Response.Write("Page Load")
End Sub
' Page Unload event
Public Sub Page_Unload()
'HttpContext.Current.Response.Write("Page Unload")
End Sub
' Form Custom Validate event
Public Function Form_CustomValidate(ByRef CustomError As String) As Boolean
'Return error message in CustomError
Return True
End Function
End Class
'
' ASP.NET Page_Load event
'
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.Buffer = EW_RESPONSE_BUFFER
Response.Cache.SetCacheability(HttpCacheability.NoCache)
' Page init
ltgFixtureNote_add = New cltgFixtureNote_add(Me)
ltgFixtureNote_add.Page_Init()
' Page main processing
ltgFixtureNote_add.Page_Main()
End Sub
'
' ASP.NET Page_Unload event
'
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
' Dispose page object
If ltgFixtureNote_add IsNot Nothing Then ltgFixtureNote_add.Dispose()
End Sub
End Class