Imports AppGlobals
Imports AppGlobals.AppGlobal
Imports System.Data.SqlClient
Public Class frmLogin
#Region "Declaration Section"
Private Shared objfrmLogin As frmLogin
Private m_ObjDataAdaptor As SqlClient.SqlDataAdapter
Private m_ObjDataSet As New Data.DataSet()
Private objDBConnectPAR As New DbConnectPAR()
Private dsPARUserDetails As New Data.DataSet()
Public Shared m_PwdExpiryStatus As Boolean = False
Private m_objCommonFunction As New clsCommonFunction()
Private m_objGetMaster As New clsGetMaster()
Private m_dtmSrvDateTime As DateTime
Private m_lngTimerCntr As Int32 = 0
'Private objMutex As System.Threading.Mutex
#End Region
''.........Start -- ''' This Code Added By RamVinay Singh on 18 Dec 2012
#Region "Properties"
Public Shared Property m_Get_frmLogin() As frmLogin
Get
If objfrmLogin Is Nothing OrElse objfrmLogin.IsDisposed Then
objfrmLogin = New frmLogin()
End If
m_Get_frmLogin = objfrmLogin
End Get
Set(ByVal Value As frmLogin)
objfrmLogin = Value
End Set
End Property
''.........End --
#End Region
#Region "Form Object Procedures"
Private Sub frmLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'objMutex = New System.Threading.Mutex(False, "PM")
'If objMutex.WaitOne(0, False) = False Then
' objMutex.Close()
' objMutex = Nothing
' MessageBox.Show("Another instance is already running!")
' End
'End If
lblHeading.Visible = False
pbxRAMTeCH.Visible = False
Dim objclsGlobals As New clsGlobals
Dim DBStatus As Boolean = objclsGlobals.CheckDBSettings()
'Dim PARDBStatus As Boolean = objclsGlobals.CheckPARDBSettings()
If DBStatus = False Then
MsgBox("Connection with database failed.", MsgBoxStyle.Critical, Application.ProductName)
'Threading.Thread.Sleep(3000)
'CType(My.Application.SplashScreen, PMSplashScreen).CloseForm()
'If frmDBConfig.m_Get_frmDBConfig.fn_Initializeform() Then
' Cursor.Current = Cursors.Default
' If frmDBConfig.m_Get_frmDBConfig.ShowDialog() = Windows.Forms.DialogResult.Cancel Then
' Application.Exit()
' End If
'End If
End If
g_dtmSrvDateTime = m_objGetMaster.m_fnGetServerDateTime()
txtUserLoginId.Focus()
End Sub
Private Sub txtUserLoginId_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtUserLoginId.Enter
txtUserLoginId.SelectAll()
End Sub
Private Sub txtPwd_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPwd.Enter
txtPwd.SelectAll()
End Sub
Private Sub txtUserLoginId_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtUserLoginId.Validating
If String.IsNullOrEmpty(txtUserLoginId.Text) Then
PMErrorProvider.SetError(txtUserLoginId, "Enter Login Id!")
Else
PMErrorProvider.SetError(txtUserLoginId, "")
End If
End Sub
Private Sub txtPwd_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtPwd.Validating
If String.IsNullOrEmpty(txtPwd.Text) Then
PMErrorProvider.SetError(txtPwd, "Enter Password!")
Else
PMErrorProvider.SetError(txtPwd, "")
End If
End Sub
Private Sub cmdLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLogin.Click
Me.Cursor = Cursors.WaitCursor
'''' START This code added By Ramvinay Singh on 18 Dec 2012
Dim objAppUsers As New AppUsers.clsAppUsers()
Try
glbblnLogin_Succeed = False
If fnValidate_User_Login() = False Then
txtUserLoginId.SelectAll()
Else
m_ObjDataAdaptor = New SqlClient.SqlDataAdapter(objAppUsers.fnGet_Login_User_Data(txtUserLoginId.Text.ToString, txtPwd.Text.ToString))
m_ObjDataAdaptor.Fill(m_ObjDataSet)
If (m_ObjDataSet.Tables.Count > 0) Then
If (m_ObjDataSet.Tables(0).Rows.Count > 0) Then
glblngUser_Id = m_ObjDataSet.Tables(0).Rows(0).Item("User_Id")
glbstrUser_Login_Id = m_ObjDataSet.Tables(0).Rows(0).Item("User_login_Id").ToString
glbstrUser_Name = m_ObjDataSet.Tables(0).Rows(0).Item("User_Name").ToString
''' Coding by Ramvinay singh (very Happy New Year 2015-01-01)
'''''''''''' PAR User Details ......................
Dim sqlCmdPAR As New SqlCommand
Dim m_objDataAdapterPAR As New SqlDataAdapter
m_objDataAdapterPAR = New SqlClient.SqlDataAdapter()
objDBConnectPAR.OpenConnection()
sqlCmdPAR.Connection = objDBConnectPAR.GetConnection
sqlCmdPAR.CommandType = CommandType.StoredProcedure
sqlCmdPAR.CommandText = "spPRUserDetails"
sqlCmdPAR.Parameters.AddWithValue("@User_Login_Id", txtUserLoginId.Text)
sqlCmdPAR.Parameters.AddWithValue("@Flag", 2)
m_objDataAdapterPAR.SelectCommand = sqlCmdPAR
Try
m_objDataAdapterPAR = New SqlDataAdapter(sqlCmdPAR)
m_objDataAdapterPAR.Fill(dsPARUserDetails)
If (dsPARUserDetails.Tables.Count > 0) Then
If (dsPARUserDetails.Tables(0).Rows.Count > 0) Then
glbUserType = dsPARUserDetails.Tables(0).Rows(0).Item("UserType").ToString
End If
End If
Cursor.Current = Cursors.Default
Catch ex As Exception
Cursor.Current = Cursors.Default
MsgBox(ex.Message.ToString, MsgBoxStyle.Critical, g_strMessageCaption)
End Try
''End
g_frmAppMDIForm = PMMain.m_GetPMMain
PMMain.m_GetPMMain.WindowState = FormWindowState.Maximized
PMMain.m_GetPMMain.Show()
Me.Close()
End If
End If
'If fnValidate_User_Pwd_Expiry(txtUserLoginId.Text.Trim) = False Then
' glbblnLogin_Succeed = True
' m_ObjDataSet.Dispose()
' Dim frmMessageF As New frmMessage()
' If frmMessageF.fnInitialize_Form = True Then
' frmMessageF.ShowDialog()
' g_frmAppMDIForm = PMMain.m_GetPMMain
' PMMain.m_GetPMMain.WindowState = FormWindowState.Maximized
' PMMain.m_GetPMMain.Show()
' Me.Close()
' Else
' g_frmAppMDIForm = PMMain.m_GetPMMain
' PMMain.m_GetPMMain.WindowState = FormWindowState.Maximized
' PMMain.m_GetPMMain.Show()
' Me.Close()
' End If
'End If
End If
Catch ex As Exception
MsgBox(ex.Message.ToString, MsgBoxStyle.Critical, g_strMessageCaption)
Finally
If Not m_ObjDataAdaptor Is Nothing Then
m_ObjDataAdaptor.Dispose()
g_frmAppMDIForm = PMMain.m_GetPMMain
PMMain.m_GetPMMain.WindowState = FormWindowState.Maximized
PMMain.m_GetPMMain.Show()
Me.Close()
End If
End Try
Me.Cursor = Cursors.Default
'''END
'''' This Code Commented By Ramvinay Singh
'Dim objAppUsers As New AppUsers.clsAppUsers()
'Try
' If fnValidate_User_Login() = False Then Return
' m_ObjDataAdaptor = New SqlClient.SqlDataAdapter(objAppUsers.fnGet_Login_User_Data(txtUserLoginId.Text.ToString, txtPwd.Text.ToString))
' m_ObjDataAdaptor.Fill(m_ObjDataSet)
' glblngUser_Id = m_ObjDataSet.Tables(0).Rows(0).Item("User_Id")
' glbstrUser_Login_Id = m_ObjDataSet.Tables(0).Rows(0).Item("User_login_Id").ToString
' glbstrUser_Name = m_ObjDataSet.Tables(0).Rows(0).Item("User_Name").ToString
' If fnValidate_User_Pwd_Expiry(txtUserLoginId.Text.Trim) = False Then
' glbblnLogin_Succeed = True
' m_ObjDataSet.Dispose()
' g_frmAppMDIForm = PMMain.m_GetPMMain
' PMMain.m_GetPMMain.WindowState = FormWindowState.Maximized
' PMMain.m_GetPMMain.Show()
' Me.Close()
' End If
'Catch ex As Exception
' MsgBox(ex.Message.ToString, MsgBoxStyle.Critical, g_strMessageCaption)
'Finally
' If Not m_ObjDataAdaptor Is Nothing Then
' m_ObjDataAdaptor.Dispose()
' End If
'End Try
End Sub
Private Sub cmdExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExit.Click
contextmenuCloseMinimize.Show(cmdExit.Left + cmdExit.Width, cmdExit.Top - contextmenuCloseMinimize.Height)
'Application.Exit()
End Sub
#End Region
#Region "User Defined Function & Procedures"
Private Function fnValidate_User_Login() As Boolean
If String.IsNullOrEmpty(txtUserLoginId.Text) Then
PMErrorProvider.SetError(txtUserLoginId, "Enter Login Id!")
txtUserLoginId.Focus()
Return False
Else
PMErrorProvider.SetError(txtUserLoginId, "")
End If
If String.IsNullOrEmpty(txtPwd.Text) Then
PMErrorProvider.SetError(txtPwd, "Enter Password!")
txtPwd.Focus()
Return False
Else
PMErrorProvider.SetError(txtPwd, "")
End If
Dim objAppUsers As New AppUsers.clsAppUsers()
Dim lngResult As Long
lngResult = objAppUsers.fnValidate_User_Login(txtUserLoginId.Text.ToString, txtPwd.Text.ToString)
If lngResult = AppEnums.enumAppUserErrors.eInvalidLoginId Then
MsgBox("Invalid user login id.", MsgBoxStyle.Exclamation, g_strMessageCaption)
txtUserLoginId.Focus()
Return False
ElseIf lngResult = AppEnums.enumAppUserErrors.eInvalidPwd Then
MsgBox("Invalid user password.", MsgBoxStyle.Exclamation, g_strMessageCaption)
txtPwd.Focus()
Return False
ElseIf lngResult = AppEnums.enumAppUserErrors.eUserInactive Then
MsgBox("User is no longer ACTIVE. Please contact your system administrator for details.", MsgBoxStyle.Exclamation, g_strMessageCaption)
Return False
ElseIf lngResult = AppEnums.enumAppUserErrors.eUserLocked Then
MsgBox("User is LOCKED. Please contact your system administrator for details.", MsgBoxStyle.Exclamation, g_strMessageCaption)
Return False
End If
Return True
End Function
'Private Function fnValidate_User_Pwd_Expiry(ByVal InStrUserLoginId As String) As Boolean
' Dim objDataSet As New Data.DataSet()
' Dim objDataAdapter As SqlClient.SqlDataAdapter = Nothing
' Dim objClsPassword As New clsPassword()
' Dim objclsAdmin_Config As New AppUsers.clsAdmin_Config()
' Dim dtPwdChangedDate As Date
' Dim dtCurrentDate As Date
' Dim intDaysDiff As Int16
' Dim intPwdExpPeriod As Int16
' Dim intPwdRemPeriod As Int16
' Dim intPwdExpDiff As Int16
' Dim intPwdRemDiff As Int16
' Try
' objDataSet.Clear()
' objDataAdapter = New SqlClient.SqlDataAdapter(objclsAdmin_Config.m_fnGet_Data(3))
' objDataAdapter.Fill(objDataSet, "AdminConfig")
' If objDataSet.Tables("AdminConfig").Rows.Count > 0 Then
' intPwdExpPeriod = Val(objDataSet.Tables("AdminConfig").Rows(0).Item("Pwd_Expiry_Period") & "")
' intPwdRemPeriod = Val(objDataSet.Tables("AdminConfig").Rows(0).Item("Pwd_Expiry_Reminder_Period") & "")
' End If
' If intPwdExpPeriod > 0 Then
' objDataSet.Clear()
' objDataAdapter = New SqlClient.SqlDataAdapter(objClsPassword.m_fnGet_User_Name(InStrUserLoginId, 3))
' objDataAdapter.Fill(objDataSet, "UserPwd")
' If objDataSet.Tables("UserPwd").Rows.Count > 0 Then
' If Not objDataSet.Tables("UserPwd").Rows(0).Item("Pwd_Changed_Date") & "" = "" Then
' dtPwdChangedDate = Format(objDataSet.Tables("UserPwd").Rows(0).Item("Pwd_Changed_Date"), "Short Date")
' dtCurrentDate = Format(Now(), "Short Date")
' intDaysDiff = DateDiff(DateInterval.Day, dtPwdChangedDate, dtCurrentDate)
' Else
' Return False
' End If
' Else
' Return False
' End If
' 'intPwdExpDiff = intDaysDiff - intPwdExpPeriod
' 'If intPwdExpDiff > 0 Then
' ' MsgBox("Your password has expired " & vbCrLf & "Please change password now.", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, g_strMessageCaption)
' ' m_PwdExpiryStatus = True
' ' Cursor.Current = Cursors.WaitCursor
' ' Dim frmSetPasswordF As New frmSetPassword()
' ' Cursor.Current = Cursors.Default
' ' If frmSetPasswordF.fnInitialize_Form = True Then
' ' frmSetPasswordF.ShowDialog()
' ' End If
' ' Return True
' 'End If
' 'If intPwdRemPeriod > 0 Then
' ' intPwdRemDiff = intDaysDiff - (intPwdExpPeriod - intPwdRemPeriod)
' ' If intPwdRemDiff > 0 Then
' ' 'If (intPwdRemPeriod - intPwdRemDiff) = 0 Then
' ' ' If MsgBox("Your password will expire today " & vbCrLf & "Do you want to change password now?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, g_strMessageCaption) = MsgBoxResult.Yes Then
' ' ' m_PwdExpiryStatus = False
' ' ' Cursor.Current = Cursors.WaitCursor
' ' ' Dim frmSetPasswordF As New frmSetPassword()
' ' ' Cursor.Current = Cursors.Default
' ' ' If frmSetPasswordF.fnInitialize_Form = True Then
' ' ' frmSetPasswordF.ShowDialog()
' ' ' End If
' ' ' Return False
' ' ' End If
' ' 'ElseIf (intPwdRemPeriod - intPwdRemDiff) > 0 Then
' ' ' If MsgBox("Your password will expire after " & (intPwdRemPeriod - intPwdRemDiff) & " day(s)" & vbCrLf & "Do you want to change password now?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, g_strMessageCaption) = MsgBoxResult.Yes Then
' ' ' m_PwdExpiryStatus = False
' ' ' Cursor.Current = Cursors.WaitCursor
' ' ' Dim frmSetPasswordF As New frmSetPassword()
' ' ' Cursor.Current = Cursors.Default
' ' ' If frmSetPasswordF.fnInitialize_Form = True Then
' ' ' frmSetPasswordF.ShowDialog()
' ' ' End If
' ' ' Return False
' ' ' End If
' ' 'End If
' ' End If
' 'End If
' End If
' m_PwdExpiryStatus = False
' Return False
' Catch ex As Exception
' MsgBox(ex.Message.ToString, MsgBoxStyle.Critical, g_strMessageCaption)
' Finally
' objDataAdapter.Dispose()
' objDataSet.Dispose()
' objClsPassword = Nothing
' objclsAdmin_Config = Nothing
' End Try
'End Function
#End Region
Private Sub frmLogin_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize
panelMain.Top = 0
panelMain.Left = 0
panelMain.Width = Me.Width
panelMain.Height = Me.Height
panelHeader.Top = 0
panelHeader.Left = 0
panelHeader.Width = panelMain.Width
lblHeading.Top = (panelHeader.Height - lblHeading.Height) / 2
lblHeading.Left = (panelMain.Width - lblHeading.Width) / 2
Label4.Left = 460
pbxProjMgr.Left = 460
pbxRAMTeCH.Left = panelHeader.Width - pbxRAMTeCH.Width - 10
panelLoginBox.Left = (panelMain.Width - panelLoginBox.Width) / 2
panelLoginBox.Top = (panelMain.Height - panelLoginBox.Height) / 2
cmdExit.Left = 25
cmdExit.Top = panelMain.Height - cmdExit.Height - 25
End Sub
Private Sub objTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles objTimer.Tick
If m_lngTimerCntr >= 3600 Then
g_dtmSrvDateTime = m_objGetMaster.m_fnGetServerDateTime()
m_lngTimerCntr = 0
g_dtmSrvDateTime = m_objGetMaster.m_fnGetServerDateTime()
Else
g_dtmSrvDateTime = g_dtmSrvDateTime.AddSeconds(1)
End If
m_lngTimerCntr += 1
lblHeading.Text = Format(g_dtmSrvDateTime, "dddd, MMMM d, yyyy") & vbNewLine & Format(g_dtmSrvDateTime, "HH:mm:ss")
End Sub
Private Sub menuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuExit.Click
Application.Exit()
End Sub
Private Sub menuMinimize_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuMinimize.Click
Me.WindowState = FormWindowState.Minimized
End Sub
End Class
Imports AppGlobals.AppGlobal
Imports System.Data.SqlClient
Public Class frmLogin
#Region "Declaration Section"
Private Shared objfrmLogin As frmLogin
Private m_ObjDataAdaptor As SqlClient.SqlDataAdapter
Private m_ObjDataSet As New Data.DataSet()
Private objDBConnectPAR As New DbConnectPAR()
Private dsPARUserDetails As New Data.DataSet()
Public Shared m_PwdExpiryStatus As Boolean = False
Private m_objCommonFunction As New clsCommonFunction()
Private m_objGetMaster As New clsGetMaster()
Private m_dtmSrvDateTime As DateTime
Private m_lngTimerCntr As Int32 = 0
'Private objMutex As System.Threading.Mutex
#End Region
''.........Start -- ''' This Code Added By RamVinay Singh on 18 Dec 2012
#Region "Properties"
Public Shared Property m_Get_frmLogin() As frmLogin
Get
If objfrmLogin Is Nothing OrElse objfrmLogin.IsDisposed Then
objfrmLogin = New frmLogin()
End If
m_Get_frmLogin = objfrmLogin
End Get
Set(ByVal Value As frmLogin)
objfrmLogin = Value
End Set
End Property
''.........End --
#End Region
#Region "Form Object Procedures"
Private Sub frmLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'objMutex = New System.Threading.Mutex(False, "PM")
'If objMutex.WaitOne(0, False) = False Then
' objMutex.Close()
' objMutex = Nothing
' MessageBox.Show("Another instance is already running!")
' End
'End If
lblHeading.Visible = False
pbxRAMTeCH.Visible = False
Dim objclsGlobals As New clsGlobals
Dim DBStatus As Boolean = objclsGlobals.CheckDBSettings()
'Dim PARDBStatus As Boolean = objclsGlobals.CheckPARDBSettings()
If DBStatus = False Then
MsgBox("Connection with database failed.", MsgBoxStyle.Critical, Application.ProductName)
'Threading.Thread.Sleep(3000)
'CType(My.Application.SplashScreen, PMSplashScreen).CloseForm()
'If frmDBConfig.m_Get_frmDBConfig.fn_Initializeform() Then
' Cursor.Current = Cursors.Default
' If frmDBConfig.m_Get_frmDBConfig.ShowDialog() = Windows.Forms.DialogResult.Cancel Then
' Application.Exit()
' End If
'End If
End If
g_dtmSrvDateTime = m_objGetMaster.m_fnGetServerDateTime()
txtUserLoginId.Focus()
End Sub
Private Sub txtUserLoginId_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtUserLoginId.Enter
txtUserLoginId.SelectAll()
End Sub
Private Sub txtPwd_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPwd.Enter
txtPwd.SelectAll()
End Sub
Private Sub txtUserLoginId_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtUserLoginId.Validating
If String.IsNullOrEmpty(txtUserLoginId.Text) Then
PMErrorProvider.SetError(txtUserLoginId, "Enter Login Id!")
Else
PMErrorProvider.SetError(txtUserLoginId, "")
End If
End Sub
Private Sub txtPwd_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtPwd.Validating
If String.IsNullOrEmpty(txtPwd.Text) Then
PMErrorProvider.SetError(txtPwd, "Enter Password!")
Else
PMErrorProvider.SetError(txtPwd, "")
End If
End Sub
Private Sub cmdLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLogin.Click
Me.Cursor = Cursors.WaitCursor
'''' START This code added By Ramvinay Singh on 18 Dec 2012
Dim objAppUsers As New AppUsers.clsAppUsers()
Try
glbblnLogin_Succeed = False
If fnValidate_User_Login() = False Then
txtUserLoginId.SelectAll()
Else
m_ObjDataAdaptor = New SqlClient.SqlDataAdapter(objAppUsers.fnGet_Login_User_Data(txtUserLoginId.Text.ToString, txtPwd.Text.ToString))
m_ObjDataAdaptor.Fill(m_ObjDataSet)
If (m_ObjDataSet.Tables.Count > 0) Then
If (m_ObjDataSet.Tables(0).Rows.Count > 0) Then
glblngUser_Id = m_ObjDataSet.Tables(0).Rows(0).Item("User_Id")
glbstrUser_Login_Id = m_ObjDataSet.Tables(0).Rows(0).Item("User_login_Id").ToString
glbstrUser_Name = m_ObjDataSet.Tables(0).Rows(0).Item("User_Name").ToString
''' Coding by Ramvinay singh (very Happy New Year 2015-01-01)
'''''''''''' PAR User Details ......................
Dim sqlCmdPAR As New SqlCommand
Dim m_objDataAdapterPAR As New SqlDataAdapter
m_objDataAdapterPAR = New SqlClient.SqlDataAdapter()
objDBConnectPAR.OpenConnection()
sqlCmdPAR.Connection = objDBConnectPAR.GetConnection
sqlCmdPAR.CommandType = CommandType.StoredProcedure
sqlCmdPAR.CommandText = "spPRUserDetails"
sqlCmdPAR.Parameters.AddWithValue("@User_Login_Id", txtUserLoginId.Text)
sqlCmdPAR.Parameters.AddWithValue("@Flag", 2)
m_objDataAdapterPAR.SelectCommand = sqlCmdPAR
Try
m_objDataAdapterPAR = New SqlDataAdapter(sqlCmdPAR)
m_objDataAdapterPAR.Fill(dsPARUserDetails)
If (dsPARUserDetails.Tables.Count > 0) Then
If (dsPARUserDetails.Tables(0).Rows.Count > 0) Then
glbUserType = dsPARUserDetails.Tables(0).Rows(0).Item("UserType").ToString
End If
End If
Cursor.Current = Cursors.Default
Catch ex As Exception
Cursor.Current = Cursors.Default
MsgBox(ex.Message.ToString, MsgBoxStyle.Critical, g_strMessageCaption)
End Try
''End
g_frmAppMDIForm = PMMain.m_GetPMMain
PMMain.m_GetPMMain.WindowState = FormWindowState.Maximized
PMMain.m_GetPMMain.Show()
Me.Close()
End If
End If
'If fnValidate_User_Pwd_Expiry(txtUserLoginId.Text.Trim) = False Then
' glbblnLogin_Succeed = True
' m_ObjDataSet.Dispose()
' Dim frmMessageF As New frmMessage()
' If frmMessageF.fnInitialize_Form = True Then
' frmMessageF.ShowDialog()
' g_frmAppMDIForm = PMMain.m_GetPMMain
' PMMain.m_GetPMMain.WindowState = FormWindowState.Maximized
' PMMain.m_GetPMMain.Show()
' Me.Close()
' Else
' g_frmAppMDIForm = PMMain.m_GetPMMain
' PMMain.m_GetPMMain.WindowState = FormWindowState.Maximized
' PMMain.m_GetPMMain.Show()
' Me.Close()
' End If
'End If
End If
Catch ex As Exception
MsgBox(ex.Message.ToString, MsgBoxStyle.Critical, g_strMessageCaption)
Finally
If Not m_ObjDataAdaptor Is Nothing Then
m_ObjDataAdaptor.Dispose()
g_frmAppMDIForm = PMMain.m_GetPMMain
PMMain.m_GetPMMain.WindowState = FormWindowState.Maximized
PMMain.m_GetPMMain.Show()
Me.Close()
End If
End Try
Me.Cursor = Cursors.Default
'''END
'''' This Code Commented By Ramvinay Singh
'Dim objAppUsers As New AppUsers.clsAppUsers()
'Try
' If fnValidate_User_Login() = False Then Return
' m_ObjDataAdaptor = New SqlClient.SqlDataAdapter(objAppUsers.fnGet_Login_User_Data(txtUserLoginId.Text.ToString, txtPwd.Text.ToString))
' m_ObjDataAdaptor.Fill(m_ObjDataSet)
' glblngUser_Id = m_ObjDataSet.Tables(0).Rows(0).Item("User_Id")
' glbstrUser_Login_Id = m_ObjDataSet.Tables(0).Rows(0).Item("User_login_Id").ToString
' glbstrUser_Name = m_ObjDataSet.Tables(0).Rows(0).Item("User_Name").ToString
' If fnValidate_User_Pwd_Expiry(txtUserLoginId.Text.Trim) = False Then
' glbblnLogin_Succeed = True
' m_ObjDataSet.Dispose()
' g_frmAppMDIForm = PMMain.m_GetPMMain
' PMMain.m_GetPMMain.WindowState = FormWindowState.Maximized
' PMMain.m_GetPMMain.Show()
' Me.Close()
' End If
'Catch ex As Exception
' MsgBox(ex.Message.ToString, MsgBoxStyle.Critical, g_strMessageCaption)
'Finally
' If Not m_ObjDataAdaptor Is Nothing Then
' m_ObjDataAdaptor.Dispose()
' End If
'End Try
End Sub
Private Sub cmdExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExit.Click
contextmenuCloseMinimize.Show(cmdExit.Left + cmdExit.Width, cmdExit.Top - contextmenuCloseMinimize.Height)
'Application.Exit()
End Sub
#End Region
#Region "User Defined Function & Procedures"
Private Function fnValidate_User_Login() As Boolean
If String.IsNullOrEmpty(txtUserLoginId.Text) Then
PMErrorProvider.SetError(txtUserLoginId, "Enter Login Id!")
txtUserLoginId.Focus()
Return False
Else
PMErrorProvider.SetError(txtUserLoginId, "")
End If
If String.IsNullOrEmpty(txtPwd.Text) Then
PMErrorProvider.SetError(txtPwd, "Enter Password!")
txtPwd.Focus()
Return False
Else
PMErrorProvider.SetError(txtPwd, "")
End If
Dim objAppUsers As New AppUsers.clsAppUsers()
Dim lngResult As Long
lngResult = objAppUsers.fnValidate_User_Login(txtUserLoginId.Text.ToString, txtPwd.Text.ToString)
If lngResult = AppEnums.enumAppUserErrors.eInvalidLoginId Then
MsgBox("Invalid user login id.", MsgBoxStyle.Exclamation, g_strMessageCaption)
txtUserLoginId.Focus()
Return False
ElseIf lngResult = AppEnums.enumAppUserErrors.eInvalidPwd Then
MsgBox("Invalid user password.", MsgBoxStyle.Exclamation, g_strMessageCaption)
txtPwd.Focus()
Return False
ElseIf lngResult = AppEnums.enumAppUserErrors.eUserInactive Then
MsgBox("User is no longer ACTIVE. Please contact your system administrator for details.", MsgBoxStyle.Exclamation, g_strMessageCaption)
Return False
ElseIf lngResult = AppEnums.enumAppUserErrors.eUserLocked Then
MsgBox("User is LOCKED. Please contact your system administrator for details.", MsgBoxStyle.Exclamation, g_strMessageCaption)
Return False
End If
Return True
End Function
'Private Function fnValidate_User_Pwd_Expiry(ByVal InStrUserLoginId As String) As Boolean
' Dim objDataSet As New Data.DataSet()
' Dim objDataAdapter As SqlClient.SqlDataAdapter = Nothing
' Dim objClsPassword As New clsPassword()
' Dim objclsAdmin_Config As New AppUsers.clsAdmin_Config()
' Dim dtPwdChangedDate As Date
' Dim dtCurrentDate As Date
' Dim intDaysDiff As Int16
' Dim intPwdExpPeriod As Int16
' Dim intPwdRemPeriod As Int16
' Dim intPwdExpDiff As Int16
' Dim intPwdRemDiff As Int16
' Try
' objDataSet.Clear()
' objDataAdapter = New SqlClient.SqlDataAdapter(objclsAdmin_Config.m_fnGet_Data(3))
' objDataAdapter.Fill(objDataSet, "AdminConfig")
' If objDataSet.Tables("AdminConfig").Rows.Count > 0 Then
' intPwdExpPeriod = Val(objDataSet.Tables("AdminConfig").Rows(0).Item("Pwd_Expiry_Period") & "")
' intPwdRemPeriod = Val(objDataSet.Tables("AdminConfig").Rows(0).Item("Pwd_Expiry_Reminder_Period") & "")
' End If
' If intPwdExpPeriod > 0 Then
' objDataSet.Clear()
' objDataAdapter = New SqlClient.SqlDataAdapter(objClsPassword.m_fnGet_User_Name(InStrUserLoginId, 3))
' objDataAdapter.Fill(objDataSet, "UserPwd")
' If objDataSet.Tables("UserPwd").Rows.Count > 0 Then
' If Not objDataSet.Tables("UserPwd").Rows(0).Item("Pwd_Changed_Date") & "" = "" Then
' dtPwdChangedDate = Format(objDataSet.Tables("UserPwd").Rows(0).Item("Pwd_Changed_Date"), "Short Date")
' dtCurrentDate = Format(Now(), "Short Date")
' intDaysDiff = DateDiff(DateInterval.Day, dtPwdChangedDate, dtCurrentDate)
' Else
' Return False
' End If
' Else
' Return False
' End If
' 'intPwdExpDiff = intDaysDiff - intPwdExpPeriod
' 'If intPwdExpDiff > 0 Then
' ' MsgBox("Your password has expired " & vbCrLf & "Please change password now.", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, g_strMessageCaption)
' ' m_PwdExpiryStatus = True
' ' Cursor.Current = Cursors.WaitCursor
' ' Dim frmSetPasswordF As New frmSetPassword()
' ' Cursor.Current = Cursors.Default
' ' If frmSetPasswordF.fnInitialize_Form = True Then
' ' frmSetPasswordF.ShowDialog()
' ' End If
' ' Return True
' 'End If
' 'If intPwdRemPeriod > 0 Then
' ' intPwdRemDiff = intDaysDiff - (intPwdExpPeriod - intPwdRemPeriod)
' ' If intPwdRemDiff > 0 Then
' ' 'If (intPwdRemPeriod - intPwdRemDiff) = 0 Then
' ' ' If MsgBox("Your password will expire today " & vbCrLf & "Do you want to change password now?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, g_strMessageCaption) = MsgBoxResult.Yes Then
' ' ' m_PwdExpiryStatus = False
' ' ' Cursor.Current = Cursors.WaitCursor
' ' ' Dim frmSetPasswordF As New frmSetPassword()
' ' ' Cursor.Current = Cursors.Default
' ' ' If frmSetPasswordF.fnInitialize_Form = True Then
' ' ' frmSetPasswordF.ShowDialog()
' ' ' End If
' ' ' Return False
' ' ' End If
' ' 'ElseIf (intPwdRemPeriod - intPwdRemDiff) > 0 Then
' ' ' If MsgBox("Your password will expire after " & (intPwdRemPeriod - intPwdRemDiff) & " day(s)" & vbCrLf & "Do you want to change password now?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, g_strMessageCaption) = MsgBoxResult.Yes Then
' ' ' m_PwdExpiryStatus = False
' ' ' Cursor.Current = Cursors.WaitCursor
' ' ' Dim frmSetPasswordF As New frmSetPassword()
' ' ' Cursor.Current = Cursors.Default
' ' ' If frmSetPasswordF.fnInitialize_Form = True Then
' ' ' frmSetPasswordF.ShowDialog()
' ' ' End If
' ' ' Return False
' ' ' End If
' ' 'End If
' ' End If
' 'End If
' End If
' m_PwdExpiryStatus = False
' Return False
' Catch ex As Exception
' MsgBox(ex.Message.ToString, MsgBoxStyle.Critical, g_strMessageCaption)
' Finally
' objDataAdapter.Dispose()
' objDataSet.Dispose()
' objClsPassword = Nothing
' objclsAdmin_Config = Nothing
' End Try
'End Function
#End Region
Private Sub frmLogin_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize
panelMain.Top = 0
panelMain.Left = 0
panelMain.Width = Me.Width
panelMain.Height = Me.Height
panelHeader.Top = 0
panelHeader.Left = 0
panelHeader.Width = panelMain.Width
lblHeading.Top = (panelHeader.Height - lblHeading.Height) / 2
lblHeading.Left = (panelMain.Width - lblHeading.Width) / 2
Label4.Left = 460
pbxProjMgr.Left = 460
pbxRAMTeCH.Left = panelHeader.Width - pbxRAMTeCH.Width - 10
panelLoginBox.Left = (panelMain.Width - panelLoginBox.Width) / 2
panelLoginBox.Top = (panelMain.Height - panelLoginBox.Height) / 2
cmdExit.Left = 25
cmdExit.Top = panelMain.Height - cmdExit.Height - 25
End Sub
Private Sub objTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles objTimer.Tick
If m_lngTimerCntr >= 3600 Then
g_dtmSrvDateTime = m_objGetMaster.m_fnGetServerDateTime()
m_lngTimerCntr = 0
g_dtmSrvDateTime = m_objGetMaster.m_fnGetServerDateTime()
Else
g_dtmSrvDateTime = g_dtmSrvDateTime.AddSeconds(1)
End If
m_lngTimerCntr += 1
lblHeading.Text = Format(g_dtmSrvDateTime, "dddd, MMMM d, yyyy") & vbNewLine & Format(g_dtmSrvDateTime, "HH:mm:ss")
End Sub
Private Sub menuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuExit.Click
Application.Exit()
End Sub
Private Sub menuMinimize_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuMinimize.Click
Me.WindowState = FormWindowState.Minimized
End Sub
End Class