Untitled diff
0 removals
556 lines
0 additions
556 lines
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
El
El