June 16, 2011 at 10:39 am
Imports System.Data.Odbc
Imports System.Text
Public Class EMS
Inherits System.Web.UI.MasterPage
Dim objcmnfunctions As New cmnfunctions
Dim objdbconn As New dbconn
Dim lsMenuItem As String
Dim lsModule_GID As String
Dim ds_tModule As DataSet
Dim objTbl As DataTable
Dim objRow As DataRow
Dim msSQL As String
Dim lstop_Parent As String
Dim lsCount As String
Dim lsModuleName As String
Dim i, j As Integer
Dim msSQL2 As String
Dim objOdbcDataReader, objOdbcDataReader2, objOdbcDataReader3 As OdbcDataReader
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim strStringBuilder As New StringBuilder("")
If Session("User_Code") = "" Then
Response.Redirect("../presentation/login.aspx?msgcode=ERR_001")
Exit Sub
End If
logo.Src = "Handler1.ashx?id=WT"
logo.Width = "150"
logo.Height = "56"
objdbconn.OpenConn()
msSQL = " SELECT count(*) as count FROM " & _
" adm_mst_tusergroup b, adm_mst_tprivilege c, adm_mst_tmodule d WHERE " & _
" d.module_gid = c.module_gid AND " & _
" b.usergroup_gid = c.usergroup_gid AND " & _
" c.usergroup_gid = '" & Session("UserGroup_GID") & "' and " & _
" d.module_gid_parent = '$' and d.status = '1' order by display_order "
objOdbcDataReader = objdbconn.GetDataReader(msSQL)
If objOdbcDataReader.HasRows = True Then
objOdbcDataReader.Read()
lsCount = objOdbcDataReader.Item("count") & ""
End If
'---------- Strat of First Order Level Menus ----------------------------------------------------
lstop_Parent = ""
msSQL = " SELECT distinct d.module_gid, d.module_name, d.module_code, d.module_link, d.module_gid_parent,d.display_order " & _
" FROM adm_mst_tusergroup b, adm_mst_tprivilege c, adm_mst_tmodule d WHERE " & _
" d.module_gid = c.module_gid AND " & _
" b.usergroup_gid = c.usergroup_gid AND " & _
" c.usergroup_gid = '" & Session("UserGroup_GID") & "' and " & _
" d.module_gid_parent = '$' and d.status = '1' order by display_order "
objOdbcDataReader = objdbconn.GetDataReader(msSQL)
If objOdbcDataReader.HasRows = True Then
panel_menu.Controls.Add(New LiteralControl(strStringBuilder.ToString))
strStringBuilder.Remove(0, strStringBuilder.Length)
strStringBuilder.Append("<table width=91% border=0 cellpadding=0 cellspacing=0 bgcolor=#365786><tr align=right><td><img src=../images/menu_spacer.gif alt=spacer width=2 height=29 /></td>")
While objOdbcDataReader.Read
strStringBuilder.Append("<td width=""75"" align=center><a id=""" & objOdbcDataReader.Item("module_code") & """")
strStringBuilder.Append(" class=""menu_txt""")
strStringBuilder.Append("href=" & objOdbcDataReader.Item("module_link") & ">")
strStringBuilder.Append(objOdbcDataReader.Item("module_name") & "</a></td><td width=1% valign=bottom class=menu_txt><img src=../images/menu_div.gif alt=divider width=8 height=6 /></td>")
panel_menu.Controls.Add(New LiteralControl(strStringBuilder.ToString))
strStringBuilder.Remove(0, strStringBuilder.Length)
If objOdbcDataReader.Item("module_code") = Left(Session("gsmodule_code"), 2) Then
lstop_Parent = objOdbcDataReader.Item("module_gid")
End If
End While
strStringBuilder.Append("<td width=""75"" align=center><a class=""menu_txt"" href = ../presentation/logout.aspx>LOGOUT</a></td></tr></table>")
panel_menu.Controls.Add(New LiteralControl(strStringBuilder.ToString))
strStringBuilder.Remove(0, strStringBuilder.Length)
End If
objOdbcDataReader.Close()
'---------- Strat of Second Order Level Menus ----------------------------------------------------
'If Not Page.IsPostBack Then
strStringBuilder.Append("<table width=""100%""><tr><td><div id=""float-Menu""><ul>")
msSQL = " select distinct d.module_gid, d.module_name, d.module_code, d.module_link, d.module_gid_parent, d.display_order " & _
" FROM adm_mst_tusergroup b, adm_mst_tprivilege c, adm_mst_tmodule d where " & _
" d.module_gid = c.module_gid AND " & _
" b.usergroup_gid = c.usergroup_gid AND " & _
" c.usergroup_gid = '" & Session("UserGroup_GID") & "' and " & _
" d.module_gid_parent = '" & lstop_Parent & "' and d.status = '1' order by display_order "
ds_tModule = objdbconn.GetDataSet(msSQL, "adm_mst_tmodule")
If ds_tModule.Tables("adm_mst_tmodule").Rows.Count <> "0" Then
objTbl = ds_tModule.Tables("adm_mst_tmodule")
For Each objRow In objTbl.Rows
i = i + 1
If i <> 1 Then
strStringBuilder.Append("<li class=""glossymenu""> | </li>")
End If
lsMenuItem = objRow.Item("module_name")
lsModule_GID = objRow.Item("module_gid")
strStringBuilder.Append("<li class=""glossymenu"">")
If CurrentMenu(Mid(Session("gsmodule_code"), 3, 2)) = objRow.Item("module_name") Then
If i <> 1 Then
'strStringBuilder.Append("<img src=""../images/DIV_BLUE.gif"" alt=""DIVIDER"" width=""13"" height=""24"" />")
End If
strStringBuilder.Append("<a class=""summary_lable_txt"" href=" & objRow.Item("module_link") & ">" & objRow.Item("module_name") & "</a>")
Else
If i <> 1 Then
'strStringBuilder.Append("<img src=""../images/DIV_WHITE.gif"" alt=""DIVIDER"" width=""13"" height=""24"" />")
End If
strStringBuilder.Append("<a class=""summary_head_red"" href=" & objRow.Item("module_link") & ">" & objRow.Item("module_name") & "</a>")
End If
'---------- Strat of Third Order Level Menus Heading ----------------------------------------------------
strStringBuilder.Append("<div id=""float-Menu-Container"">")
msSQL2 = " select distinct d.group_type " & _
" FROM adm_mst_tusergroup b, adm_mst_tprivilege c, adm_mst_tmodule d " & _
" where(d.module_gid = c.module_gid And b.usergroup_gid = c.usergroup_gid) " & _
" AND c.usergroup_gid = '" & Session("UserGroup_GID") & "' and d.module_gid_parent = '" & lsModule_GID & "'" & _
" and d.group_type <> '' and d.status = '1' " & _
" order by display_order "
objOdbcDataReader3 = objdbconn.GetDataReader(msSQL2)
If objOdbcDataReader3.HasRows = True Then
While objOdbcDataReader3.Read
strStringBuilder.Append("<div class=""licol""><ul>")
strStringBuilder.Append("<li class=""lititle""><h4>" & objOdbcDataReader3.Item("group_type") & "</h4></li>")
'---------- Strat of Third Order Level Menus ----------------------------------------------------
msSQL2 = " select distinct d.module_gid, d.module_name, d.module_code, d.module_link, d.module_gid_parent, d.display_order " & _
" FROM adm_mst_tusergroup b, adm_mst_tprivilege c, adm_mst_tmodule d where " & _
" d.module_gid = c.module_gid AND " & _
" b.usergroup_gid = c.usergroup_gid AND " & _
" c.usergroup_gid = '" & Session("UserGroup_GID") & "' and " & _
" d.module_gid_parent = '" & lsModule_GID & "' and d.group_type='" & objOdbcDataReader3.Item("group_type") & "' and d.status = '1' order by display_order "
objOdbcDataReader2 = objdbconn.GetDataReader(msSQL2)
If objOdbcDataReader2.HasRows = True Then
While objOdbcDataReader2.Read
strStringBuilder.Append("<li><a class=""text-decoration"" id=""" & objOdbcDataReader2.Item("module_code") & """")
strStringBuilder.Append(" href='" & objOdbcDataReader2.Item("module_link") & "'>")
strStringBuilder.Append(objOdbcDataReader2.Item("module_name"))
strStringBuilder.Append("</a></li><li class=separator></li>")
End While
strStringBuilder.Append("</ul></div>")
End If
End While
Else
msSQL2 = " select distinct d.module_gid, d.module_name, d.module_code, d.module_link, d.module_gid_parent, d.display_order " & _
" FROM adm_mst_tusergroup b, adm_mst_tprivilege c, adm_mst_tmodule d where " & _
" d.module_gid = c.module_gid AND " & _
" b.usergroup_gid = c.usergroup_gid AND " & _
" c.usergroup_gid = '" & Session("UserGroup_GID") & "' and " & _
" d.module_gid_parent = '" & lsModule_GID & "' and d.status = '1' order by display_order "
objOdbcDataReader2 = objdbconn.GetDataReader(msSQL2)
If objOdbcDataReader2.HasRows = True Then
strStringBuilder.Append("<div class=""licol""><ul>")
While objOdbcDataReader2.Read
strStringBuilder.Append("<li><a class=""text-decoration"" id=""" & objOdbcDataReader2.Item("module_code") & """")
strStringBuilder.Append(" href='" & objOdbcDataReader2.Item("module_link") & "'>")
strStringBuilder.Append(objOdbcDataReader2.Item("module_name"))
strStringBuilder.Append("</a></li>")
End While
strStringBuilder.Append("</ul></div>")
End If
End If
strStringBuilder.Append("</div>")
strStringBuilder.Append("</li>")
Next
End If
strStringBuilder.Append("</ul></div>")
strStringBuilder.Append("</td></tr></table>")
panel_submenu.Controls.Add(New LiteralControl(strStringBuilder.ToString))
strStringBuilder.Remove(0, strStringBuilder.Length)
msSQL = " Select user_gid, concat(user_firstname ,' ', user_lastname) as user_name " & _
" from adm_mst_tuser " & _
" where user_gid = '" & Session("User_GID") & "'"
objOdbcDataReader = objdbconn.GetDataReader(msSQL)
If objOdbcDataReader.HasRows = True Then
objOdbcDataReader.Read()
lblUSER.Text = objOdbcDataReader.Item("user_name").ToString
lblDATE.Text = Format(Now(), "dd-MM-yyyy")
lblTIME.Text = Format(Now(), "HH:mm:ss")
End If
objdbconn.CloseConn()
End Sub
Function CurrentMenu(ByVal lsMenuCode As String)
lsModuleName = ""
msSQL = " SELECT module_name FROM adm_mst_tmodule " & _
" WHERE module_code = '" & lsMenuCode & "' "
objOdbcDataReader = objdbconn.GetDataReader(msSQL)
If objOdbcDataReader.HasRows = True Then
objOdbcDataReader.Read()
lsModuleName = objOdbcDataReader.Item("module_name")
End If
Return lsModuleName
End Function
End Class
June 16, 2011 at 10:40 am
So whats the question? The problem? What you are trying to solve?
CEWII
June 16, 2011 at 12:43 pm
This is a repeat posted more than once!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply