-14 Removals
+5 Additions
Imports ValidatorClass Imports ValidatorClass
Imports GenericDataService Imports GenericDataService
Imports System Imports System
Imports System.Collections.Generic Imports System.Collections.Generic
Imports System.ComponentModel Imports System.ComponentModel
Imports System.Data Imports System.Data
Imports System.Drawing Imports System.Drawing
Imports System.Text Imports System.Text
Imports System.Reflection Imports System.Reflection
Imports System.Configuration Imports System.Configuration
Imports System.Xml Imports System.Xml
Imports System.IO Imports System.IO
Imports System.Net.Mail.MailMessage Imports System.Net.Mail.MailMessage
Imports System.Data.OracleClient Imports System.Data.OracleClient
'********************************************************************************************** '**********************************************************************************************
'* Created By: Jayanto Kumar Chowdhury '* Created By: Jayanto Kumar Chowdhury
'* Created On: 11th August, 2012 '* Created On: 11th August, 2012
'* Department: ITS, Tata Steel '* Department: ITS, Tata Steel
'* '*
'* Purpose: This page is used by user to raise new request in AIMS. "New", "Modify" and "Removal" request can '* Purpose: This page is used by user to raise new request in AIMS. "New", "Modify" and "Removal" request can
'* be raised using this webpage. One panel has been used for New request and other panel has been used for modify and '* be raised using this webpage. One panel has been used for New request and other panel has been used for modify and
'* removal request. Currently this code is stable and any changes should be done after proper impact analysis. '* removal request. Currently this code is stable and any changes should be done after proper impact analysis.
'* '*
'* '*
'* Modification History Date Modified By Tag Used '* Modification History Date Modified By Tag Used
'* Paging functionality for display grid 12th Sep, 2012 Jayanto '* Paging functionality for display grid 12th Sep, 2012 Jayanto
'* Change approver functionality 24th Sep, 2012 Jayanto '<Choose Approover>, </Choose Approover> '* Change approver functionality 24th Sep, 2012 Jayanto '<Choose Approover>, </Choose Approover>
'* Add date and Time during Request 20th Nov, 2012 Jayanto '<Add Time>, </Add Time> '* Add date and Time during Request 20th Nov, 2012 Jayanto '<Add Time>, </Add Time>
'* Approver List Modification 21st Nov, 2012 Jayanto <Approver List>,</Approver List> '* Approver List Modification 21st Nov, 2012 Jayanto <Approver List>,</Approver List>
' **********************************************************************************************/ ' **********************************************************************************************/
Partial Class AIMS008 Partial Class AIMS008
Inherits System.Web.UI.Page Inherits System.Web.UI.Page
Dim objMultipleSelection As New Common Dim objMultipleSelection As New Common
Private _dbHelper As DBHelper = Nothing Private _dbHelper As DBHelper = Nothing
'Private _dbHelperSAP As DBHelper = Nothing 'Private _dbHelperSAP As DBHelper = Nothing
'Private Const con As String = "User ID=AIMSDEVQRY;Data Source=AIMSDEV;pwd=aims123" 'Private Const con As String = "User ID=AIMSDEVQRY;Data Source=AIMSDEV;pwd=aims123"
'Private Const _dbProvider As String = "System.Data.OracleClient" 'Private Const _dbProvider As String = "System.Data.OracleClient"
Private con As String = ConfigurationManager.ConnectionStrings("AIMSDEVCON").ConnectionString Private con As String = ConfigurationManager.ConnectionStrings("AIMSDEVCON").ConnectionString
Private _dbProvider As String = ConfigurationManager.ConnectionStrings("AIMSDEVCON").ProviderName Private _dbProvider As String = ConfigurationManager.ConnectionStrings("AIMSDEVCON").ProviderName
Shared dt_status As New DataTable Shared dt_status As New DataTable
'Private connSAP As String = ConfigurationManager.ConnectionStrings("AIMSSAPCON").ConnectionString 'Private connSAP As String = ConfigurationManager.ConnectionStrings("AIMSSAPCON").ConnectionString
'Private _dbProviderSAP As String = ConfigurationManager.ConnectionStrings("AIMSSAPCON").ProviderName 'Private _dbProviderSAP As String = ConfigurationManager.ConnectionStrings("AIMSSAPCON").ProviderName
Shared selected_apps As String = " " Shared selected_apps As String = " "
Shared unselected_apps As String = " " Shared unselected_apps As String = " "
Dim v1 As New Validation Dim v1 As New Validation
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("UserId") = "" Then If Session("UserId") = "" Then
Response.Redirect("AIMSLogin.aspx") Response.Redirect("AIMSLogin.aspx")
'Session.Abandon() 'Session.Abandon()
'Response.Write("<SCRIPT >var x =confirm('Your session has expired or invalid URL !!! \nPress Cancel to close browser and enter correct URL.');if (x==false){ var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;if (ie7){window.open('','_parent','');window.close();}else{this.focus();self.opener = this;self.close();}}</SCRIPT>") 'Response.Write("<SCRIPT >var x =confirm('Your session has expired or invalid URL !!! \nPress Cancel to close browser and enter correct URL.');if (x==false){ var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;if (ie7){window.open('','_parent','');window.close();}else{this.focus();self.opener = this;self.close();}}</SCRIPT>")
'Response.End() 'Response.End()
End If End If
If Not Page.IsPostBack Then If Not Page.IsPostBack Then
'During page load hide error msg and New request panels 'During page load hide error msg and New request panels
lbl_usr_id_varification.Visible = False lbl_usr_id_varification.Visible = False
tdError.Visible = False tdError.Visible = False
lblErrorMessage.Visible = False lblErrorMessage.Visible = False
pnlRequestDetails.Visible = False pnlRequestDetails.Visible = False
'pnlChangeOwner.Visible = False 'pnlChangeOwner.Visible = False
'During page load hide error msg and New request panels 'During page load hide error msg and New request panels
tdModError.Visible = False tdModError.Visible = False
lblModErrorMessage.Visible = False lblModErrorMessage.Visible = False
pnlModificationDetails.Visible = False pnlModificationDetails.Visible = False
'During page load hide error msg and Change Owner panels 'During page load hide error msg and Change Owner panels
'td_Change_owner_error.Visible = False 'td_Change_owner_error.Visible = False
'lbl_Change_ownership_error.Visible = False 'lbl_Change_ownership_error.Visible = False
'pnlChangeOwner.Visible = False 'pnlChangeOwner.Visible = False
End If End If
If Session("ActiveTab").ToString = "AIMS008" Then If Session("ActiveTab").ToString = "AIMS008" Then
_dbHelper = DBHelper.GetInstance(con, _dbProvider) _dbHelper = DBHelper.GetInstance(con, _dbProvider)
'_dbHelperSAP = DBHelper.GetInstance(connSAP, _dbProviderSAP) '_dbHelperSAP = DBHelper.GetInstance(connSAP, _dbProviderSAP)
If Not Page.IsPostBack Then If Not Page.IsPostBack Then
PopulateAuthiorisedSystemName() PopulateAuthiorisedSystemName()
tdError.Visible = False tdError.Visible = False
lblErrorMessage.Visible = False lblErrorMessage.Visible = False
pnlRequestDetails.Visible = False pnlRequestDetails.Visible = False
'pnlChangeOwner.Visible = False 'pnlChangeOwner.Visible = False
End If End If
End If End If
End Sub End Sub
Protected Sub PopSysNames(ByVal strUsr As String) Protected Sub PopSysNames(ByVal strUsr As String)
Dim qry As String = String.Empty Dim qry As String = String.Empty
If strUsr = String.Empty Then If strUsr = String.Empty Then
qry = SqlQueries.LOAD_SYSTEM_NAMES qry = SqlQueries.LOAD_SYSTEM_NAMES
qry = qry.Replace("@U.TUM_USER_PNO", "'" & txtUserPersonalNo.Text & "'") qry = qry.Replace("@U.TUM_USER_PNO", "'" & txtUserPersonalNo.Text & "'")
qry = qry.Replace("@U.TUM_TOM_OWN_PNO", "'" & txtOwnerPerNo.Text.Trim & "'") qry = qry.Replace("@U.TUM_TOM_OWN_PNO", "'" & txtOwnerPerNo.Text.Trim & "'")
SqlDataSource1.SelectCommand = qry SqlDataSource1.SelectCommand = qry
Else Else
qry = SqlQueries.LOAD_SYSTEM_NAMES_NULL qry = SqlQueries.LOAD_SYSTEM_NAMES_NULL
qry = qry.Replace("@U.TUM_USER_PNO", "'" & String.Empty & "'") qry = qry.Replace("@U.TUM_USER_PNO", "'" & String.Empty & "'")
qry = qry.Replace("@U.TUM_TOM_OWN_PNO", "'" & txtOwnerPerNo.Text.Trim & "'") qry = qry.Replace("@U.TUM_TOM_OWN_PNO", "'" & txtOwnerPerNo.Text.Trim & "'")
SqlDataSource1.SelectCommand = qry SqlDataSource1.SelectCommand = qry
End If End If
End Sub End Sub
Protected Sub PopulateSystemNameForModification() Protected Sub PopulateSystemNameForModification()
Dim dtSystemName As New DataTable Dim dtSystemName As New DataTable
Dim objCommon As New Common Dim objCommon As New Common
Try Try
Dim sys_qry As String = SqlQueries.LOAD_SYSTEM_FOR_MODIFICATION Dim sys_qry As String = SqlQueries.LOAD_SYSTEM_FOR_MODIFICATION
sys_qry = sys_qry.Replace("@TUM_TOM_OWN_PNO", objCommon.GetPaddedPersonalNumbers(Session("UserId").ToString)) sys_qry = sys_qry.Replace("@TUM_TOM_OWN_PNO", objCommon.GetPaddedPersonalNumbers(Session("UserId").ToString))
dtSystemName = _dbHelper.ExecuteDataTable(sys_qry) dtSystemName = _dbHelper.ExecuteDataTable(sys_qry)
If dtSystemName.Rows.Count > 0 Then If dtSystemName.Rows.Count > 0 Then
Dim count As Integer = 0 Dim count As Integer = 0
For Each eachRow As DataRow In dtSystemName.Rows For Each eachRow As DataRow In dtSystemName.Rows
eachRow("TAP_SUB_APP_DESC") = eachRow("TAP_SUB_APP_DESC").ToString & ":" & eachRow("TUM_USR_ID").ToString eachRow("TAP_SUB_APP_DESC") = eachRow("TAP_SUB_APP_DESC").ToString & ":" & eachRow("TUM_USR_ID").ToString
eachRow("TAP_SUB_APP_CD") = eachRow("TAP_SUB_APP_CD").ToString & "!" & count.ToString eachRow("TAP_SUB_APP_CD") = eachRow("TAP_SUB_APP_CD").ToString & "!" & count.ToString
count = count + 1 count = count + 1
Next Next
cmbModSystemNames.Items.Clear() cmbModSystemNames.Items.Clear()
cmbModSystemNames.DataSource = dtSystemName cmbModSystemNames.DataSource = dtSystemName
cmbModSystemNames.DataTextField = "TAP_SUB_APP_DESC" cmbModSystemNames.DataTextField = "TAP_SUB_APP_DESC"
cmbModSystemNames.DataValueField = "TAP_SUB_APP_CD" cmbModSystemNames.DataValueField = "TAP_SUB_APP_CD"
cmbModSystemNames.DataBind() cmbModSystemNames.DataBind()
cmbModSystemNames.Items.Insert(0, "select") cmbModSystemNames.Items.Insert(0, "select")
End If End If
Catch ex As Exception Catch ex As Exception
Finally Finally
dtSystemName.Dispose() dtSystemName.Dispose()
End Try End Try
End Sub End Sub
Protected Sub PopulateModApprover() Protected Sub PopulateModApprover()
Dim dtApprover As New DataTable Dim dtApprover As New DataTable
Try Try
Dim strUserId As String = Session("UserId").ToString Dim strUserId As String = Session("UserId").ToString
If strUserId.Length <= 5 Then If strUserId.Length <= 5 Then
Dim padchar As String = "0" Dim padchar As String = "0"
strUserId = strUserId.PadLeft(6, padchar) strUserId = strUserId.PadLeft(6, padchar)
End If End If
'<Approver List Issue> '<Approver List Issue>
'Differentiate OPR & NON OPR employees 'Differentiate OPR & NON OPR employees
Dim sqlUserType As String = SqlQueries.AIMS_GET_EMPLOYEE_CLASS Dim sqlUserType As String = SqlQueries.AIMS_GET_EMPLOYEE_CLASS
sqlUserType = sqlUserType.Replace("@ema_perno", "'" & strUserId & "'") sqlUserType = sqlUserType.Replace("@ema_perno", "'" & strUserId & "'")
Dim objUserType As Object = _dbHelper.ExecuteScalar(sqlUserType) Dim objUserType As Object = _dbHelper.ExecuteScalar(sqlUserType)
'If OPR then 'If OPR then
If (objUserType IsNot Nothing AndAlso objUserType.ToString.Trim() = "1") Or _ If (objUserType IsNot Nothing AndAlso objUserType.ToString.Trim() = "1") Or _
(objUserType IsNot Nothing AndAlso objUserType.ToString.Trim() = "2") Then (objUserType IsNot Nothing AndAlso objUserType.ToString.Trim() = "2") Then
'Query to find the actual IL3 & above approver list 'Query to find the actual IL3 & above approver list
Dim sqlGetApprover As String = SqlQueries.AIMS008_GET_OPR_APPROVER_NAME Dim sqlGetApprover As String = SqlQueries.AIMS008_GET_OPR_APPROVER_NAME
sqlGetApprover = sqlGetApprover.Replace("@ema_perno", "'" & strUserId & "'") sqlGetApprover = sqlGetApprover.Replace("@ema_perno", "'" & strUserId & "'")
dtApprover = _dbHelper.ExecuteDataTable(sqlGetApprover) dtApprover = _dbHelper.ExecuteDataTable(sqlGetApprover)
If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then
cmbModApprover.Items.Clear() cmbModApprover.Items.Clear()
cmbModApprover.DataSource = dtApprover cmbModApprover.DataSource = dtApprover
cmbModApprover.DataTextField = "ema_ename" cmbModApprover.DataTextField = "ema_ename"
cmbModApprover.DataValueField = "ema_perno" cmbModApprover.DataValueField = "ema_perno"
cmbModApprover.DataBind() cmbModApprover.DataBind()
cmbModApprover.Items.Insert(0, "select") cmbModApprover.Items.Insert(0, "select")
Else 'If not found IL3 & above approver list then get the acting head list Else 'If not found IL3 & above approver list then get the acting head list
Dim sqlActingApprover As String = SqlQueries.AIMS_GET_ACTING_HEADLIST_FOR_OPR Dim sqlActingApprover As String = SqlQueries.AIMS_GET_ACTING_HEADLIST_FOR_OPR
sqlActingApprover = sqlActingApprover.Replace("@EMA_PERNO", "'" & strUserId & "'") sqlActingApprover = sqlActingApprover.Replace("@EMA_PERNO", "'" & strUserId & "'")
dtApprover = _dbHelper.ExecuteDataTable(sqlActingApprover) dtApprover = _dbHelper.ExecuteDataTable(sqlActingApprover)
If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then
cmbModApprover.Items.Clear() cmbModApprover.Items.Clear()
cmbModApprover.DataSource = dtApprover cmbModApprover.DataSource = dtApprover
cmbModApprover.DataTextField = "ema_ename" cmbModApprover.DataTextField = "ema_ename"
cmbModApprover.DataValueField = "ema_perno" cmbModApprover.DataValueField = "ema_perno"
cmbModApprover.DataBind() cmbModApprover.DataBind()
cmbModApprover.Items.Insert(0, "select") cmbModApprover.Items.Insert(0, "select")
End If End If
End If End If
'If NON OPR then 'If NON OPR then
ElseIf (objUserType IsNot Nothing AndAlso objUserType.ToString.Trim() = "3") Or _ ElseIf (objUserType IsNot Nothing AndAlso objUserType.ToString.Trim() = "3") Or _
(objUserType IsNot Nothing AndAlso objUserType.ToString.Trim() = "4") Then (objUserType IsNot Nothing AndAlso objUserType.ToString.Trim() = "4") Then
Dim sqlPayRollArea As String = SqlQueries.AIMS008_GET_PAYROLL Dim sqlPayRollArea As String = SqlQueries.AIMS008_GET_PAYROLL
sqlPayRollArea = sqlPayRollArea.Replace("@ema_perno", "'" & strUserId & "'") sqlPayRollArea = sqlPayRollArea.Replace("@ema_perno", "'" & strUserId & "'")
Dim objPayRoll As Object = _dbHelper.ExecuteScalar(sqlPayRollArea) Dim objPayRoll As Object = _dbHelper.ExecuteScalar(sqlPayRollArea)
If objPayRoll IsNot Nothing AndAlso objPayRoll.ToString.Trim().ToUpper = "JH12" Then If objPayRoll IsNot Nothing AndAlso objPayRoll.ToString.Trim().ToUpper = "JH12" Then
Dim sqlJSApprover As String = SqlQueries.AIMS008_GET_JS_APPROVER Dim sqlJSApprover As String = SqlQueries.AIMS008_GET_JS_APPROVER
sqlJSApprover = sqlJSApprover.Replace("@EMA_PERNO", "'" & strUserId & "'") sqlJSApprover = sqlJSApprover.Replace("@EMA_PERNO", "'" & strUserId & "'")
dtApprover = _dbHelper.ExecuteDataTable(sqlJSApprover) dtApprover = _dbHelper.ExecuteDataTable(sqlJSApprover)
If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then
cmbModApprover.Items.Clear() cmbModApprover.Items.Clear()
cmbModApprover.DataSource = dtApprover cmbModApprover.DataSource = dtApprover
cmbModApprover.DataTextField = "ema_ename" cmbModApprover.DataTextField = "ema_ename"
cmbModApprover.DataValueField = "ema_perno" cmbModApprover.DataValueField = "ema_perno"
cmbModApprover.DataBind() cmbModApprover.DataBind()
cmbModApprover.Items.Insert(0, "select") cmbModApprover.Items.Insert(0, "select")
Else Else
Dim sqlJSActingApprover As String = SqlQueries.AIMS_GET_ACTING_HEADLIST_FOR_JS_NONOPR Dim sqlJSActingApprover As String = SqlQueries.AIMS_GET_ACTING_HEADLIST_FOR_JS_NONOPR
sqlJSActingApprover = sqlJSActingApprover.Replace("@EMA_PERNO", "'" & strUserId & "'") sqlJSActingApprover = sqlJSActingApprover.Replace("@EMA_PERNO", "'" & strUserId & "'")
dtApprover = _dbHelper.ExecuteDataTable(sqlJSActingApprover) dtApprover = _dbHelper.ExecuteDataTable(sqlJSActingApprover)
If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then
cmbModApprover.Items.Clear() cmbModApprover.Items.Clear()
cmbModApprover.DataSource = dtApprover cmbModApprover.DataSource = dtApprover
cmbModApprover.DataTextField = "ema_ename" cmbModApprover.DataTextField = "ema_ename"
cmbModApprover.DataValueField = "ema_perno" cmbModApprover.DataValueField = "ema_perno"
cmbModApprover.DataBind() cmbModApprover.DataBind()
cmbModApprover.Items.Insert(0, "select") cmbModApprover.Items.Insert(0, "select")
End If End If
End If End If
Else Else
Dim sqlGetNonJS As String = SqlQueries.AIMS008_GET_NON_JS_APPROVER Dim sqlGetNonJS As String = SqlQueries.AIMS008_GET_NON_JS_APPROVER
sqlGetNonJS = sqlGetNonJS.Replace("@EMA_PERNO", "'" & strUserId & "'") sqlGetNonJS = sqlGetNonJS.Replace("@EMA_PERNO", "'" & strUserId & "'")
dtApprover = _dbHelper.ExecuteDataTable(sqlGetNonJS) dtApprover = _dbHelper.ExecuteDataTable(sqlGetNonJS)
If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then
cmbModApprover.Items.Clear() cmbModApprover.Items.Clear()
cmbModApprover.DataSource = dtApprover cmbModApprover.DataSource = dtApprover
cmbModApprover.DataTextField = "ema_ename" cmbModApprover.DataTextField = "ema_ename"
cmbModApprover.DataValueField = "ema_perno" cmbModApprover.DataValueField = "ema_perno"
cmbModApprover.DataBind() cmbModApprover.DataBind()
cmbModApprover.Items.Insert(0, "select") cmbModApprover.Items.Insert(0, "select")
Else Else
Dim sqlActingGetNonJS As String = SqlQueries.AIMS_GET_ACTING_HEADLIST_FOR_NONJS_NONOPR Dim sqlActingGetNonJS As String = SqlQueries.AIMS_GET_ACTING_HEADLIST_FOR_NONJS_NONOPR
sqlActingGetNonJS = sqlActingGetNonJS.Replace("@EMA_PERNO", "'" & strUserId & "'") sqlActingGetNonJS = sqlActingGetNonJS.Replace("@EMA_PERNO", "'" & strUserId & "'")
dtApprover = _dbHelper.ExecuteDataTable(sqlActingGetNonJS) dtApprover = _dbHelper.ExecuteDataTable(sqlActingGetNonJS)
If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then
cmbModApprover.Items.Clear() cmbModApprover.Items.Clear()
cmbModApprover.DataSource = dtApprover cmbModApprover.DataSource = dtApprover
cmbModApprover.DataTextField = "ema_ename" cmbModApprover.DataTextField = "ema_ename"
cmbModApprover.DataValueField = "ema_perno" cmbModApprover.DataValueField = "ema_perno"
cmbModApprover.DataBind() cmbModApprover.DataBind()
cmbModApprover.Items.Insert(0, "select") cmbModApprover.Items.Insert(0, "select")
End If End If
End If End If
End If End If
End If End If
'</Approver List Issue> '</Approver List Issue>
Catch ex As Exception Catch ex As Exception
Finally Finally
dtApprover.Dispose() dtApprover.Dispose()
End Try End Try
End Sub End Sub
Protected Sub PopulateApprover() Protected Sub PopulateApprover()
Dim dtApprover As New DataTable Dim dtApprover As New DataTable
Try Try
Dim strUserId As String = Session("UserId").ToString Dim strUserId As String = Session("UserId").ToString
If strUserId.Length <= 5 Then If strUserId.Length <= 5 Then
Dim padchar As String = "0" Dim padchar As String = "0"
strUserId = strUserId.PadLeft(6, padchar) strUserId = strUserId.PadLeft(6, padchar)
End If End If
'<Approver List Issue> '<Approver List Issue>
'Differentiate OPR & NON OPR employees 'Differentiate OPR & NON OPR employees
Dim sqlUserType As String = SqlQueries.AIMS_GET_EMPLOYEE_CLASS Dim sqlUserType As String = SqlQueries.AIMS_GET_EMPLOYEE_CLASS
sqlUserType = sqlUserType.Replace("@ema_perno", "'" & strUserId & "'") sqlUserType = sqlUserType.Replace("@ema_perno", "'" & strUserId & "'")
Dim objUserType As Object = _dbHelper.ExecuteScalar(sqlUserType) Dim objUserType As Object = _dbHelper.ExecuteScalar(sqlUserType)
'If OPR then 'If OPR then
If (objUserType IsNot Nothing AndAlso objUserType.ToString.Trim() = "1") Or _ If (objUserType IsNot Nothing AndAlso objUserType.ToString.Trim() = "1") Or _
(objUserType IsNot Nothing AndAlso objUserType.ToString.Trim() = "2") Then (objUserType IsNot Nothing AndAlso objUserType.ToString.Trim() = "2") Then
'Query to find the actual IL3 & above approver list 'Query to find the actual IL3 & above approver list
Dim sqlGetApprover As String = SqlQueries.AIMS008_GET_OPR_APPROVER_NAME Dim sqlGetApprover As String = SqlQueries.AIMS008_GET_OPR_APPROVER_NAME
sqlGetApprover = sqlGetApprover.Replace("@ema_perno", "'" & strUserId & "'") sqlGetApprover = sqlGetApprover.Replace("@ema_perno", "'" & strUserId & "'")
dtApprover = _dbHelper.ExecuteDataTable(sqlGetApprover) dtApprover = _dbHelper.ExecuteDataTable(sqlGetApprover)
If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then
cmbApprover.Items.Clear() cmbApprover.Items.Clear()
cmbApprover.DataSource = dtApprover cmbApprover.DataSource = dtApprover
cmbApprover.DataTextField = "ema_ename" cmbApprover.DataTextField = "ema_ename"
cmbApprover.DataValueField = "ema_perno" cmbApprover.DataValueField = "ema_perno"
cmbApprover.DataBind() cmbApprover.DataBind()
cmbApprover.Items.Insert(0, "select") cmbApprover.Items.Insert(0, "select")
Else 'If not found IL3 & above approver list then get the acting head list Else 'If not found IL3 & above approver list then get the acting head list
Dim sqlActingApprover As String = SqlQueries.AIMS_GET_ACTING_HEADLIST_FOR_OPR Dim sqlActingApprover As String = SqlQueries.AIMS_GET_ACTING_HEADLIST_FOR_OPR
sqlActingApprover = sqlActingApprover.Replace("@EMA_PERNO", "'" & strUserId & "'") sqlActingApprover = sqlActingApprover.Replace("@EMA_PERNO", "'" & strUserId & "'")
dtApprover = _dbHelper.ExecuteDataTable(sqlActingApprover) dtApprover = _dbHelper.ExecuteDataTable(sqlActingApprover)
If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then
cmbApprover.Items.Clear() cmbApprover.Items.Clear()
cmbApprover.DataSource = dtApprover cmbApprover.DataSource = dtApprover
cmbApprover.DataTextField = "ema_ename" cmbApprover.DataTextField = "ema_ename"
cmbApprover.DataValueField = "ema_perno" cmbApprover.DataValueField = "ema_perno"
cmbApprover.DataBind() cmbApprover.DataBind()
cmbApprover.Items.Insert(0, "select") cmbApprover.Items.Insert(0, "select")
End If End If
End If End If
'If NON OPR then 'If NON OPR then
ElseIf (objUserType IsNot Nothing AndAlso objUserType.ToString.Trim() = "3") Or _ ElseIf (objUserType IsNot Nothing AndAlso objUserType.ToString.Trim() = "3") Or _
(objUserType IsNot Nothing AndAlso objUserType.ToString.Trim() = "4") Then (objUserType IsNot Nothing AndAlso objUserType.ToString.Trim() = "4") Then
Dim sqlPayRollArea As String = SqlQueries.AIMS008_GET_PAYROLL Dim sqlPayRollArea As String = SqlQueries.AIMS008_GET_PAYROLL
sqlPayRollArea = sqlPayRollArea.Replace("@ema_perno", "'" & strUserId & "'") sqlPayRollArea = sqlPayRollArea.Replace("@ema_perno", "'" & strUserId & "'")
Dim objPayRoll As Object = _dbHelper.ExecuteScalar(sqlPayRollArea) Dim objPayRoll As Object = _dbHelper.ExecuteScalar(sqlPayRollArea)
If objPayRoll IsNot Nothing AndAlso objPayRoll.ToString.Trim().ToUpper = "JH12" Then If objPayRoll IsNot Nothing AndAlso objPayRoll.ToString.Trim().ToUpper = "JH12" Then
Dim sqlJSApprover As String = SqlQueries.AIMS008_GET_JS_APPROVER Dim sqlJSApprover As String = SqlQueries.AIMS008_GET_JS_APPROVER
sqlJSApprover = sqlJSApprover.Replace("@EMA_PERNO", "'" & strUserId & "'") sqlJSApprover = sqlJSApprover.Replace("@EMA_PERNO", "'" & strUserId & "'")
dtApprover = _dbHelper.ExecuteDataTable(sqlJSApprover) dtApprover = _dbHelper.ExecuteDataTable(sqlJSApprover)
If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then
cmbApprover.Items.Clear() cmbApprover.Items.Clear()
cmbApprover.DataSource = dtApprover cmbApprover.DataSource = dtApprover
cmbApprover.DataTextField = "ema_ename" cmbApprover.DataTextField = "ema_ename"
cmbApprover.DataValueField = "ema_perno" cmbApprover.DataValueField = "ema_perno"
cmbApprover.DataBind() cmbApprover.DataBind()
cmbApprover.Items.Insert(0, "select") cmbApprover.Items.Insert(0, "select")
Else Else
Dim sqlJSActingApprover As String = SqlQueries.AIMS_GET_ACTING_HEADLIST_FOR_JS_NONOPR Dim sqlJSActingApprover As String = SqlQueries.AIMS_GET_ACTING_HEADLIST_FOR_JS_NONOPR
sqlJSActingApprover = sqlJSActingApprover.Replace("@EMA_PERNO", "'" & strUserId & "'") sqlJSActingApprover = sqlJSActingApprover.Replace("@EMA_PERNO", "'" & strUserId & "'")
dtApprover = _dbHelper.ExecuteDataTable(sqlJSActingApprover) dtApprover = _dbHelper.ExecuteDataTable(sqlJSActingApprover)
If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then
cmbApprover.Items.Clear() cmbApprover.Items.Clear()
cmbApprover.DataSource = dtApprover cmbApprover.DataSource = dtApprover
cmbApprover.DataTextField = "ema_ename" cmbApprover.DataTextField = "ema_ename"
cmbApprover.DataValueField = "ema_perno" cmbApprover.DataValueField = "ema_perno"
cmbApprover.DataBind() cmbApprover.DataBind()
cmbApprover.Items.Insert(0, "select") cmbApprover.Items.Insert(0, "select")
End If End If
End If End If
Else Else
Dim sqlGetNonJS As String = SqlQueries.AIMS008_GET_NON_JS_APPROVER Dim sqlGetNonJS As String = SqlQueries.AIMS008_GET_NON_JS_APPROVER
sqlGetNonJS = sqlGetNonJS.Replace("@EMA_PERNO", "'" & strUserId & "'") sqlGetNonJS = sqlGetNonJS.Replace("@EMA_PERNO", "'" & strUserId & "'")
dtApprover = _dbHelper.ExecuteDataTable(sqlGetNonJS) dtApprover = _dbHelper.ExecuteDataTable(sqlGetNonJS)
If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then
cmbApprover.Items.Clear() cmbApprover.Items.Clear()
cmbApprover.DataSource = dtApprover cmbApprover.DataSource = dtApprover
cmbApprover.DataTextField = "ema_ename" cmbApprover.DataTextField = "ema_ename"
cmbApprover.DataValueField = "ema_perno" cmbApprover.DataValueField = "ema_perno"
cmbApprover.DataBind() cmbApprover.DataBind()
cmbApprover.Items.Insert(0, "select") cmbApprover.Items.Insert(0, "select")
Else Else
Dim sqlActingGetNonJS As String = SqlQueries.AIMS_GET_ACTING_HEADLIST_FOR_NONJS_NONOPR Dim sqlActingGetNonJS As String = SqlQueries.AIMS_GET_ACTING_HEADLIST_FOR_NONJS_NONOPR
sqlActingGetNonJS = sqlActingGetNonJS.Replace("@EMA_PERNO", "'" & strUserId & "'") sqlActingGetNonJS = sqlActingGetNonJS.Replace("@EMA_PERNO", "'" & strUserId & "'")
dtApprover = _dbHelper.ExecuteDataTable(sqlActingGetNonJS) dtApprover = _dbHelper.ExecuteDataTable(sqlActingGetNonJS)
If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then
cmbApprover.Items.Clear() cmbApprover.Items.Clear()
cmbApprover.DataSource = dtApprover cmbApprover.DataSource = dtApprover
cmbApprover.DataTextField = "ema_ename" cmbApprover.DataTextField = "ema_ename"
cmbApprover.DataValueField = "ema_perno" cmbApprover.DataValueField = "ema_perno"
cmbApprover.DataBind() cmbApprover.DataBind()
cmbApprover.Items.Insert(0, "select") cmbApprover.Items.Insert(0, "select")
End If End If
End If End If
End If End If
End If End If
'</Approver List Issue> '</Approver List Issue>
Catch ex As Exception Catch ex As Exception
Finally Finally
dtApprover.Dispose() dtApprover.Dispose()
End Try End Try
End Sub End Sub
Protected Sub PopulateUserType() Protected Sub PopulateUserType()
Dim dtUserType As New DataTable Dim dtUserType As New DataTable
Try Try
dtUserType = _dbHelper.ExecuteDataTable(SqlQueries.LOAD_USERTYPE) dtUserType = _dbHelper.ExecuteDataTable(SqlQueries.LOAD_USERTYPE)
If dtUserType IsNot Nothing AndAlso dtUserType.Rows.Count > 0 Then If dtUserType IsNot Nothing AndAlso dtUserType.Rows.Count > 0 Then
cmbUserType.DataSource = dtUserType cmbUserType.DataSource = dtUserType
cmbUserType.DataTextField = "TCE_CODE_DESC" cmbUserType.DataTextField = "TCE_CODE_DESC"
cmbUserType.DataValueField = "TCE_CODE_VAL" cmbUserType.DataValueField = "TCE_CODE_VAL"
cmbUserType.DataBind() cmbUserType.DataBind()
cmbUserType.Items.Insert(0, "select") cmbUserType.Items.Insert(0, "select")
If chkSelectEmpType.Text = "TATA STEEL Employee" Then If chkSelectEmpType.Text = "TATA STEEL Employee" Then
cmbUserType.SelectedIndex = 0 cmbUserType.SelectedIndex = 0
lbl_usr_id_varification.Visible = False lbl_usr_id_varification.Visible = False
ElseIf chkSelectEmpType.Text = "ID under my ownership" Then ElseIf chkSelectEmpType.Text = "ID under my ownership" Then
cmbUserType.SelectedIndex = 0 cmbUserType.SelectedIndex = 0
lbl_usr_id_varification.Visible = True lbl_usr_id_varification.Visible = True
End If End If
End If End If
Catch ex As Exception Catch ex As Exception
Finally Finally
dtUserType.Dispose() dtUserType.Dispose()
End Try End Try
End Sub End Sub
Protected Sub PopulateModUserType() Protected Sub PopulateModUserType()
Dim dtUserType As New DataTable Dim dtUserType As New DataTable
Try Try
dtUserType = _dbHelper.ExecuteDataTable(SqlQueries.LOAD_USERTYPE) dtUserType = _dbHelper.ExecuteDataTable(SqlQueries.LOAD_USERTYPE)
If dtUserType IsNot Nothing AndAlso dtUserType.Rows.Count > 0 Then If dtUserType IsNot Nothing AndAlso dtUserType.Rows.Count > 0 Then
cmbModUserType.DataSource = dtUserType cmbModUserType.DataSource = dtUserType
cmbModUserType.DataTextField = "TCE_CODE_DESC" cmbModUserType.DataTextField = "TCE_CODE_DESC"
cmbModUserType.DataValueField = "TCE_CODE_VAL" cmbModUserType.DataValueField = "TCE_CODE_VAL"
cmbModUserType.DataBind() cmbModUserType.DataBind()
cmbModUserType.Items.Insert(0, "select") cmbModUserType.Items.Insert(0, "select")
If radModDetails.Text = "TATA STEEL Employee" Then If radModDetails.Text = "TATA STEEL Employee" Then
cmbModUserType.SelectedIndex = 1 cmbModUserType.SelectedIndex = 1
ElseIf radModDetails.Text = "ID under my ownership" Then ElseIf radModDetails.Text = "ID under my ownership" Then
cmbModUserType.SelectedIndex = 2 cmbModUserType.SelectedIndex = 2
End If End If
End If End If
Catch ex As Exception Catch ex As Exception
Finally Finally
dtUserType.Dispose() dtUserType.Dispose()
End Try End Try
End Sub End Sub
Protected Function GetUserPersonalNumber(ByVal perNo As String) As String Protected Function GetUserPersonalNumber(ByVal perNo As String) As String
Try Try
Dim SqlInsert As String = SqlQueries.AIMS002_LOADUSER_PNO Dim SqlInsert As String = SqlQueries.AIMS002_LOADUSER_PNO
SqlInsert = SqlInsert.Replace("@TUM_TOM_OWN_PNO", "'" & perNo & "'") SqlInsert = SqlInsert.Replace("@TUM_TOM_OWN_PNO", "'" & perNo & "'")
Dim obj As Object = _dbHelper.ExecuteScalar(SqlInsert) Dim obj As Object = _dbHelper.ExecuteScalar(SqlInsert)
If obj IsNot Nothing Then If obj IsNot Nothing Then
Return Convert.ToString(obj) Return Convert.ToString(obj)
Else Else
Return String.Empty Return String.Empty
End If End If
Catch ex As Exception Catch ex As Exception
Return String.Empty Return String.Empty
Finally Finally
End Try End Try
End Function End Function
Protected Sub PopulateSystemNames() Protected Sub PopulateSystemNames()
Dim dtApprover As New DataTable Dim dtApprover As New DataTable
Try Try
Dim SqlInsert As String = SqlQueries.AIMS002_LOAD_SYSTEM_NAMES Dim SqlInsert As String = SqlQueries.AIMS002_LOAD_SYSTEM_NAMES
SqlInsert = SqlInsert.Replace("@U.TUM_TOM_OWN_PNO", "'" & txtOwnerPerNo.Text.Trim & "'") SqlInsert = SqlInsert.Replace("@U.TUM_TOM_OWN_PNO", "'" & txtOwnerPerNo.Text.Trim & "'")
SqlInsert = SqlInsert.Replace("@U.TUM_USER_PNO", "'" & GetUserPersonalNumber(txtOwnerPerNo.Text.Trim) & "'") SqlInsert = SqlInsert.Replace("@U.TUM_USER_PNO", "'" & GetUserPersonalNumber(txtOwnerPerNo.Text.Trim) & "'")
dtApprover = _dbHelper.ExecuteDataTable(SqlInsert) dtApprover = _dbHelper.ExecuteDataTable(SqlInsert)
If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then If dtApprover IsNot Nothing AndAlso dtApprover.Rows.Count > 0 Then
cmbApprover.DataSource = dtApprover cmbApprover.DataSource = dtApprover
cmbApprover.DataTextField = "TAP_SUB_APP_DESC" cmbApprover.DataTextField = "TAP_SUB_APP_DESC"
cmbApprover.DataValueField = "TUM_TAP_SUB_APP_CD" cmbApprover.DataValueField = "TUM_TAP_SUB_APP_CD"
cmbApprover.DataBind() cmbApprover.DataBind()
End If End If
Catch ex As Exception Catch ex As Exception
Finally Finally
dtApprover.Dispose() dtApprover.Dispose()
End Try End Try
End Sub End Sub
'LoadModDetails 'LoadModDetails
Protected Sub LoadDetails() Protected Sub LoadDetails()
Dim dtDetails As New DataTable Dim dtDetails As New DataTable
Dim dtNonOPDetails As New DataTable Dim dtNonOPDetails As New DataTable
Try Try
Dim strUserId As String = Session("UserId").ToString Dim strUserId As String = Session("UserId").ToString
If strUserId.Length <= 5 Then If strUserId.Length <= 5 Then
Dim padchar As String = "0" Dim padchar As String = "0"
strUserId = strUserId.PadLeft(6, padchar) strUserId = strUserId.PadLeft(6, padchar)
End If End If
Dim sqlQuery = SqlQueries.AIMS002_LOAD_INFO Dim sqlQuery = SqlQueries.AIMS002_LOAD_INFO
sqlQuery = sqlQuery.Replace("@perno", "'" & strUserId & "'") sqlQuery = sqlQuery.Replace("@perno", "'" & strUserId & "'")
dtDetails = _dbHelper.ExecuteDataTable(sqlQuery) dtDetails = _dbHelper.ExecuteDataTable(sqlQuery)
If dtDetails IsNot Nothing AndAlso dtDetails.Rows.Count > 0 Then If dtDetails IsNot Nothing AndAlso dtDetails.Rows.Count > 0 Then
'~~~~~~Load Owner Details~~~~~~~~~~~~~~~ '~~~~~~Load Owner Details~~~~~~~~~~~~~~~
txtOwnerPerNo.Text = dtDetails.Rows(0)("perno").ToString.Trim txtOwnerPerNo.Text = dtDetails.Rows(0)("perno").ToString.Trim
txtOwnerName.Text = dtDetails.Rows(0)("ename").ToString.Trim txtOwnerName.Text = dtDetails.Rows(0)("ename").ToString.Trim
txtOwnerDept.Text = dtDetails.Rows(0)("dept").ToString.Trim txtOwnerDept.Text = dtDetails.Rows(0)("dept").ToString.Trim
txtOwnerLocation.Text = dtDetails.Rows(0)("btrtl").ToString.Trim txtOwnerLocation.Text = dtDetails.Rows(0)("btrtl").ToString.Trim
txtOwnerEmail.Text = dtDetails.Rows(0)("email").ToString.Trim.ToLower txtOwnerEmail.Text = dtDetails.Rows(0)("email").ToString.Trim.ToLower
hidCostCenter.Value = dtDetails.Rows(0)("CC").ToString.Trim hidCostCenter.Value = dtDetails.Rows(0)("CC").ToString.Trim
'~~~~~~~~~Load User Details if Owner is user~~~~~~~~~ '~~~~~~~~~Load User Details if Owner is user~~~~~~~~~
txtUserPersonalNo.Text = dtDetails.Rows(0)("perno").ToString.Trim txtUserPersonalNo.Text = dtDetails.Rows(0)("perno").ToString.Trim
txtUserName.Text = dtDetails.Rows(0)("ename").ToString.Trim txtUserName.Text = dtDetails.Rows(0)("ename").ToString.Trim
txtUserEmail.Text = dtDetails.Rows(0)("email").ToString.Trim.ToLower txtUserEmail.Text = dtDetails.Rows(0)("email").ToString.Trim.ToLower
'<Add Time> '<Add Time>
txtValidFrom.Text = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") txtValidFrom.Text = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss")
'</Add Time> '</Add Time>
'~~~~~Store this in session variable for further usage '~~~~~Store this in session variable for further usage
Session("UserDetailsReq") = txtUserPersonalNo.Text & "|" & txtUserName.Text & "|" & txtUserEmail.Text Session("UserDetailsReq") = txtUserPersonalNo.Text & "|" & txtUserName.Text & "|" & txtUserEmail.Text
Else Else
Dim sqlQueryNonOp = SqlQueries.AIMS005_GET_NONOP_DETAILS Dim sqlQueryNonOp = SqlQueries.AIMS005_GET_NONOP_DETAILS
sqlQueryNonOp = sqlQueryNonOp.Replace("@ema_perno", "'" & strUserId & "'") sqlQueryNonOp = sqlQueryNonOp.Replace("@ema_perno", "'" & strUserId & "'")
dtNonOPDetails = _dbHelper.ExecuteDataTable(sqlQueryNonOp) dtNonOPDetails = _dbHelper.ExecuteDataTable(sqlQueryNonOp)
If dtNonOPDetails IsNot Nothing AndAlso dtNonOPDetails.Rows.Count > 0 Then If dtNonOPDetails IsNot Nothing AndAlso dtNonOPDetails.Rows.Count > 0 Then
'~~~~~~Load Owner Details~~~~~~~~~~~~~~~ '~~~~~~Load Owner Details~~~~~~~~~~~~~~~
txtOwnerPerNo.Text = dtNonOPDetails.Rows(0)("ema_perno").ToString.Trim txtOwnerPerNo.Text = dtNonOPDetails.Rows(0)("ema_perno").ToString.Trim
txtOwnerName.Text = dtNonOPDetails.Rows(0)("ema_ename").ToString.Trim txtOwnerName.Text = dtNonOPDetails.Rows(0)("ema_ename").ToString.Trim
txtOwnerDept.Text = dtNonOPDetails.Rows(0)("EMA_DEPT_desc").ToString.Trim txtOwnerDept.Text = dtNonOPDetails.Rows(0)("EMA_DEPT_desc").ToString.Trim
txtOwnerLocation.Text = dtNonOPDetails.Rows(0)("EMA_PYRL_AREA_DESC").ToString.Trim txtOwnerLocation.Text = dtNonOPDetails.Rows(0)("EMA_PYRL_AREA_DESC").ToString.Trim
txtOwnerEmail.Text = dtNonOPDetails.Rows(0)("EMA_EMAIL_ID").ToString.Trim.ToLower txtOwnerEmail.Text = dtNonOPDetails.Rows(0)("EMA_EMAIL_ID").ToString.Trim.ToLower
hidCostCenter.Value = dtNonOPDetails.Rows(0)("EMA_COST_CENTERCD").ToString.Trim hidCostCenter.Value = dtNonOPDetails.Rows(0)("EMA_COST_CENTERCD").ToString.Trim
'~~~~~~~~~Load User Details if Owner is user~~~~~~~~~ '~~~~~~~~~Load User Details if Owner is user~~~~~~~~~
txtUserPersonalNo.Text = dtNonOPDetails.Rows(0)("ema_perno").ToString.Trim txtUserPersonalNo.Text = dtNonOPDetails.Rows(0)("ema_perno").ToString.Trim
txtUserName.Text = dtNonOPDetails.Rows(0)("ema_ename").ToString.Trim txtUserName.Text = dtNonOPDetails.Rows(0)("ema_ename").ToString.Trim
txtUserEmail.Text = dtNonOPDetails.Rows(0)("EMA_EMAIL_ID").ToString.Trim.ToLower txtUserEmail.Text = dtNonOPDetails.Rows(0)("EMA_EMAIL_ID").ToString.Trim.ToLower
'<Add Time> '<Add Time>
txtValidFrom.Text = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") txtValidFrom.Text = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss")
'</Add Time> '</Add Time>
'~~~~~Store this in session variable for further usage '~~~~~Store this in session variable for further usage
Session("UserDetailsReq") = txtUserPersonalNo.Text & "|" & txtUserName.Text & "|" & txtUserEmail.Text Session("UserDetailsReq") = txtUserPersonalNo.Text & "|" & txtUserName.Text & "|" & txtUserEmail.Text
End If End If
End If End If
Catch ex As Exception Catch ex As Exception
Finally Finally
dtDetails.Dispose() dtDetails.Dispose()
End Try End Try
End Sub End Sub
Protected Sub LoadModDetails() Protected Sub LoadModDetails()
Dim dtDetails As New DataTable Dim dtDetails As New DataTable
Dim dtNonOPDetails As New DataTable Dim dtNonOPDetails As New DataTable
Try Try
Dim strUserId As String = Session("UserId").ToString Dim strUserId As String = Session("UserId").ToString
If strUserId.Length <= 5 Then If strUserId.Length <= 5 Then
Dim padchar As String = "0" Dim padchar As String = "0"
strUserId = strUserId.PadLeft(6, padchar) strUserId = strUserId.PadLeft(6, padchar)
End If End If
Dim sqlQuery = SqlQueries.AIMS002_LOAD_INFO Dim sqlQuery = SqlQueries.AIMS002_LOAD_INFO
sqlQuery = sqlQuery.Replace("@perno", "'" & strUserId & "'") sqlQuery = sqlQuery.Replace("@perno", "'" & strUserId & "'")
dtDetails = _dbHelper.ExecuteDataTable(sqlQuery) dtDetails = _dbHelper.ExecuteDataTable(sqlQuery)
If dtDetails IsNot Nothing AndAlso dtDetails.Rows.Count > 0 Then If dtDetails IsNot Nothing AndAlso dtDetails.Rows.Count > 0 Then
'~~~~~~Load Owner Details~~~~~~~~~~~~~~~ '~~~~~~Load Owner Details~~~~~~~~~~~~~~~
txtModPersonalNumber.Text = dtDetails.Rows(0)("perno").ToString.Trim txtModPersonalNumber.Text = dtDetails.Rows(0)("perno").ToString.Trim
txtModOwnerName.Text = dtDetails.Rows(0)("ename").ToString.Trim txtModOwnerName.Text = dtDetails.Rows(0)("ename").ToString.Trim
txtModOwnerDepartment.Text = dtDetails.Rows(0)("dept").ToString.Trim txtModOwnerDepartment.Text = dtDetails.Rows(0)("dept").ToString.Trim
txtModLocation.Text = dtDetails.Rows(0)("btrtl").ToString.Trim txtModLocation.Text = dtDetails.Rows(0)("btrtl").ToString.Trim
txtModOwnerEmail.Text = dtDetails.Rows(0)("email").ToString.Trim.ToLower txtModOwnerEmail.Text = dtDetails.Rows(0)("email").ToString.Trim.ToLower
hidModCostCenter.Value = dtDetails.Rows(0)("CC").ToString.Trim hidModCostCenter.Value = dtDetails.Rows(0)("CC").ToString.Trim
'~~~~~~~~~Load User Details if Owner is user~~~~~~~~~ '~~~~~~~~~Load User Details if Owner is user~~~~~~~~~
txtModUserPersonalNumber.Text = dtDetails.Rows(0)("perno").ToString.Trim txtModUserPersonalNumber.Text = dtDetails.Rows(0)("perno").ToString.Trim
txtModUserName.Text = dtDetails.Rows(0)("ename").ToString.Trim txtModUserName.Text = dtDetails.Rows(0)("ename").ToString.Trim
txtModUserEmail.Text = dtDetails.Rows(0)("email").ToString.Trim.ToLower txtModUserEmail.Text = dtDetails.Rows(0)("email").ToString.Trim.ToLower
'<Add Time> '<Add Time>
txtModValidFrom.Text = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") txtModValidFrom.Text = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss")
'<Add Time> '<Add Time>
'~~~~~Store this in session variable for further usage '~~~~~Store this in session variable for further usage
Session("UserDetails") = txtModUserPersonalNumber.Text & "|" & txtModUserName.Text & "|" & txtModUserEmail.Text Session("UserDetails") = txtModUserPersonalNumber.Text & "|" & txtModUserName.Text & "|" & txtModUserEmail.Text
Else Else
Dim sqlQueryNonOp = SqlQueries.AIMS005_GET_NONOP_DETAILS Dim sqlQueryNonOp = SqlQueries.AIMS005_GET_NONOP_DETAILS
sqlQueryNonOp = sqlQueryNonOp.Replace("@ema_perno", "'" & strUserId & "'") sqlQueryNonOp = sqlQueryNonOp.Replace("@ema_perno", "'" & strUserId & "'")
dtNonOPDetails = _dbHelper.ExecuteDataTable(sqlQueryNonOp) dtNonOPDetails = _dbHelper.ExecuteDataTable(sqlQueryNonOp)
If dtNonOPDetails IsNot Nothing AndAlso dtNonOPDetails.Rows.Count > 0 Then If dtNonOPDetails IsNot Nothing AndAlso dtNonOPDetails.Rows.Count > 0 Then
'~~~~~~Load Owner Details~~~~~~~~~~~~~~~ '~~~~~~Load Owner Details~~~~~~~~~~~~~~~
txtModPersonalNumber.Text = dtNonOPDetails.Rows(0)("ema_perno").ToString.Trim txtModPersonalNumber.Text = dtNonOPDetails.Rows(0)("ema_perno").ToString.Trim
txtModOwnerName.Text = dtNonOPDetails.Rows(0)("ema_ename").ToString.Trim txtModOwnerName.Text = dtNonOPDetails.Rows(0)("ema_ename").ToString.Trim
txtModOwnerDepartment.Text = dtNonOPDetails.Rows(0)("EMA_DEPT_desc").ToString.Trim txtModOwnerDepartment.Text = dtNonOPDetails.Rows(0)("EMA_DEPT_desc").ToString.Trim
txtModLocation.Text = dtNonOPDetails.Rows(0)("EMA_PYRL_AREA_DESC").ToString.Trim txtModLocation.Text = dtNonOPDetails.Rows(0)("EMA_PYRL_AREA_DESC").ToString.Trim
txtModOwnerEmail.Text = dtNonOPDetails.Rows(0)("EMA_EMAIL_ID").ToString.Trim.ToLower txtModOwnerEmail.Text = dtNonOPDetails.Rows(0)("EMA_EMAIL_ID").ToString.Trim.ToLower
hidModCostCenter.Value = dtNonOPDetails.Rows(0)("EMA_COST_CENTERCD").ToString.Trim hidModCostCenter.Value = dtNonOPDetails.Rows(0)("EMA_COST_CENTERCD").ToString.Trim
'~~~~~~~~~Load User Details if Owner is user~~~~~~~~~ '~~~~~~~~~Load User Details if Owner is user~~~~~~~~~
txtModUserPersonalNumber.Text = dtNonOPDetails.Rows(0)("ema_perno").ToString.Trim txtModUserPersonalNumber.Text = dtNonOPDetails.Rows(0)("ema_perno").ToString.Trim
txtModUserName.Text = dtNonOPDetails.Rows(0)("ema_ename").ToString.Trim txtModUserName.Text = dtNonOPDetails.Rows(0)("ema_ename").ToString.Trim
txtModUserEmail.Text = dtNonOPDetails.Rows(0)("EMA_EMAIL_ID").ToString.Trim.ToLower txtModUserEmail.Text = dtNonOPDetails.Rows(0)("EMA_EMAIL_ID").ToString.Trim.ToLower
'<Add Time> '<Add Time>
txtModValidFrom.Text = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") txtModValidFrom.Text = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss")
'<Add Time> '<Add Time>
'~~~~~Store this in session variable for further usage '~~~~~Store this in session variable for further usage
Session("UserDetailsReq") = txtModUserPersonalNumber.Text & "|" & txtModUserName.Text & "|" & txtModUserEmail.Text Session("UserDetailsReq") = txtModUserPersonalNumber.Text & "|" & txtModUserName.Text & "|" & txtModUserEmail.Text
End If End If
End If End If
Catch ex As Exception Catch ex As Exception
Finally Finally
dtDetails.Dispose() dtDetails.Dispose()
End Try End Try
End Sub End Sub
Protected Sub PopulateAuthiorisedSystemName() Protected Sub PopulateAuthiorisedSystemName()
Dim dtSystemName As New DataTable Dim dtSystemName As New DataTable
Dim objCommon As New Common Dim objCommon As New Common
Try Try
Dim sys_qry As String = SqlQueries.LOAD_SYSTEM Dim sys_qry As String = SqlQueries.LOAD_SYSTEM
sys_qry = sys_qry.Replace("@TUM_TOM_OWN_PNO", objCommon.GetPaddedPersonalNumbers(Session("UserId").ToString)) sys_qry = sys_qry.Replace("@TUM_TOM_OWN_PNO", objCommon.GetPaddedPersonalNumbers(Session("UserId").ToString))
dtSystemName = _dbHelper.ExecuteDataTable(sys_qry) dtSystemName = _dbHelper.ExecuteDataTable(sys_qry)
If dtSystemName.Rows.Count > 0 Then If dtSystemName.Rows.Count > 0 Then
gridSystemNames.DataSource = dtSystemName gridSystemNames.DataSource = dtSystemName
gridSystemNames.DataBind() gridSystemNames.DataBind()
gridSystemNames.HeaderRow.CssClass = "GridHeaderFreezing" gridSystemNames.HeaderRow.CssClass = "GridHeaderFreezing"
SetPanelMessage("List Of Systems under " & Session("UserName").ToString & " ownership " & " (Total:" & dtSystemName.Rows.Count.ToString() & ")") SetPanelMessage("List Of Systems under " & Session("UserName").ToString & " ownership " & " (Total:" & dtSystemName.Rows.Count.ToString() & ")")
Else Else
SetPanelMessage("There are no systems under " & Session("UserName").ToString & " ownership ") SetPanelMessage("There are no systems under " & Session("UserName").ToString & " ownership ")
End If End If
Catch ex As Exception Catch ex As Exception
SetPanelMessage("There are no systems under " & Session("UserName").ToString & " ownership ") SetPanelMessage("There are no systems under " & Session("UserName").ToString & " ownership ")
Finally Finally
dtSystemName.Dispose() dtSystemName.Dispose()
End Try End Try
End Sub End Sub
Protected Sub SetPanelMessage(ByVal value As String) Protected Sub SetPanelMessage(ByVal value As String)
lblPnlMessage.Text = value lblPnlMessage.Text = value
End Sub End Sub
Protected Sub SetOwnerPaneReadOnly() Protected Sub SetOwnerPaneReadOnly()
txtOwnerPerNo.Enabled = False txtOwnerPerNo.Enabled = False
txtOwnerName.Enabled = False txtOwnerName.Enabled = False
txtOwnerDept.Enabled = False txtOwnerDept.Enabled = False
txtOwnerLocation.Enabled = False txtOwnerLocation.Enabled = False
txtOwnerEmail.Enabled = False txtOwnerEmail.Enabled = False
End Sub End Sub
Protected Sub SetModOwnerPaneReadOnly() Protected Sub SetModOwnerPaneReadOnly()
txtModPersonalNumber.Enabled = False txtModPersonalNumber.Enabled = False
txtModOwnerName.Enabled = False txtModOwnerName.Enabled = False
txtModOwnerDepartment.Enabled = False txtModOwnerDepartment.Enabled = False
txtModLocation.Enabled = False txtModLocation.Enabled = False
txtModOwnerEmail.Enabled = False txtModOwnerEmail.Enabled = False
End Sub End Sub
Protected Sub SetUserPaneReadOnly() Protected Sub SetUserPaneReadOnly()
txtUserPersonalNo.Enabled = False txtUserPersonalNo.Enabled = False
txtUserName.Enabled = False txtUserName.Enabled = False
txtUserEmail.Enabled = False txtUserEmail.Enabled = False
End Sub End Sub
Protected Sub SetUserPaneEnabled() Protected Sub SetUserPaneEnabled()
txtUserPersonalNo.Enabled = True txtUserPersonalNo.Enabled = True
txtUserName.Enabled = True txtUserName.Enabled = True
txtUserEmail.Enabled = True txtUserEmail.Enabled = True
txtUserPersonalNo.Text = String.Empty txtUserPersonalNo.Text = String.Empty
txtUserName.Text = String.Empty txtUserName.Text = String.Empty
txtUserEmail.Text = String.Empty txtUserEmail.Text = String.Empty
End Sub End Sub
Protected Sub SetModUserPaneReadOnly() Protected Sub SetModUserPaneReadOnly()
txtModUserPersonalNumber.Enabled = False txtModUserPersonalNumber.Enabled = False
txtModUserName.Enabled = False txtModUserName.Enabled = False
txtModUserEmail.Enabled = False txtModUserEmail.Enabled = False
End Sub End Sub
Protected Sub SetModUserPaneEnabled() Protected Sub SetModUserPaneEnabled()
txtModUserPersonalNumber.Enabled = True txtModUserPersonalNumber.Enabled = True
txtModUserName.Enabled = True txtModUserName.Enabled = True
txtModUserEmail.Enabled = True txtModUserEmail.Enabled = True
txtModUserPersonalNumber.Text = String.Empty txtModUserPersonalNumber.Text = String.Empty
txtModUserName.Text = String.Empty txtModUserName.Text = String.Empty
txtModUserEmail.Text = String.Empty txtModUserEmail.Text = String.Empty
End Sub End Sub
Protected Sub ResetRequestDetails() Protected Sub ResetRequestDetails()
txtOwnerPerNo.Text = String.Empty txtOwnerPerNo.Text = String.Empty
txtOwnerName.Text = String.Empty txtOwnerName.Text = String.Empty
txtOwnerLocation.Text = String.Empty txtOwnerLocation.Text = String.Empty
txtOwnerDept.Text = String.Empty txtOwnerDept.Text = String.Empty
txtOwnerEmail.Text = String.Empty txtOwnerEmail.Text = String.Empty
txtUserPersonalNo.Text = String.Empty txtUserPersonalNo.Text = String.Empty
txtUserAssetNo.Text = String.Empty txtUserAssetNo.Text = String.Empty
txtUserContact.Text = String.Empty txtUserContact.Text = String.Empty
'txtUserDatabaseName.Text = String.Empty 'txtUserDatabaseName.Text = String.Empty
txtUserEmail.Text = String.Empty txtUserEmail.Text = String.Empty
txtUserName.Text = String.Empty txtUserName.Text = String.Empty
txtUserRemarks.Text = String.Empty txtUserRemarks.Text = String.Empty
'txtUserTableName.Text = String.Empty 'txtUserTableName.Text = String.Empty
txtSuggestedId.Text = String.Empty txtSuggestedId.Text = String.Empty
txtValidFrom.Text = String.Empty txtValidFrom.Text = String.Empty
txtValidTo.Text = String.Empty txtValidTo.Text = String.Empty
cmbApprover.Items.Clear() cmbApprover.Items.Clear()
cmbUserType.Items.Clear() cmbUserType.Items.Clear()
SqlDataSource1.SelectCommand = "" SqlDataSource1.SelectCommand = ""
'mc_sys.ClearAll() 'mc_sys.ClearAll()
End Sub End Sub
Protected Sub ResetModRequestDetails() Protected Sub ResetModRequestDetails()
txtModPersonalNumber.Text = String.Empty txtModPersonalNumber.Text = String.Empty
txtModOwnerName.Text = String.Empty txtModOwnerName.Text = String.Empty
txtModLocation.Text = String.Empty txtModLocation.Text = String.Empty
txtModOwnerDepartment.Text = String.Empty txtModOwnerDepartment.Text = String.Empty
txtModOwnerEmail.Text = String.Empty txtModOwnerEmail.Text = String.Empty
txtModUserPersonalNumber.Text = String.Empty txtModUserPersonalNumber.Text = String.Empty
txtModAssetNumber.Text = String.Empty txtModAssetNumber.Text = String.Empty
txtModUserContact.Text = String.Empty txtModUserContact.Text = String.Empty
txtModDatabase.Text = String.Empty txtModDatabase.Text = String.Empty
txtModUserEmail.Text = String.Empty txtModUserEmail.Text = String.Empty
txtModUserName.Text = String.Empty txtModUserName.Text = String.Empty
txtModRemarks.Text = String.Empty txtModRemarks.Text = String.Empty
txtModTable.Text = String.Empty txtModTable.Text = String.Empty
txtModSuggestedId.Text = String.Empty txtModSuggestedId.Text = String.Empty
txtModValidFrom.Text = String.Empty txtModValidFrom.Text = String.Empty
txtModValidTo.Text = String.Empty txtModValidTo.Text = String.Empty
cmbModApprover.Items.Clear() cmbModApprover.Items.Clear()
cmbModUserType.Items.Clear() cmbModUserType.Items.Clear()
cmbModSystemNames.Items.Clear() cmbModSystemNames.Items.Clear()
End Sub End Sub
Protected Sub chkSelectEmpType_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkSelectEmpType.SelectedIndexChanged Protected Sub chkSelectEmpType_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkSelectEmpType.SelectedIndexChanged
If chkSelectEmpType.Text = "TATA STEEL Employee" Then If chkSelectEmpType.Text = "TATA STEEL Employee" Then
btnReqSendForApp.Enabled = True btnReqSendForApp.Enabled = True
cmbUserType.SelectedIndex = 0 cmbUserType.SelectedIndex = 0
lbl_usr_id_varification.Visible = False lbl_usr_id_varification.Visible = False
ElseIf chkSelectEmpType.Text = "ID under my ownership" Then ElseIf chkSelectEmpType.Text = "ID under my ownership" Then
btnReqSendForApp.Enabled = False btnReqSendForApp.Enabled = False
cmbUserType.SelectedIndex = 0 cmbUserType.SelectedIndex = 0
lbl_usr_id_varification.Visible = True lbl_usr_id_varification.Visible = True
End If End If
lblErrorMessage.Visible = False lblErrorMessage.Visible = False
tdError.Visible = False tdError.Visible = False
EnableDisableUserData() EnableDisableUserData()
DropCheck_system.Text = "" DropCheck_system.Text = ""
txtUserContact.Text = "" txtUserContact.Text = ""
End Sub End Sub
Protected Sub EnableDisableUserData() Protected Sub EnableDisableUserData()
If chkSelectEmpType.Text = "TATA STEEL Employee" Then If chkSelectEmpType.Text = "TATA STEEL Employee" Then
SetUserPaneReadOnly() SetUserPaneReadOnly()
'~~~~Split the values '~~~~Split the values
If Session("UserDetailsReq") IsNot Nothing Then If Session("UserDetailsReq") IsNot Nothing Then
Dim array() As String = Session("UserDetailsReq").ToString.Split("|") Dim array() As String = Session("UserDetailsReq").ToString.Split("|")
txtUserPersonalNo.Text = array(0).ToString txtUserPersonalNo.Text = array(0).ToString
txtUserName.Text = array(1).ToString txtUserName.Text = array(1).ToString
txtUserEmail.Text = array(2).ToString txtUserEmail.Text = array(2).ToString
End If End If
cmbUserType.SelectedIndex = 0 cmbUserType.SelectedIndex = 0
'cmbUserType.SelectedIndex = 1 'cmbUserType.SelectedIndex = 1
txtValidTo.Text = String.Empty txtValidTo.Text = String.Empty
Session("UserDetailsReqNew") = Nothing Session("UserDetailsReqNew") = Nothing
PopSysNames("") PopSysNames("")
ElseIf chkSelectEmpType.Text = "ID under my ownership" Then ElseIf chkSelectEmpType.Text = "ID under my ownership" Then
lbl_usr_id_varification.Visible = True lbl_usr_id_varification.Visible = True
SetUserPaneEnabled() SetUserPaneEnabled()
cmbUserType.SelectedIndex = 0 cmbUserType.SelectedIndex = 0
'cmbUserType.SelectedIndex = 2 'cmbUserType.SelectedIndex = 2
If Session("UserDetailsReqNew") IsNot Nothing Then If Session("UserDetailsReqNew") IsNot Nothing Then
Dim array() As String = Session("UserDetailsReqNew").ToString.Split("|") Dim array() As String = Session("UserDetailsReqNew").ToString.Split("|")
txtUserPersonalNo.Text = array(0).ToString txtUserPersonalNo.Text = array(0).ToString
txtUserName.Text = array(1).ToString txtUserName.Text = array(1).ToString
txtUserEmail.Text = array(2).ToString txtUserEmail.Text = array(2).ToString
PopSysNames(txtUserPersonalNo.Text) PopSysNames(txtUserPersonalNo.Text)
Else Else
PopSysNames("TSL") PopSysNames("TSL")
End If End If
'Dim dr As Date 'Dim dr As Date
'If txtValidFrom.Text <> String.Empty Then 'If txtValidFrom.Text <> String.Empty Then
' dr = txtValidFrom.Text ' dr = txtValidFrom.Text
' txtValidTo.Text = dr.AddMonths(12).ToString("MM/dd/yyyy HH:mm:ss") ' txtValidTo.Text = dr.AddMonths(12).ToString("MM/dd/yyyy HH:mm:ss")
'End If 'End If
End If End If
End Sub End Sub
Protected Sub btnReqSendForApp_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReqSendForApp.Click Protected Sub btnReqSendForApp_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReqSendForApp.Click
If Not IsValidationSuccessful() Then If Not IsValidationSuccessful() Then
'Dim strarray() As String 'Dim strarray() As String
Dim strSelectedValue As String = String.Empty Dim strSelectedValue As String = String.Empty
Dim dtSelectedValue As New DataTable Dim dtSelectedValue As New DataTable
If DropCheck_system.Text <> "select" Then If DropCheck_system.Text <> "select" Then
dtSelectedValue = objMultipleSelection.MultipleSelectValue(DropCheck_system.Text.ToString) dtSelectedValue = objMultipleSelection.MultipleSelectValue(DropCheck_system.Text.ToString)
'strarray = DropCheck_system.Text.ToUpper.Split(",") 'strarray = DropCheck_system.Text.ToUpper.Split(",")
If dtSelectedValue.Rows.Count > 0 Then If dtSelectedValue.Rows.Count > 0 Then
For i = 0 To dtSelectedValue.Rows.Count - 1 For i = 0 To dtSelectedValue.Rows.Count - 1
strSelectedValue += "'" + dtSelectedValue.Rows(i).Item(0).ToString.ToUpper + "'," strSelectedValue += "'" + dtSelectedValue.Rows(i).Item(0).ToString.ToUpper + "',"
Next Next
strSelectedValue = strSelectedValue.Remove(strSelectedValue.Length - 1) strSelectedValue = strSelectedValue.Remove(strSelectedValue.Length - 1)
End If End If
End If End If
Dim sql_app_cost As String Dim sql_app_cost As String
sql_app_cost = SqlQueries.AIMS008_APP_COST sql_app_cost = SqlQueries.AIMS008_APP_COST
sql_app_cost = sql_app_cost.Replace("@app_list", strSelectedValue) sql_app_cost = sql_app_cost.Replace("@app_list", strSelectedValue)
'sql_app_cost = sql_app_cost.Replace("@tap_sub_app_cd", application_code_it) 'sql_app_cost = sql_app_cost.Replace("@tap_sub_app_cd", application_code_it)
Dim dt As New DataTable Dim dt As New DataTable
dt = _dbHelper.ExecuteDataTable(sql_app_cost) dt = _dbHelper.ExecuteDataTable(sql_app_cost)
Dim checked As Boolean = False Dim checked As Boolean = False
If dt.Rows.Count > 0 Then If dt.Rows.Count > 0 Then
'If checked Then 'If checked Then
gridCost.DataSource = dt gridCost.DataSource = dt
gridCost.DataBind() gridCost.DataBind()
lbl_error.Visible = False btn_cnf_ok.Visible = True
btn_cnf_ok.Visible = True
btn_ok_final.Visible = False btn_ok_final.Visible = False
lbl_error.Visible = False
mdlpop_cnf.Show() mdlpop_cnf.Show()
'Else 'Else
' SaveRequestDetails() ' SaveRequestDetails()
'End If 'End If
Else Else
SaveRequestDetails() SaveRequestDetails()
End If End If
ViewState("selected_new_apps") = dtSelectedValue ViewState("selected_new_apps") = dtSelectedValue
'If unselected_apps.Contains(",") Then 'If unselected_apps.Contains(",") Then
' 'remove system in unselected apps from system selected ' 'remove system in unselected apps from system selected
'End If 'End If
'If selected_apps.Contains(",") Then 'If selected_apps.Contains(",") Then
' selected_apps = " " ' selected_apps = " "
' unselected_apps = " " ' unselected_apps = " "
' SaveRequestDetails() ' SaveRequestDetails()
'End If 'End If
End If End If
End Sub End Sub
'handles check all and uncheck all of gridview checkbox 'handles check all and uncheck all of gridview checkbox
Protected Sub checkAll() Protected Sub checkAll()
Dim check As Boolean = CType(gridCost.HeaderRow.FindControl("chkAll"), CheckBox).Checked Dim check As Boolean = CType(gridCost.HeaderRow.FindControl("chkAll"), CheckBox).Checked
If check Then If check Then
For Each drow As GridViewRow In gridCost.Rows For Each drow As GridViewRow In gridCost.Rows
CType(drow.FindControl("chkSelectSMG"), CheckBox).Checked = True CType(drow.FindControl("chkSelectSMG"), CheckBox).Checked = True
Next Next
Else Else
For Each drow As GridViewRow In gridCost.Rows For Each drow As GridViewRow In gridCost.Rows
CType(drow.FindControl("chkSelectSMG"), CheckBox).Checked = False CType(drow.FindControl("chkSelectSMG"), CheckBox).Checked = False
Next Next
End If End If
End Sub End Sub
Protected Function GenerateReferenceNumber() As String Protected Function GenerateReferenceNumber() As String
Dim dtCounter As New DataTable Dim dtCounter As New DataTable
Dim strPadValue As String = String.Empty Dim strPadValue As String = String.Empty
dtCounter = _dbHelper.ExecuteDataTable(SqlQueries.COUNT_REFNO) dtCounter = _dbHelper.ExecuteDataTable(SqlQueries.COUNT_REFNO)
If dtCounter IsNot Nothing AndAlso dtCounter.Rows.Count > 0 Then If dtCounter IsNot Nothing AndAlso dtCounter.Rows.Count > 0 Then
Dim x As String = dtCounter.Rows(0)("TAI_REF_NO").ToString Dim x As String = dtCounter.Rows(0)("TAI_REF_NO").ToString
'Dim y As Integer = Convert.ToInt16(x.Substring(3, 4)) 'Dim y As Integer = Convert.ToInt16(x.Substring(3, 4))
x = x + 1 x = x + 1
Dim padChar As Char Dim padChar As Char
strPadValue = x.ToString strPadValue = x.ToString
padChar = "0"c padChar = "0"c
strPadValue = strPadValue.PadLeft(4, padChar) strPadValue = strPadValue.PadLeft(4, padChar)
strPadValue = "REF" & strPadValue strPadValue = "REF" & strPadValue
Else Else
strPadValue = "REF0001" strPadValue = "REF0001"
End If End If
Return strPadValue Return strPadValue
End Function End Function
Protected Function IsValidationSuccessful() As Boolean Protected Function IsValidationSuccessful() As Boolean
Dim returnValue As Boolean = False Dim returnValue As Boolean = False
Dim dtSelectedValue As New DataTable Dim dtSelectedValue As New DataTable
Dim dtcheck_system As New DataTable Dim dtcheck_system As New DataTable
'Dim dt_status As New DataTable 'Dim dt_status As New DataTable
dtSelectedValue = objMultipleSelection.MultipleSelectValue(DropCheck_system.Text.ToString) dtSelectedValue = objMultipleSelection.MultipleSelectValue(DropCheck_system.Text.ToString)
'This will validate if lotus/AD then asset number should not be blank 'This will validate if lotus/AD then asset number should not be blank
'and also if SAP then attachment should be there 'and also if SAP then attachment should be there
Dim IsLotusOrAD As Boolean = False Dim IsLotusOrAD As Boolean = False
For Each drow As DataRow In dtSelectedValue.Rows For Each drow As DataRow In dtSelectedValue.Rows
If ((drow("val").ToString.ToUpper = Messages.AIMS_AD_CODE) OrElse (drow("val").ToString.ToUpper = Messages.AIMS_LOTUS_NOTES_CODE) OrElse (drow("val").ToString.ToUpper = Messages.AIMS_Lync_Enterprise) OrElse (drow("val").ToString.ToUpper = Messages.AIMS_Lync_Standard)) Then If ((drow("val").ToString.ToUpper = Messages.AIMS_AD_CODE) OrElse (drow("val").ToString.ToUpper = Messages.AIMS_LOTUS_NOTES_CODE) OrElse (drow("val").ToString.ToUpper = Messages.AIMS_Lync_Enterprise) OrElse (drow("val").ToString.ToUpper = Messages.AIMS_Lync_Standard)) Then
IsLotusOrAD = True IsLotusOrAD = True
End If End If
Next Next
If txtUserContact.Text.Trim = String.Empty Then If txtUserContact.Text.Trim = String.Empty Then
returnValue = True returnValue = True
tdError.Visible = True tdError.Visible = True
lblErrorMessage.Visible = True lblErrorMessage.Visible = True
lblErrorMessage.Text = "Contact Number cannot be left blank " lblErrorMessage.Text = "Contact Number cannot be left blank "
ElseIf Not txtUserContact.Text.Trim = String.Empty AndAlso v1.Numeric_Check(txtUserContact.Text) Then ElseIf Not txtUserContact.Text.Trim = String.Empty AndAlso v1.Numeric_Check(txtUserContact.Text) Then
returnValue = True returnValue = True
tdError.Visible = True tdError.Visible = True
lblErrorMessage.Visible = True lblErrorMessage.Visible = True
lblErrorMessage.Text = "Contact has to be numeric eg:-06576647070 " lblErrorMessage.Text = "Contact has to be numeric eg:-06576647070 "
ElseIf dtSelectedValue.Rows.Count = 0 Then ElseIf dtSelectedValue.Rows.Count = 0 Then
returnValue = True returnValue = True
tdError.Visible = True tdError.Visible = True
lblErrorMessage.Visible = True lblErrorMessage.Visible = True
lblErrorMessage.Text = "Please select atleast one system name " lblErrorMessage.Text = "Please select atleast one system name "
ElseIf ((IsLotusOrAD = True) AndAlso (txtUserAssetNo.Text.ToString = String.Empty)) Then ElseIf ((IsLotusOrAD = True) AndAlso (txtUserAssetNo.Text.ToString = String.Empty)) Then
returnValue = True returnValue = True
tdError.Visible = True tdError.Visible = True
lblErrorMessage.Visible = True lblErrorMessage.Visible = True
lblErrorMessage.Text = "Please enter asset no as AD/LotusNotes/Lync Enterprise/Lync Standard has been selected in System" lblErrorMessage.Text = "Please enter asset no as AD/LotusNotes/Lync Enterprise/Lync Standard has been selected in System"
ElseIf dtSelectedValue.Rows.Count > 4 Then ElseIf dtSelectedValue.Rows.Count > 4 Then
returnValue = True returnValue = True
tdError.Visible = True tdError.Visible = True
lblErrorMessage.Visible = True lblErrorMessage.Visible = True
lblErrorMessage.Text = "Please select maximum 4 system names for one request " lblErrorMessage.Text = "Please select maximum 4 system names for one request "
ElseIf cmbUserType.Text = "select" Then ElseIf cmbUserType.Text = "select" Then
returnValue = True returnValue = True
tdError.Visible = True tdError.Visible = True
lblErrorMessage.Visible = True lblErrorMessage.Visible = True
lblErrorMessage.Text = "Please select user type " lblErrorMessage.Text = "Please select user type "
ElseIf cmbUserType.SelectedIndex = 2 AndAlso (txtValidFrom.Text.Trim = String.Empty Or txtValidTo.Text.Trim = String.Empty) Then ElseIf cmbUserType.SelectedIndex = 2 AndAlso (txtValidFrom.Text.Trim = String.Empty Or txtValidTo.Text.Trim = String.Empty) Then
returnValue = True returnValue = True
tdError.Visible = True tdError.Visible = True
lblErrorMessage.Visible = True lblErrorMessage.Visible = True
lblErrorMessage.Text = "From Date / To Date should not be left blank" lblErrorMessage.Text = "From Date / To Date should not be left blank"
ElseIf cmbUserType.SelectedIndex = 2 AndAlso Convert.ToDateTime(txtValidFrom.Text).CompareTo(Convert.ToDateTime(txtValidTo.Text)) > 0 Then ElseIf cmbUserType.SelectedIndex = 2 AndAlso Convert.ToDateTime(txtValidFrom.Text).CompareTo(Convert.ToDateTime(txtValidTo.Text)) > 0 Then
returnValue = True returnValue = True
tdError.Visible = True tdError.Visible = True
lblErrorMessage.Visible = True lblErrorMessage.Visible = True
lblErrorMessage.Text = "From Date should be less than To Date." lblErrorMessage.Text = "From Date should be less than To Date."
ElseIf (cmbApprover.Text = "select") AndAlso (cmbApprover.Visible = True) Then ElseIf (cmbApprover.Text = "select") AndAlso (cmbApprover.Visible = True) Then
returnValue = True returnValue = True
tdError.Visible = True tdError.Visible = True
lblErrorMessage.Visible = True lblErrorMessage.Visible = True
lblErrorMessage.Text = "Please select Approver name " lblErrorMessage.Text = "Please select Approver name "
ElseIf (txtChooseApprover.Text.Trim = String.Empty) AndAlso (txtChooseApprover.Visible = True) Then ElseIf (txtChooseApprover.Text.Trim = String.Empty) AndAlso (txtChooseApprover.Visible = True) Then
returnValue = True returnValue = True
tdError.Visible = True tdError.Visible = True
lblErrorMessage.Visible = True lblErrorMessage.Visible = True
lblErrorMessage.Text = "Please select Approver name " lblErrorMessage.Text = "Please select Approver name "
ElseIf Not txtChooseApprover.Text.Trim.Contains(":") AndAlso (txtChooseApprover.Visible = True) Then ElseIf Not txtChooseApprover.Text.Trim.Contains(":") AndAlso (txtChooseApprover.Visible = True) Then
returnValue = True returnValue = True
tdError.Visible = True tdError.Visible = True
lblErrorMessage.Visible = True lblErrorMessage.Visible = True
lblErrorMessage.Text = "Please verify the approver" lblErrorMessage.Text = "Please verify the approver"
ElseIf txtUserRemarks.Text.Trim = String.Empty Then ElseIf txtUserRemarks.Text.Trim = String.Empty Then
returnValue = True returnValue = True
tdError.Visible = True tdError.Visible = True
lblErrorMessage.Visible = True lblErrorMessage.Visible = True
lblErrorMessage.Text = "Remarks field cannot be left blank." lblErrorMessage.Text = "Remarks field cannot be left blank."
Else Else
tdError.Visible = False tdError.Visible = False
lblErrorMessage.Visible = False lblErrorMessage.Visible = False
lblErrorMessage.Text = String.Empty lblErrorMessage.Text = String.Empty
End If End If
Return returnValue Return returnValue
End Function End Function
Protected Function IsModValidationSuccessful() As Boolean Protected Function IsModValidationSuccessful() As Boolean
Dim returnValue As Boolean = False Dim returnValue As Boolean = False
Dim dtSelectedValue As New DataTable Dim dtSelectedValue As New DataTable
Dim strarray() As String Dim strarray() As String
Dim strSelectedValue As String = String.Empty Dim strSelectedValue As String = String.Empty
If cmbModSystemNames.Text <> "select" Then If cmbModSystemNames.Text <> "select" Then
strarray = cmbModSystemNames.Text.ToUpper.Split("!") strarray = cmbModSystemNames.Text.ToUpper.Split("!")
If strarray.Length > 1 Then If strarray.Length > 1 Then
strSelectedValue = strarray(0).ToString.ToUpper strSelectedValue = strarray(0).ToString.ToUpper
End If End If
End If End If
If txtModUserContact.Text.Trim = String.Empty Then If txtModUserContact.Text.Trim = String.Empty Then
returnValue = True returnValue = True
tdModError.Visible = True tdModError.Visible = True
lblModErrorMessage.Visible = True lblModErrorMessage.Visible = True
lblModErrorMessage.Text = "Contact Number cannot be left blank " lblModErrorMessage.Text = "Contact Number cannot be left blank "
ElseIf Not txtModUserContact.Text.Trim = String.Empty AndAlso v1.Numeric_Check(txtModUserContact.Text) Then ElseIf Not txtModUserContact.Text.Trim = String.Empty AndAlso v1.Numeric_Check(txtModUserContact.Text) Then
returnValue = True returnValue = True
tdModError.Visible = True tdModError.Visible = True
lblModErrorMessage.Visible = True lblModErrorMessage.Visible = True
lblModErrorMessage.Text = "Contact has to be numeric eg:-06576647070 " lblModErrorMessage.Text = "Contact has to be numeric eg:-06576647070 "
ElseIf cmbModSystemNames.Text = "select" Then ElseIf cmbModSystemNames.Text = "select" Then
returnValue = True returnValue = True
tdModError.Visible = True tdModError.Visible = True
lblModErrorMessage.Visible = True lblModErrorMessage.Visible = True
lblModErrorMessage.Text = "Please select atleast one system name " lblModErrorMessage.Text = "Please select atleast one system name "
ElseIf ((strSelectedValue = Messages.AIMS_AD_CODE) AndAlso (txtModAssetNumber.Text.Trim = String.Empty)) OrElse ((strSelectedValue = Messages.AIMS_LOTUS_NOTES_CODE) AndAlso (txtModAssetNumber.Text.Trim = String.Empty)) Then ElseIf ((strSelectedValue = Messages.AIMS_AD_CODE) AndAlso (txtModAssetNumber.Text.Trim = String.Empty)) OrElse ((strSelectedValue = Messages.AIMS_LOTUS_NOTES_CODE) AndAlso (txtModAssetNumber.Text.Trim = String.Empty)) Then
returnValue = True returnValue = True
tdModError.Visible = True tdModError.Visible = True
lblModErrorMessage.Visible = True lblModErrorMessage.Visible = True
lblModErrorMessage.Text = "Please enter asset no as AD/LotusNotes has been selected in System" lblModErrorMessage.Text = "Please enter asset no as AD/LotusNotes has been selected in System"
ElseIf cmbModUserType.Text = "select" Then ElseIf cmbModUserType.Text = "select" Then
returnValue = True returnValue = True
tdModError.Visible = True tdModError.Visible = True
lblModErrorMessage.Visible = True lblModErrorMessage.Visible = True
lblModErrorMessage.Text = "Please select user type " lblModErrorMessage.Text = "Please select user type "
ElseIf (cmbModApprover.Text = "select") AndAlso (cmbModApprover.Visible = True) Then ElseIf (cmbModApprover.Text = "select") AndAlso (cmbModApprover.Visible = True) Then
returnValue = True returnValue = True
tdModError.Visible = True tdModError.Visible = True
lblModErrorMessage.Visible = True lblModErrorMessage.Visible = True
lblModErrorMessage.Text = "Please select Approver name " lblModErrorMessage.Text = "Please select Approver name "
ElseIf (txtModChooseApprover.Text.Trim = String.Empty) AndAlso (txtModChooseApprover.Visible = True) Then ElseIf (txtModChooseApprover.Text.Trim = String.Empty) AndAlso (txtModChooseApprover.Visible = True) Then
returnValue = True returnValue = True
tdModError.Visible = True tdModError.Visible = True
lblModErrorMessage.Visible = True lblModErrorMessage.Visible = True
lblModErrorMessage.Text = "Please select Approver name " lblModErrorMessage.Text = "Please select Approver name "
ElseIf Not txtModChooseApprover.Text.Trim.Contains(":") AndAlso (txtModChooseApprover.Visible = True) Then ElseIf Not txtModChooseApprover.Text.Trim.Contains(":") AndAlso (txtModChooseApprover.Visible = True) Then
returnValue = True returnValue = True
tdModError.Visible = True tdModError.Visible = True
lblModErrorMessage.Visible = True lblModErrorMessage.Visible = True
lblModErrorMessage.Text = "Please verify the approver" lblModErrorMessage.Text = "Please verify the approver"
ElseIf txtModRemarks.Text.Trim = String.Empty Then ElseIf txtModRemarks.Text.Trim = String.Empty Then
returnValue = True returnValue = True
tdModError.Visible = True tdModError.Visible = True
lblModErrorMessage.Visible = True lblModErrorMessage.Visible = True
lblModErrorMessage.Text = "Remarks field cannot be left blank." lblModErrorMessage.Text = "Remarks field cannot be left blank."
Else Else
tdModError.Visible = False tdModError.Visible = False
lblModErrorMessage.Visible = False lblModErrorMessage.Visible = False
lblModErrorMessage.Text = String.Empty lblModErrorMessage.Text = String.Empty
End If End If
Return returnValue Return returnValue
End Function End Function
Protected Sub SaveRequestDetails() Protected Sub SaveRequestDetails()
Dim dtSelectedSystems As New DataTable Dim dtSelectedSystems As New DataTable
Dim isSaveSuccessful As Boolean = True Dim isSaveSuccessful As Boolean = True
Dim strEmail As String = String.Empty Dim strEmail As String = String.Empty
Dim strPerNo As String = String.Empty Dim strPerNo As String = String.Empty
Dim strErrorMessage As String = String.Empty Dim strErrorMessage As String = String.Empty
Dim dtMail As New DataTable Dim dtMail As New DataTable
dtMail.Columns.Add("RefNo") dtMail.Columns.Add("RefNo")
dtMail.Columns.Add("ApplicationName") dtMail.Columns.Add("ApplicationName")
dtMail.Columns.Add("UserNo") dtMail.Columns.Add("UserNo")
dtMail.Columns.Add("UserName") dtMail.Columns.Add("UserName")
dtSelectedSystems = objMultipleSelection.MultipleSelectValue(DropCheck_system.Text.ToString) dtSelectedSystems = objMultipleSelection.MultipleSelectValue(DropCheck_system.Text.ToString)
If dtSelectedSystems.Rows.Count > 0 Then If dtSelectedSystems.Rows.Count > 0 Then
'<Choose Approover> '<Choose Approover>
If cmbApprover.Visible = True Then If cmbApprover.Visible = True Then
strPerNo = cmbApprover.SelectedValue.Trim.ToString strPerNo = cmbApprover.SelectedValue.Trim.ToString
ElseIf txtChooseApprover.Visible = True Then ElseIf txtChooseApprover.Visible = True Then
Dim perNo() As String = txtChooseApprover.Text.Trim.Split(":") Dim perNo() As String = txtChooseApprover.Text.Trim.Split(":")
If perNo.Length > 0 Then If perNo.Length > 0 Then
strPerNo = perNo(1).ToString.Trim strPerNo = perNo(1).ToString.Trim
End If End If
End If End If
'</Choose Approover> '</Choose Approover>
strEmail = FetchApproverEmail(strPerNo) strEmail = FetchApproverEmail(strPerNo)
Try Try
For Each drow As DataRow In dtSelectedSystems.Rows For Each drow As DataRow In dtSelectedSystems.Rows
Try Try
Dim file_content(fileUpload.PostedFile.InputStream.Length - 1) As Byte Dim file_content(fileUpload.PostedFile.InputStream.Length - 1) As Byte
fileUpload.PostedFile.InputStream.Read(file_content, 0, file_content.Length) fileUpload.PostedFile.InputStream.Read(file_content, 0, file_content.Length)
Dim strRequestNumber As String = GenerateReferenceNumber() Dim strRequestNumber As String = GenerateReferenceNumber()
'~~~~~~~~~~Code & parameter to insert data in T_AIMS~~~~~~~~~~~~~~ '~~~~~~~~~~Code & parameter to insert data in T_AIMS~~~~~~~~~~~~~~
Dim SqlInsert As String = SqlQueries.INSERT_AIMS002_ADD_APPROVER Dim SqlInsert As String = SqlQueries.INSERT_AIMS002_ADD_APPROVER
SqlInsert = SqlInsert.Replace("@t_aims.TAI_REF_NO", "'" & strRequestNumber & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_REF_NO", "'" & strRequestNumber & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_IDO_PNO", "'" & txtOwnerPerNo.Text.Trim & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_IDO_PNO", "'" & txtOwnerPerNo.Text.Trim & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_IDO_EMAIL", "'" & txtOwnerEmail.Text.Trim & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_IDO_EMAIL", "'" & txtOwnerEmail.Text.Trim & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_PNO", "'" & txtUserPersonalNo.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_PNO", "'" & txtUserPersonalNo.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_ID", "'" & txtUserPersonalNo.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_ID", "'" & txtUserPersonalNo.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_CC", "'" & hidCostCenter.Value.ToString.Trim & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_CC", "'" & hidCostCenter.Value.ToString.Trim & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_EMAIL", "'" & txtUserEmail.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_EMAIL", "'" & txtUserEmail.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_REM", "'" & txtUserRemarks.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_REM", "'" & txtUserRemarks.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_SUB_APP_CD", "'" & drow("val").ToString & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_SUB_APP_CD", "'" & drow("val").ToString & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_ATYP_CD", "'" & cmbUserType.SelectedValue.ToString & "'") 'TypeCode to be fethced SqlInsert = SqlInsert.Replace("@t_aims.TAI_ATYP_CD", "'" & cmbUserType.SelectedValue.ToString & "'") 'TypeCode to be fethced
SqlInsert = SqlInsert.Replace("@t_aims.TAI_VALID_FROM", "TO_DATE(" & "'" & txtValidFrom.Text.Trim & "'" & "," & "'MM-dd-yyyy HH24:MI:SS')") SqlInsert = SqlInsert.Replace("@t_aims.TAI_VALID_FROM", "TO_DATE(" & "'" & txtValidFrom.Text.Trim & "'" & "," & "'MM-dd-yyyy HH24:MI:SS')")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_VALID_TO", "TO_DATE(" & "'" & txtValidTo.Text.Trim & "'" & "," & "'MM-dd-yyyy HH24:MI:SS')") SqlInsert = SqlInsert.Replace("@t_aims.TAI_VALID_TO", "TO_DATE(" & "'" & txtValidTo.Text.Trim & "'" & "," & "'MM-dd-yyyy HH24:MI:SS')")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_ASST_NO", "'" & txtUserAssetNo.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_ASST_NO", "'" & txtUserAssetNo.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_DB_NAM", "' '") SqlInsert = SqlInsert.Replace("@t_aims.TAI_DB_NAM", "' '")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_TAB_NAM", "' '") SqlInsert = SqlInsert.Replace("@t_aims.TAI_TAB_NAM", "' '")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_SUGG_ID", "'" & txtSuggestedId.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_SUGG_ID", "'" & txtSuggestedId.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_ATTACH", "''") SqlInsert = SqlInsert.Replace("@t_aims.TAI_ATTACH", "''")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_ENT_TYPE", "'M'") ' M in case of entry from system otherwise I SqlInsert = SqlInsert.Replace("@t_aims.TAI_ENT_TYPE", "'M'") ' M in case of entry from system otherwise I
SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_TEL", "'" & txtUserContact.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_TEL", "'" & txtUserContact.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@TAI_ATTACH_DTL", "'" & fileUpload.FileName.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@TAI_ATTACH_DTL", "'" & fileUpload.FileName.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@TAI_USR_NAME", "'" & txtUserName.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@TAI_USR_NAME", "'" & txtUserName.Text.Trim.Replace("'", "''") & "'")
'<MOD|REM> '<MOD|REM>
SqlInsert = SqlInsert.Replace("@T_AIMS.TAI_ACN_TYP", "'" & Messages.AIMS_NEW_REQUEST_TAG & "'") SqlInsert = SqlInsert.Replace("@T_AIMS.TAI_ACN_TYP", "'" & Messages.AIMS_NEW_REQUEST_TAG & "'")
'</MOD|REM> '</MOD|REM>
'" & txtUserDatabaseName.Text.Trim.Replace("'", "''") & "' '" & txtUserDatabaseName.Text.Trim.Replace("'", "''") & "'
'" & txtUserTableName.Text.Trim.Replace("'", "''") & "' '" & txtUserTableName.Text.Trim.Replace("'", "''") & "'
'~~~~~~~~~Code & parameter to insert data in T_Approver~~Departmental~~~~~~~~~~~ '~~~~~~~~~Code & parameter to insert data in T_Approver~~Departmental~~~~~~~~~~~
Dim SqlInsertSuperior As String = SqlQueries.INSERT_AIMS002_ADD_SUPERIOR Dim SqlInsertSuperior As String = SqlQueries.INSERT_AIMS002_ADD_SUPERIOR
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_PER_NO", "'" & strPerNo & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_PER_NO", "'" & strPerNo & "'")
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_EMAIL", "'" & strEmail & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_EMAIL", "'" & strEmail & "'")
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_STATUS", "'" & "P" & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_STATUS", "'" & "P" & "'")
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_DATE", "'" & "" & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_DATE", "'" & "" & "'")
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_REM", "'" & "" & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_REM", "'" & "" & "'")
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_APPV_TYP", "'" & "DA" & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_APPV_TYP", "'" & "DA" & "'")
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_TAI_REF_NO", "'" & strRequestNumber & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_TAI_REF_NO", "'" & strRequestNumber & "'")
'~~~~~~~~~~~~~End ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '~~~~~~~~~~~~~End ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~~~~~Code & parameter to insert data in T_Approver~~~~~IT~~~~~~~~ '~~~~~~~~~Code & parameter to insert data in T_Approver~~~~~IT~~~~~~~~
Dim SqlInsertITApprover As String = SqlQueries.INSERT_AIMS002_ADD_SUPERIOR Dim SqlInsertITApprover As String = SqlQueries.INSERT_AIMS002_ADD_SUPERIOR
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_PER_NO", "'" & "" & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_PER_NO", "'" & "" & "'")
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_EMAIL", "'" & "" & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_EMAIL", "'" & "" & "'")
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_STATUS", "'" & "" & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_STATUS", "'" & "" & "'")
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_DATE", "'" & "" & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_DATE", "'" & "" & "'")
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_REM", "'" & "" & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_REM", "'" & "" & "'")
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_APPV_TYP", "'" & "IT" & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_APPV_TYP", "'" & "IT" & "'")
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_TAI_REF_NO", "'" & strRequestNumber & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_TAI_REF_NO", "'" & strRequestNumber & "'")
'~~~~~~~~~~~~~End ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '~~~~~~~~~~~~~End ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~~~~~Code & parameter to insert data in T_Approver~~~~~Executer~~~~~~~~ '~~~~~~~~~Code & parameter to insert data in T_Approver~~~~~Executer~~~~~~~~
Dim SqlInsertSMG As String = SqlQueries.INSERT_AIMS002_ADD_SUPERIOR Dim SqlInsertSMG As String = SqlQueries.INSERT_AIMS002_ADD_SUPERIOR
SqlInsertSMG = SqlInsertSMG.Replace("@TAR_PER_NO", "'" & "" & "'") SqlInsertSMG = SqlInsertSMG.Replace("@TAR_PER_NO", "'" & "" & "'")
SqlInsertSMG = SqlInsertSMG.Replace("@TAR_EMAIL", "'" & "" & "'") SqlInsertSMG = SqlInsertSMG.Replace("@TAR_EMAIL", "'" & "" & "'")
SqlInsertSMG = SqlInsertSMG.Replace("@TAR_STATUS", "'" & "" & "'") SqlInsertSMG = SqlInsertSMG.Replace("@TAR_STATUS", "'" & "" & "'")
SqlInsertSMG = SqlInsertSMG.Replace("@TAR_DATE", "'" & "" & "'") SqlInsertSMG = SqlInsertSMG.Replace("@TAR_DATE", "'" & "" & "'")
SqlInsertSMG = SqlInsertSMG.Replace("@TAR_REM", "'" & "" & "'") SqlInsertSMG = SqlInsertSMG.Replace("@TAR_REM", "'" & "" & "'")
SqlInsertSMG = SqlInsertSMG.Replace("@TAR_APPV_TYP", "'" & "EX" & "'") SqlInsertSMG = SqlInsertSMG.Replace("@TAR_APPV_TYP", "'" & "EX" & "'")
SqlInsertSMG = SqlInsertSMG.Replace("@TAR_TAI_REF_NO", "'" & strRequestNumber & "'") SqlInsertSMG = SqlInsertSMG.Replace("@TAR_TAI_REF_NO", "'" & strRequestNumber & "'")
'~~~~~~~~~~~~~End ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '~~~~~~~~~~~~~End ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim transaction As IDbTransaction = _dbHelper.BeginTransaction() Dim transaction As IDbTransaction = _dbHelper.BeginTransaction()
Try Try
Dim strAIMS As String = _dbHelper.ExecuteNonQuery(SqlInsert, transaction) Dim strAIMS As String = _dbHelper.ExecuteNonQuery(SqlInsert, transaction)
'SaveAttachment(file_content, strRequestNumber) 'SaveAttachment(file_content, strRequestNumber)
Dim strSuperior As String = _dbHelper.ExecuteNonQuery(SqlInsertSuperior, transaction) Dim strSuperior As String = _dbHelper.ExecuteNonQuery(SqlInsertSuperior, transaction)
Dim strITApprover As String = _dbHelper.ExecuteNonQuery(SqlInsertITApprover, transaction) Dim strITApprover As String = _dbHelper.ExecuteNonQuery(SqlInsertITApprover, transaction)
Dim strSMG As String = _dbHelper.ExecuteNonQuery(SqlInsertSMG, transaction) Dim strSMG As String = _dbHelper.ExecuteNonQuery(SqlInsertSMG, transaction)
_dbHelper.CommitTransaction(transaction) _dbHelper.CommitTransaction(transaction)
Dim dt As New DataTable Dim dt As New DataTable
ViewState("selected_new_apps") = dt ViewState("selected_new_apps") = dt
SaveAttachment(file_content, strRequestNumber) SaveAttachment(file_content, strRequestNumber)
'~~~~~~Prepare new DataTAble tom send mails~~~~~~~~~~~ '~~~~~~Prepare new DataTAble tom send mails~~~~~~~~~~~
Dim eachRow As DataRow Dim eachRow As DataRow
eachRow = dtMail.NewRow() eachRow = dtMail.NewRow()
eachRow("RefNo") = strRequestNumber eachRow("RefNo") = strRequestNumber
'<GENERATE SYSTEM NAME>' '<GENERATE SYSTEM NAME>'
Dim fetchSystemName As String = SqlQueries.AIMS008_FETCH_SYSTEMNAME_BY_CODE Dim fetchSystemName As String = SqlQueries.AIMS008_FETCH_SYSTEMNAME_BY_CODE
fetchSystemName = fetchSystemName.Replace("@TAP_SUB_APP_CD", "'" & drow("val").ToString & "'") fetchSystemName = fetchSystemName.Replace("@TAP_SUB_APP_CD", "'" & drow("val").ToString & "'")
Dim objSystemName As Object = _dbHelper.ExecuteScalar(fetchSystemName) Dim objSystemName As Object = _dbHelper.ExecuteScalar(fetchSystemName)
If objSystemName IsNot Nothing Then If objSystemName IsNot Nothing Then
eachRow("ApplicationName") = objSystemName.ToString eachRow("ApplicationName") = objSystemName.ToString
End If End If
'</GENERATE SYSTEM NAME>' '</GENERATE SYSTEM NAME>'
eachRow("UserNo") = txtUserPersonalNo.Text.Trim eachRow("UserNo") = txtUserPersonalNo.Text.Trim
eachRow("UserName") = txtUserName.Text.Trim eachRow("UserName") = txtUserName.Text.Trim
dtMail.Rows.Add(eachRow) dtMail.Rows.Add(eachRow)
Catch ex As Exception Catch ex As Exception
isSaveSuccessful = False isSaveSuccessful = False
_dbHelper.RollbackTransaction(transaction) _dbHelper.RollbackTransaction(transaction)
strErrorMessage = "Your request is not submitted due to system error.Error(" & ex.Message.ToString.Trim & ") \n Please contact IT helpdesk." strErrorMessage = "Your request is not submitted due to system error.Error(" & ex.Message.ToString.Trim & ") \n Please contact IT helpdesk."
Finally Finally
End Try End Try
Catch ex As Exception Catch ex As Exception
Finally Finally
End Try End Try
Next Next
'~~~~~~~~~~~Send mail to approver if save is correct~~~~~~~~~~~~ '~~~~~~~~~~~Send mail to approver if save is correct~~~~~~~~~~~~
If isSaveSuccessful Then If isSaveSuccessful Then
'Dim apps As String = "" Dim str As String = "Your request has been raised successfully for " + DropCheck_system.Text.ToString
'For i = 0 To dtSelectedSystems.Rows.Count - 1
' apps += dtSelectedSystems.Rows(i).Item(0) + " ,"
'Next
'apps=apps.Remove(apps.Length-1)
Dim str As String = "Your request has been raised successfully for " + DropCheck_system.Text.ToString
SendApprovalMailByRequester(strEmail, dtMail, txtOwnerName.Text.Trim, txtOwnerPerNo.Text.Trim, txtUserRemarks.Text.Trim) SendApprovalMailByRequester(strEmail, dtMail, txtOwnerName.Text.Trim, txtOwnerPerNo.Text.Trim, txtUserRemarks.Text.Trim)
'alert("I am an alert box!") 'alert("I am an alert box!")
Response.Write("<SCRIPT > alert('" + str + "')</SCRIPT>") Response.Write("<SCRIPT > alert('" + str + "')</SCRIPT>")
ResetRequestDetails() ResetRequestDetails()
pnlRequestDetails.Visible = False pnlRequestDetails.Visible = False
Else Else
Response.Write("<SCRIPT > alert('" + strErrorMessage + "')</SCRIPT>") Response.Write("<SCRIPT > alert('" + strErrorMessage + "')</SCRIPT>")
ResetRequestDetails() ResetRequestDetails()
pnlRequestDetails.Visible = False pnlRequestDetails.Visible = False
End If End If
Me.btnRequest.Enabled = True Me.btnRequest.Enabled = True
Me.btnModify.Enabled = True Me.btnModify.Enabled = True
Me.btnRemove.Enabled = True Me.btnRemove.Enabled = True
Catch ex As Exception Catch ex As Exception
Finally Finally
End Try End Try
Else Else
lblErrorMessage.Visible = True lblErrorMessage.Visible = True
tdError.Visible = True tdError.Visible = True
lblErrorMessage.Text = "You have not selected any system in provided window pls select atleast one system" lblErrorMessage.Text = "You have not selected any system in provided window pls select atleast one system"
End If End If
End Sub End Sub
Protected Sub btn_ok_click() Protected Sub btn_ok_click()
Dim count As Integer = 0 Dim count As Integer = 0
For i = 0 To gridCost.Rows.Count - 1 For i = 0 To gridCost.Rows.Count - 1
Dim check As Boolean = CType(gridCost.Rows(i).FindControl("chkSelectSMG"), CheckBox).Checked Dim check As Boolean = CType(gridCost.Rows(i).FindControl("chkSelectSMG"), CheckBox).Checked
If check Then If check Then
count = count + 1 count = count + 1
Else Else
End If End If
Next Next
If count = gridCost.Rows.Count Then If count = gridCost.Rows.Count Then
lbl_error.Visible = False lbl_error.Visible = False
btn_ok_final.Visible = False btn_ok_final.Visible = False
btn_cnf_ok.Visible = True btn_cnf_ok.Visible = True
For i = 0 To gridCost.Rows.Count - 1 For i = 0 To gridCost.Rows.Count - 1
Dim check As Boolean = CType(gridCost.Rows(i).FindControl("chkSelectSMG"), CheckBox).Checked Dim check As Boolean = CType(gridCost.Rows(i).FindControl("chkSelectSMG"), CheckBox).Checked
If check Then If check Then
selected_apps += CType(gridCost.Rows(i).FindControl("lbl_app_name"), Label).Text.Trim + "," selected_apps += CType(gridCost.Rows(i).FindControl("lbl_app_name"), Label).Text.Trim + ","
Else Else
unselected_apps += CType(gridCost.Rows(i).FindControl("lbl_app_name"), Label).Text.Trim + "," unselected_apps += CType(gridCost.Rows(i).FindControl("lbl_app_name"), Label).Text.Trim + ","
End If End If
Next Next
'If unselected_apps.Length > 0 Then 'If unselected_apps.Length > 0 Then
' unselected_apps = unselected_apps.Remove(unselected_apps.Length - 1) ' unselected_apps = unselected_apps.Remove(unselected_apps.Length - 1)
'End If 'End If
Dim arr_unselected_app As String() Dim arr_unselected_app As String()
arr_unselected_app = unselected_apps.Split(",") arr_unselected_app = unselected_apps.Split(",")
If arr_unselected_app.Length > 0 Then If arr_unselected_app.Length > 0 Then
For i = 0 To arr_unselected_app.Length - 2 For i = 0 To arr_unselected_app.Length - 2
DropCheck_system.Text = DropCheck_system.Text.Replace(arr_unselected_app(i).Trim, "") DropCheck_system.Text = DropCheck_system.Text.Replace(arr_unselected_app(i).Trim, "")
Next Next
End If End If
DropCheck_system.Text = DropCheck_system.Text.Replace(",,", ",") DropCheck_system.Text = DropCheck_system.Text.Replace(",,", ",")
If DropCheck_system.Text.EndsWith(",") Then If DropCheck_system.Text.EndsWith(",") Then
DropCheck_system.Text = DropCheck_system.Text.Remove(DropCheck_system.Text.Length - 1) DropCheck_system.Text = DropCheck_system.Text.Remove(DropCheck_system.Text.Length - 1)
End If End If
If DropCheck_system.Text.StartsWith(",") Then If DropCheck_system.Text.StartsWith(",") Then
DropCheck_system.Text = DropCheck_system.Text.Remove(0, 1) DropCheck_system.Text = DropCheck_system.Text.Remove(0, 1)
End If End If
unselected_apps = "" unselected_apps = ""
SaveRequestDetails() SaveRequestDetails()
ElseIf count = 0 Then ElseIf count = 0 Then
lbl_error.Text = "You have not selected any of the above application for raising request. Pls confirm." lbl_error.Text = "You have not selected any of the above application for raising request. Pls confirm."
lbl_error.Visible = True lbl_error.Visible = True
btn_ok_final.Visible = True btn_ok_final.Visible = True
btn_cnf_ok.Visible = False btn_cnf_ok.Visible = False
mdlpop_cnf.Show() mdlpop_cnf.Show()
Else Else
lbl_error.Text = "You have selected " + count.ToString + " application for raising request. " + Environment.NewLine + "Pls confirm." lbl_error.Text = "You have selected " + count.ToString + " application for raising request. " + Environment.NewLine + "Pls confirm."
lbl_error.Visible = True lbl_error.Visible = True
btn_ok_final.Visible = True btn_ok_final.Visible = True
btn_cnf_ok.Visible = False btn_cnf_ok.Visible = False
mdlpop_cnf.Show() mdlpop_cnf.Show()
End If End If
End Sub End Sub
Protected Sub btn_ok_final_click() Protected Sub btn_ok_final_click()
'Dim count As Integer = 0 'Dim count As Integer = 0
'For i = 0 To gridCost.Rows.Count - 1 'For i = 0 To gridCost.Rows.Count - 1
' Dim check As Boolean = CType(gridCost.Rows(i).FindControl("chkSelectSMG"), CheckBox).Checked ' Dim check As Boolean = CType(gridCost.Rows(i).FindControl("chkSelectSMG"), CheckBox).Checked
' If check Then ' If check Then
' count = count + 1 ' count = count + 1
' Else ' Else
' End If ' End If
'Next 'Next
'If count = gridCost.Rows.Count Then 'If count = gridCost.Rows.Count Then
' lbl_error.Visible = False ' lbl_error.Visible = False
For i = 0 To gridCost.Rows.Count - 1 For i = 0 To gridCost.Rows.Count - 1
Dim check As Boolean = CType(gridCost.Rows(i).FindControl("chkSelectSMG"), CheckBox).Checked Dim check As Boolean = CType(gridCost.Rows(i).FindControl("chkSelectSMG"), CheckBox).Checked
If check Then If check Then
selected_apps += CType(gridCost.Rows(i).FindControl("lbl_app_name"), Label).Text.Trim + "," selected_apps += CType(gridCost.Rows(i).FindControl("lbl_app_name"), Label).Text.Trim + ","
Else Else
unselected_apps += CType(gridCost.Rows(i).FindControl("lbl_app_name"), Label).Text.Trim + "," unselected_apps += CType(gridCost.Rows(i).FindControl("lbl_app_name"), Label).Text.Trim + ","
End If End If
Next Next
'If unselected_apps.Length > 0 Then 'If unselected_apps.Length > 0 Then
' unselected_apps = unselected_apps.Remove(unselected_apps.Length - 1) ' unselected_apps = unselected_apps.Remove(unselected_apps.Length - 1)
'End If 'End If
Dim arr_unselected_app As String() Dim arr_unselected_app As String()
arr_unselected_app = unselected_apps.Split(",") arr_unselected_app = unselected_apps.Split(",")
If arr_unselected_app.Length > 0 Then If arr_unselected_app.Length > 0 Then
For i = 0 To arr_unselected_app.Length - 2 For i = 0 To arr_unselected_app.Length - 2
DropCheck_system.Text = DropCheck_system.Text.Replace(arr_unselected_app(i).Trim, "") DropCheck_system.Text = DropCheck_system.Text.Replace(arr_unselected_app(i).Trim, "")
Next Next
End If End If
DropCheck_system.Text = DropCheck_system.Text.Replace(",,", ",") DropCheck_system.Text = DropCheck_system.Text.Replace(",,", ",")
If DropCheck_system.Text.EndsWith(",") Then If DropCheck_system.Text.EndsWith(",") Then
DropCheck_system.Text = DropCheck_system.Text.Remove(DropCheck_system.Text.Length - 1) DropCheck_system.Text = DropCheck_system.Text.Remove(DropCheck_system.Text.Length - 1)
End If End If
If DropCheck_system.Text.StartsWith(",") Then If DropCheck_system.Text.StartsWith(",") Then
DropCheck_system.Text = DropCheck_system.Text.Remove(0, 1) DropCheck_system.Text = DropCheck_system.Text.Remove(0, 1)
End If End If
unselected_apps = "" unselected_apps = ""
SaveRequestDetails() SaveRequestDetails()
'Else 'Else
'lbl_error.Text = "You have selected " + count + " application for raising request. " + Environment.NewLine + "Pls confirm." 'lbl_error.Text = "You have selected " + count + " application for raising request. " + Environment.NewLine + "Pls confirm."
'lbl_error.Visible = True 'lbl_error.Visible = True
'mdlpop_cnf.Show() 'mdlpop_cnf.Show()
'End If 'End If
End Sub End Sub
Protected Sub SaveModRequestDetails() 'SaveRemoveDetails Protected Sub SaveModRequestDetails() 'SaveRemoveDetails
Dim isSaveSuccessful As Boolean = True Dim isSaveSuccessful As Boolean = True
Dim strEmail As String = String.Empty Dim strEmail As String = String.Empty
Dim strPerNo As String = String.Empty Dim strPerNo As String = String.Empty
Dim strErrorMessage As String = String.Empty Dim strErrorMessage As String = String.Empty
Dim dtMail As New DataTable Dim dtMail As New DataTable
dtMail.Columns.Add("RefNo") dtMail.Columns.Add("RefNo")
dtMail.Columns.Add("ApplicationName") dtMail.Columns.Add("ApplicationName")
dtMail.Columns.Add("UserNo") dtMail.Columns.Add("UserNo")
dtMail.Columns.Add("UserName") dtMail.Columns.Add("UserName")
'<Choose Approover> '<Choose Approover>
If cmbModApprover.Visible = True Then If cmbModApprover.Visible = True Then
strPerNo = cmbModApprover.SelectedValue.Trim.ToString strPerNo = cmbModApprover.SelectedValue.Trim.ToString
ElseIf txtModChooseApprover.Visible = True Then ElseIf txtModChooseApprover.Visible = True Then
Dim perNo() As String = txtModChooseApprover.Text.Trim.Split(":") Dim perNo() As String = txtModChooseApprover.Text.Trim.Split(":")
If perNo.Length > 0 Then If perNo.Length > 0 Then
strPerNo = perNo(1).ToString.Trim strPerNo = perNo(1).ToString.Trim
End If End If
End If End If
'</Choose Approover> '</Choose Approover>
strEmail = FetchApproverEmail(strPerNo) strEmail = FetchApproverEmail(strPerNo)
Try Try
Try Try
Dim file_content(fileUploadMod.PostedFile.InputStream.Length - 1) As Byte Dim file_content(fileUploadMod.PostedFile.InputStream.Length - 1) As Byte
fileUploadMod.PostedFile.InputStream.Read(file_content, 0, file_content.Length) fileUploadMod.PostedFile.InputStream.Read(file_content, 0, file_content.Length)
Dim strRequestNumber As String = GenerateReferenceNumber() Dim strRequestNumber As String = GenerateReferenceNumber()
'~~~~~~~~~~Code & parameter to insert data in T_AIMS~~~~~~~~~~~~~~ '~~~~~~~~~~Code & parameter to insert data in T_AIMS~~~~~~~~~~~~~~
Dim SqlInsert As String = SqlQueries.INSERT_AIMS002_ADD_APPROVER Dim SqlInsert As String = SqlQueries.INSERT_AIMS002_ADD_APPROVER
SqlInsert = SqlInsert.Replace("@t_aims.TAI_REF_NO", "'" & strRequestNumber & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_REF_NO", "'" & strRequestNumber & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_IDO_PNO", "'" & txtModPersonalNumber.Text.Trim & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_IDO_PNO", "'" & txtModPersonalNumber.Text.Trim & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_IDO_EMAIL", "'" & txtModOwnerEmail.Text.Trim & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_IDO_EMAIL", "'" & txtModOwnerEmail.Text.Trim & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_PNO", "'" & txtModUserPersonalNumber.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_PNO", "'" & txtModUserPersonalNumber.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_ID", "'" & txtModUserPersonalNumber.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_ID", "'" & txtModUserPersonalNumber.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_CC", "'" & hidModCostCenter.Value.ToString.Trim & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_CC", "'" & hidModCostCenter.Value.ToString.Trim & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_EMAIL", "'" & txtModUserEmail.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_EMAIL", "'" & txtModUserEmail.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_REM", "'" & txtModRemarks.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_REM", "'" & txtModRemarks.Text.Trim.Replace("'", "''") & "'")
Dim strAppCode() As String = cmbModSystemNames.SelectedValue.ToString.Trim().Split("!") Dim strAppCode() As String = cmbModSystemNames.SelectedValue.ToString.Trim().Split("!")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_SUB_APP_CD", "'" & strAppCode(0).ToString() & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_SUB_APP_CD", "'" & strAppCode(0).ToString() & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_ATYP_CD", "'" & cmbModUserType.SelectedValue.ToString & "'") 'TypeCode to be fethced SqlInsert = SqlInsert.Replace("@t_aims.TAI_ATYP_CD", "'" & cmbModUserType.SelectedValue.ToString & "'") 'TypeCode to be fethced
SqlInsert = SqlInsert.Replace("@t_aims.TAI_VALID_FROM", "TO_DATE(" & "'" & txtModValidFrom.Text.Trim & "'" & "," & "'MM-dd-yyyy HH24:MI:SS')") SqlInsert = SqlInsert.Replace("@t_aims.TAI_VALID_FROM", "TO_DATE(" & "'" & txtModValidFrom.Text.Trim & "'" & "," & "'MM-dd-yyyy HH24:MI:SS')")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_VALID_TO", "TO_DATE(" & "'" & txtModValidTo.Text.Trim & "'" & "," & "'MM-dd-yyyy HH24:MI:SS')") SqlInsert = SqlInsert.Replace("@t_aims.TAI_VALID_TO", "TO_DATE(" & "'" & txtModValidTo.Text.Trim & "'" & "," & "'MM-dd-yyyy HH24:MI:SS')")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_ASST_NO", "'" & txtModAssetNumber.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_ASST_NO", "'" & txtModAssetNumber.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_DB_NAM", "'" & txtModDatabase.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_DB_NAM", "'" & txtModDatabase.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_TAB_NAM", "'" & txtModTable.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_TAB_NAM", "'" & txtModTable.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_SUGG_ID", "'" & txtModSuggestedId.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_SUGG_ID", "'" & txtModSuggestedId.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_ATTACH", "''") SqlInsert = SqlInsert.Replace("@t_aims.TAI_ATTACH", "''")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_ENT_TYPE", "'M'") ' M in case of entry from system otherwise I SqlInsert = SqlInsert.Replace("@t_aims.TAI_ENT_TYPE", "'M'") ' M in case of entry from system otherwise I
SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_TEL", "'" & txtModUserContact.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_TEL", "'" & txtModUserContact.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@TAI_ATTACH_DTL", "'" & fileUploadMod.FileName.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@TAI_ATTACH_DTL", "'" & fileUploadMod.FileName.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@TAI_USR_NAME", "'" & txtModUserName.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@TAI_USR_NAME", "'" & txtModUserName.Text.Trim.Replace("'", "''") & "'")
'<MOD|REM> '<MOD|REM>
SqlInsert = SqlInsert.Replace("@T_AIMS.TAI_ACN_TYP", "'" & Messages.AIMS_MODIFY_REQUEST_TAG & "'") SqlInsert = SqlInsert.Replace("@T_AIMS.TAI_ACN_TYP", "'" & Messages.AIMS_MODIFY_REQUEST_TAG & "'")
'</MOD|REM> '</MOD|REM>
'~~~~~~~~~Code & parameter to insert data in T_Approver~~Departmental~~~~~~~~~~~ '~~~~~~~~~Code & parameter to insert data in T_Approver~~Departmental~~~~~~~~~~~
Dim SqlInsertSuperior As String = SqlQueries.INSERT_AIMS002_ADD_SUPERIOR Dim SqlInsertSuperior As String = SqlQueries.INSERT_AIMS002_ADD_SUPERIOR
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_PER_NO", "'" & strPerNo & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_PER_NO", "'" & strPerNo & "'")
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_EMAIL", "'" & strEmail & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_EMAIL", "'" & strEmail & "'")
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_STATUS", "'" & "P" & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_STATUS", "'" & "P" & "'")
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_DATE", "'" & "" & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_DATE", "'" & "" & "'")
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_REM", "'" & "" & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_REM", "'" & "" & "'")
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_APPV_TYP", "'" & "DA" & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_APPV_TYP", "'" & "DA" & "'")
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_TAI_REF_NO", "'" & strRequestNumber & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_TAI_REF_NO", "'" & strRequestNumber & "'")
'~~~~~~~~~~~~~End ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '~~~~~~~~~~~~~End ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~~~~~Code & parameter to insert data in T_Approver~~~~~IT~~~~~~~~ '~~~~~~~~~Code & parameter to insert data in T_Approver~~~~~IT~~~~~~~~
Dim SqlInsertITApprover As String = SqlQueries.INSERT_AIMS002_ADD_SUPERIOR Dim SqlInsertITApprover As String = SqlQueries.INSERT_AIMS002_ADD_SUPERIOR
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_PER_NO", "'" & "" & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_PER_NO", "'" & "" & "'")
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_EMAIL", "'" & "" & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_EMAIL", "'" & "" & "'")
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_STATUS", "'" & "" & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_STATUS", "'" & "" & "'")
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_DATE", "'" & "" & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_DATE", "'" & "" & "'")
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_REM", "'" & "" & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_REM", "'" & "" & "'")
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_APPV_TYP", "'" & "IT" & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_APPV_TYP", "'" & "IT" & "'")
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_TAI_REF_NO", "'" & strRequestNumber & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_TAI_REF_NO", "'" & strRequestNumber & "'")
'~~~~~~~~~~~~~End ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '~~~~~~~~~~~~~End ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~~~~~Code & parameter to insert data in T_Approver~~~~~Executer~~~~~~~~ '~~~~~~~~~Code & parameter to insert data in T_Approver~~~~~Executer~~~~~~~~
Dim SqlInsertSMG As String = SqlQueries.INSERT_AIMS002_ADD_SUPERIOR Dim SqlInsertSMG As String = SqlQueries.INSERT_AIMS002_ADD_SUPERIOR
SqlInsertSMG = SqlInsertSMG.Replace("@TAR_PER_NO", "'" & "" & "'") SqlInsertSMG = SqlInsertSMG.Replace("@TAR_PER_NO", "'" & "" & "'")
SqlInsertSMG = SqlInsertSMG.Replace("@TAR_EMAIL", "'" & "" & "'") SqlInsertSMG = SqlInsertSMG.Replace("@TAR_EMAIL", "'" & "" & "'")
SqlInsertSMG = SqlInsertSMG.Replace("@TAR_STATUS", "'" & "" & "'") SqlInsertSMG = SqlInsertSMG.Replace("@TAR_STATUS", "'" & "" & "'")
SqlInsertSMG = SqlInsertSMG.Replace("@TAR_DATE", "'" & "" & "'") SqlInsertSMG = SqlInsertSMG.Replace("@TAR_DATE", "'" & "" & "'")
SqlInsertSMG = SqlInsertSMG.Replace("@TAR_REM", "'" & "" & "'") SqlInsertSMG = SqlInsertSMG.Replace("@TAR_REM", "'" & "" & "'")
SqlInsertSMG = SqlInsertSMG.Replace("@TAR_APPV_TYP", "'" & "EX" & "'") SqlInsertSMG = SqlInsertSMG.Replace("@TAR_APPV_TYP", "'" & "EX" & "'")
SqlInsertSMG = SqlInsertSMG.Replace("@TAR_TAI_REF_NO", "'" & strRequestNumber & "'") SqlInsertSMG = SqlInsertSMG.Replace("@TAR_TAI_REF_NO", "'" & strRequestNumber & "'")
'~~~~~~~~~~~~~End ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '~~~~~~~~~~~~~End ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim transaction As IDbTransaction = _dbHelper.BeginTransaction() Dim transaction As IDbTransaction = _dbHelper.BeginTransaction()
Try Try
Dim strAIMS As String = _dbHelper.ExecuteNonQuery(SqlInsert, transaction) Dim strAIMS As String = _dbHelper.ExecuteNonQuery(SqlInsert, transaction)
'SaveAttachment(file_content, strRequestNumber) 'SaveAttachment(file_content, strRequestNumber)
Dim strSuperior As String = _dbHelper.ExecuteNonQuery(SqlInsertSuperior, transaction) Dim strSuperior As String = _dbHelper.ExecuteNonQuery(SqlInsertSuperior, transaction)
Dim strITApprover As String = _dbHelper.ExecuteNonQuery(SqlInsertITApprover, transaction) Dim strITApprover As String = _dbHelper.ExecuteNonQuery(SqlInsertITApprover, transaction)
Dim strSMG As String = _dbHelper.ExecuteNonQuery(SqlInsertSMG, transaction) Dim strSMG As String = _dbHelper.ExecuteNonQuery(SqlInsertSMG, transaction)
_dbHelper.CommitTransaction(transaction) _dbHelper.CommitTransaction(transaction)
SaveModAttachment(file_content, strRequestNumber) SaveModAttachment(file_content, strRequestNumber)
'~~~~~~Prepare new DataTAble tom send mails~~~~~~~~~~~ '~~~~~~Prepare new DataTAble tom send mails~~~~~~~~~~~
Dim eachRow As DataRow Dim eachRow As DataRow
eachRow = dtMail.NewRow() eachRow = dtMail.NewRow()
eachRow("RefNo") = strRequestNumber eachRow("RefNo") = strRequestNumber
'<Generate application Name>' '<Generate application Name>'
Dim appName As String() = cmbModSystemNames.SelectedItem.Text.ToString.Trim.Split(":") Dim appName As String() = cmbModSystemNames.SelectedItem.Text.ToString.Trim.Split(":")
If appName.Length > 0 Then If appName.Length > 0 Then
eachRow("ApplicationName") = appName(0).ToString eachRow("ApplicationName") = appName(0).ToString
End If End If
'</Generate application Name>' '</Generate application Name>'
eachRow("UserNo") = txtModUserPersonalNumber.Text.Trim eachRow("UserNo") = txtModUserPersonalNumber.Text.Trim
eachRow("UserName") = txtModUserName.Text.Trim eachRow("UserName") = txtModUserName.Text.Trim
dtMail.Rows.Add(eachRow) dtMail.Rows.Add(eachRow)
Catch ex As Exception Catch ex As Exception
isSaveSuccessful = False isSaveSuccessful = False
_dbHelper.RollbackTransaction(transaction) _dbHelper.RollbackTransaction(transaction)
strErrorMessage = "Your request is not submitted due to system error.Error(" & ex.Message.ToString.Trim & ") \n Please contact IT helpdesk." strErrorMessage = "Your request is not submitted due to system error.Error(" & ex.Message.ToString.Trim & ") \n Please contact IT helpdesk."
Finally Finally
End Try End Try
Catch ex As Exception Catch ex As Exception
Finally Finally
End Try End Try
'~~~~~~~~~~~Send mail to approver if save is correct~~~~~~~~~~~~ '~~~~~~~~~~~Send mail to approver if save is correct~~~~~~~~~~~~
If isSaveSuccessful Then If isSaveSuccessful Then
SendApprovalMailByRequesterForModification(strEmail, dtMail, txtModOwnerName.Text.Trim, txtModPersonalNumber.Text.Trim, txtModRemarks.Text.Trim) SendApprovalMailByRequesterForModification(strEmail, dtMail, txtModOwnerName.Text.Trim, txtModPersonalNumber.Text.Trim, txtModRemarks.Text.Trim)
'alert("I am an alert box!") 'alert("I am an alert box!")
Response.Write("<SCRIPT > alert('User request has been sent successfully to departmental head for approval.')</SCRIPT>") Response.Write("<SCRIPT > alert('User request has been sent successfully to departmental head for approval.')</SCRIPT>")
ResetModRequestDetails() ResetModRequestDetails()
pnlModificationDetails.Visible = False pnlModificationDetails.Visible = False
Else Else
Response.Write("<SCRIPT > alert('" + strErrorMessage + "')</SCRIPT>") Response.Write("<SCRIPT > alert('" + strErrorMessage + "')</SCRIPT>")
ResetModRequestDetails() ResetModRequestDetails()
pnlModificationDetails.Visible = False pnlModificationDetails.Visible = False
End If End If
Me.btnRequest.Enabled = True Me.btnRequest.Enabled = True
Me.btnModify.Enabled = True Me.btnModify.Enabled = True
Me.btnRemove.Enabled = True Me.btnRemove.Enabled = True
Catch ex As Exception Catch ex As Exception
Finally Finally
End Try End Try
End Sub End Sub
Protected Sub SaveRemoveDetails() Protected Sub SaveRemoveDetails()
Dim isSaveSuccessful As Boolean = True Dim isSaveSuccessful As Boolean = True
Dim strEmail As String = String.Empty Dim strEmail As String = String.Empty
Dim strPerNo As String = String.Empty Dim strPerNo As String = String.Empty
Dim dtMail As New DataTable Dim dtMail As New DataTable
dtMail.Columns.Add("RefNo") dtMail.Columns.Add("RefNo")
dtMail.Columns.Add("ApplicationName") dtMail.Columns.Add("ApplicationName")
dtMail.Columns.Add("UserNo") dtMail.Columns.Add("UserNo")
dtMail.Columns.Add("UserName") dtMail.Columns.Add("UserName")
'<Choose Approover> '<Choose Approover>
If cmbModApprover.Visible = True Then If cmbModApprover.Visible = True Then
strPerNo = cmbModApprover.SelectedValue.Trim.ToString strPerNo = cmbModApprover.SelectedValue.Trim.ToString
ElseIf txtModChooseApprover.Visible = True Then ElseIf txtModChooseApprover.Visible = True Then
Dim perNo() As String = txtModChooseApprover.Text.Trim.Split(":") Dim perNo() As String = txtModChooseApprover.Text.Trim.Split(":")
If perNo.Length > 0 Then If perNo.Length > 0 Then
strPerNo = perNo(1).ToString.Trim strPerNo = perNo(1).ToString.Trim
End If End If
End If End If
'</Choose Approover> '</Choose Approover>
strEmail = FetchApproverEmail(strPerNo) strEmail = FetchApproverEmail(strPerNo)
Try Try
Try Try
Dim file_content(fileUploadMod.PostedFile.InputStream.Length - 1) As Byte Dim file_content(fileUploadMod.PostedFile.InputStream.Length - 1) As Byte
fileUploadMod.PostedFile.InputStream.Read(file_content, 0, file_content.Length) fileUploadMod.PostedFile.InputStream.Read(file_content, 0, file_content.Length)
Dim strRequestNumber As String = GenerateReferenceNumber() Dim strRequestNumber As String = GenerateReferenceNumber()
'~~~~~~~~~~Code & parameter to insert data in T_AIMS~~~~~~~~~~~~~~ '~~~~~~~~~~Code & parameter to insert data in T_AIMS~~~~~~~~~~~~~~
Dim SqlInsert As String = SqlQueries.INSERT_AIMS002_ADD_APPROVER Dim SqlInsert As String = SqlQueries.INSERT_AIMS002_ADD_APPROVER
SqlInsert = SqlInsert.Replace("@t_aims.TAI_REF_NO", "'" & strRequestNumber & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_REF_NO", "'" & strRequestNumber & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_IDO_PNO", "'" & txtModPersonalNumber.Text.Trim & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_IDO_PNO", "'" & txtModPersonalNumber.Text.Trim & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_IDO_EMAIL", "'" & txtModOwnerEmail.Text.Trim & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_IDO_EMAIL", "'" & txtModOwnerEmail.Text.Trim & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_PNO", "'" & txtModUserPersonalNumber.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_PNO", "'" & txtModUserPersonalNumber.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_ID", "'" & txtModUserPersonalNumber.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_ID", "'" & txtModUserPersonalNumber.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_CC", "'" & hidModCostCenter.Value.ToString.Trim & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_CC", "'" & hidModCostCenter.Value.ToString.Trim & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_EMAIL", "'" & txtModUserEmail.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_EMAIL", "'" & txtModUserEmail.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_REM", "'" & txtModRemarks.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_REM", "'" & txtModRemarks.Text.Trim.Replace("'", "''") & "'")
Dim strAppCode() As String = cmbModSystemNames.SelectedValue.ToString.Trim().Split("!") Dim strAppCode() As String = cmbModSystemNames.SelectedValue.ToString.Trim().Split("!")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_SUB_APP_CD", "'" & strAppCode(0).ToString() & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_SUB_APP_CD", "'" & strAppCode(0).ToString() & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_ATYP_CD", "'" & cmbModUserType.SelectedValue.ToString & "'") 'TypeCode to be fethced SqlInsert = SqlInsert.Replace("@t_aims.TAI_ATYP_CD", "'" & cmbModUserType.SelectedValue.ToString & "'") 'TypeCode to be fethced
SqlInsert = SqlInsert.Replace("@t_aims.TAI_VALID_FROM", "TO_DATE(" & "'" & txtModValidFrom.Text.Trim & "'" & "," & "'MM-dd-yyyy HH24:MI:SS')") SqlInsert = SqlInsert.Replace("@t_aims.TAI_VALID_FROM", "TO_DATE(" & "'" & txtModValidFrom.Text.Trim & "'" & "," & "'MM-dd-yyyy HH24:MI:SS')")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_VALID_TO", "TO_DATE(" & "'" & txtModValidTo.Text.Trim & "'" & "," & "'MM-dd-yyyy HH24:MI:SS')") SqlInsert = SqlInsert.Replace("@t_aims.TAI_VALID_TO", "TO_DATE(" & "'" & txtModValidTo.Text.Trim & "'" & "," & "'MM-dd-yyyy HH24:MI:SS')")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_ASST_NO", "'" & txtModAssetNumber.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_ASST_NO", "'" & txtModAssetNumber.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_DB_NAM", "'" & txtModDatabase.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_DB_NAM", "'" & txtModDatabase.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_TAB_NAM", "'" & txtModTable.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_TAB_NAM", "'" & txtModTable.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_SUGG_ID", "'" & txtModSuggestedId.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_SUGG_ID", "'" & txtModSuggestedId.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_ATTACH", "''") SqlInsert = SqlInsert.Replace("@t_aims.TAI_ATTACH", "''")
SqlInsert = SqlInsert.Replace("@t_aims.TAI_ENT_TYPE", "'M'") ' M in case of entry from system otherwise I SqlInsert = SqlInsert.Replace("@t_aims.TAI_ENT_TYPE", "'M'") ' M in case of entry from system otherwise I
SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_TEL", "'" & txtModUserContact.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@t_aims.TAI_USR_TEL", "'" & txtModUserContact.Text.Trim.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@TAI_ATTACH_DTL", "'" & fileUploadMod.FileName.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@TAI_ATTACH_DTL", "'" & fileUploadMod.FileName.Replace("'", "''") & "'")
SqlInsert = SqlInsert.Replace("@TAI_USR_NAME", "'" & txtModUserName.Text.Trim.Replace("'", "''") & "'") SqlInsert = SqlInsert.Replace("@TAI_USR_NAME", "'" & txtModUserName.Text.Trim.Replace("'", "''") & "'")
'<MOD|REM> '<MOD|REM>
SqlInsert = SqlInsert.Replace("@T_AIMS.TAI_ACN_TYP", "'" & Messages.AIMS_REMOVE_REQUEST_TAG & "'") SqlInsert = SqlInsert.Replace("@T_AIMS.TAI_ACN_TYP", "'" & Messages.AIMS_REMOVE_REQUEST_TAG & "'")
'</MOD|REM> '</MOD|REM>
''~~~~~~~~~Code & parameter to insert data in T_Approver~~Departmental~~~~~~~~~~~ ''~~~~~~~~~Code & parameter to insert data in T_Approver~~Departmental~~~~~~~~~~~
Dim SqlInsertSuperior As String = SqlQueries.INSERT_AIMS002_ADD_SUPERIOR Dim SqlInsertSuperior As String = SqlQueries.INSERT_AIMS002_ADD_SUPERIOR
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_PER_NO", "'" & strPerNo & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_PER_NO", "'" & strPerNo & "'")
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_EMAIL", "'" & strEmail & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_EMAIL", "'" & strEmail & "'")
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_STATUS", "'" & "P" & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_STATUS", "'" & "P" & "'")
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_DATE", "'" & "" & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_DATE", "'" & "" & "'")
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_REM", "'" & "" & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_REM", "'" & "" & "'")
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_APPV_TYP", "'" & "DA" & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_APPV_TYP", "'" & "DA" & "'")
SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_TAI_REF_NO", "'" & strRequestNumber & "'") SqlInsertSuperior = SqlInsertSuperior.Replace("@TAR_TAI_REF_NO", "'" & strRequestNumber & "'")
''~~~~~~~~~~~~~End ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ''~~~~~~~~~~~~~End ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
''~~~~~~~~~Code & parameter to insert data in T_Approver~~~~~IT~~~~~~~~ ''~~~~~~~~~Code & parameter to insert data in T_Approver~~~~~IT~~~~~~~~
Dim SqlInsertITApprover As String = SqlQueries.INSERT_AIMS002_ADD_SUPERIOR Dim SqlInsertITApprover As String = SqlQueries.INSERT_AIMS002_ADD_SUPERIOR
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_PER_NO", "'" & "" & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_PER_NO", "'" & "" & "'")
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_EMAIL", "'" & "" & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_EMAIL", "'" & "" & "'")
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_STATUS", "'" & "" & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_STATUS", "'" & "" & "'")
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_DATE", "'" & "" & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_DATE", "'" & "" & "'")
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_REM", "'" & "" & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_REM", "'" & "" & "'")
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_APPV_TYP", "'" & "IT" & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_APPV_TYP", "'" & "IT" & "'")
SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_TAI_REF_NO", "'" & strRequestNumber & "'") SqlInsertITApprover = SqlInsertITApprover.Replace("@TAR_TAI_REF_NO", "'" & strRequestNumber & "'")
''~~~~~~~~~~~~~End ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ''~~~~~~~~~~~~~End ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~~~~~Code & parameter to insert data in T_Approver~~~~~Executer~~~~~~~~ '~~~~~~~~~Code & parameter to insert data in T_Approver~~~~~Executer~~~~~~~~
Dim SqlInsertSMG As String = SqlQueries.INSERT_AIMS002_ADD_SUPERIOR Dim SqlInsertSMG As String = SqlQueries.INSERT_AIMS002_ADD_SUPERIOR
SqlInsertSMG = SqlInsertSMG.Replace("@TAR_PER_NO", "'" & "" & "'") SqlInsertSMG = SqlInsertSMG.Replace("@TAR_PER_NO", "'" & "" & "'")
SqlInsertSMG = SqlInsertSMG.Replace("@TAR_EMAIL", "'" & "" & "'") SqlInsertSMG = SqlInsertSMG.Replace("@TAR_EMAIL", "'" & "" & "'")
SqlInsertSMG = SqlInsertSMG.Replace("@TAR_STATUS", "'" & "" & "'") SqlInsertSMG = SqlInsertSMG.Replace("@TAR_STATUS", "'" & "" & "'")
SqlInsertSMG = SqlInsertSMG.Replace("@TAR_DATE", "'" & "" & "'") SqlInsertSMG = SqlInsertSMG.Replace("@TAR_DATE", "'" & "" & "'")
SqlInsertSMG = SqlInsertSMG.Replace("@TAR_REM", "'" & "" & "'") SqlInsertSMG