﻿'NOTES:
'
'v1.2.8a - 20091006 - added chkUseQF for the current month
'v1.2.8b - 20091006 - added Pivot Export
'v1.2.8c - 20091006 - added Varietal and Category filters
'v1.2.9  - 20130114 - changed All Products (9L) view to use OpeningImports values if not 0
'v1.2.10 - 20161109 - added section for importing BMA - maanie
'
Imports System.Web.Configuration
Imports Stock_Control.sqlDB

Partial Public Class Admin
  Inherits System.Web.UI.MasterPage
	Private blnDebug = WebConfigurationManager.AppSettings("blnDebug")

  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
		Dim ds As DataSet
		Dim dr As DataRow
    Dim db As New sqlDB

    Page.Title = "RGBC Stock Control"
    Try
      lblUser.Text = "Logout: " & WebConfigurationManager.AppSettings("UNAME")
      lblLevel.Text = WebConfigurationManager.AppSettings("UGROUP")
    Catch ex As Exception
    End Try

		If blnDebug = True Then
#If DEBUG Then
			If WebConfigurationManager.AppSettings("UDOMAIN").Length = 0 Or WebConfigurationManager.AppSettings("UDOMAIN") = Nothing Then
				WebConfigurationManager.AppSettings("UNAME") = "a"
				WebConfigurationManager.AppSettings("UDOMAIN") = "x"
				WebConfigurationManager.AppSettings("UID") = 1
				WebConfigurationManager.AppSettings("UGROUP") = "admin"
			End If
#End If
		Else

			Try

				If WebConfigurationManager.AppSettings("UDOMAIN").Length = 0 Or WebConfigurationManager.AppSettings("UDOMAIN") = Nothing Or WebConfigurationManager.AppSettings("UGROUP").Length = 0 Then
					FormsAuthentication.SignOut()
					Response.Redirect("Index.aspx", True)
				Else

					If WebConfigurationManager.AppSettings("UGROUP").ToLower.Contains("admin") Then
						mnuAdmin.Items(1).Enabled = True
					Else
						mnuAdmin.Items(1).Enabled = False
					End If

				End If

			Catch ex As Exception
				FormsAuthentication.SignOut()
				Response.Redirect("Index.aspx")
			End Try


		End If

	End Sub

  
End Class