﻿'RGBC FORECAST CONTROL SYSTEM
'PHASE 1: setup reports & forecast adjustment interface
'PHASE 2: setup Planning Interface to generate future QF based on galactic pony/dust ratio
'
'20100903 - v0.0.0 - project start
'20100930 - v0.0.1 - applying adjusted figures to other systems. currently only Dev UserGroup can access this function until QF Gen and SC is sorted out
'20101008 - v0.0.2 - Apply() function complete. Using dummy dwfQF2 table to simulate values.
'20101013 - v0.0.2 - Start of Planning Interface
'20101025 - v0.0.2 - End of Planning Interface, STILL need to enable SC Update: ref "'20101008 - v0.0.2 - g4" in QFGenerator
'20110628 - v1.0.2 - added Recalc Regions based on sales Rhythm & Global for period in Adjustments.vb
'20110628 - v1.0.2 - LIVE! the UPDATE for stkPP is now active: ref "'20101008 - v0.0.2 - g4" in QFGenerator
'20120404 - v1.0.3 - compensating for data bug: making sure all customers have region setup correctly @ Branding.New()
'20150216 - v1.0.3 - remove FALSE later - temp workaround [RE: RGBC: Forecast Change] - pj
'20150529 - v1.0.3 - unlocked all QFs

Imports RGBC_Forecast.SystemFunctions
Imports RGBC_Forecast.ProjectFunctions
Imports RGBC_Forecast.db

Partial Public Class Admin
   Inherits System.Web.UI.MasterPage

   Const VersionNumber As String = "1.0.3"
   Const VersionDate As String = "4 April 2012"
#If DEBUG Then
  Const Build As String = " [Dev]"
#Else
  Const Build As String = " [Live]"
#End If

  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not Page.IsPostBack Then
      lblVersionNumber.Text = VersionNumber & Build
      lblVersionDate.Text = VersionDate

      If Session.Item("USER") Is Nothing Then
#If DEBUG Then
            Session.Item("USER") = db.getRow(sql_get_Users("SILICON\PJ", "Forecast"))
#Else
        Response.Redirect("Index.aspx?M=1", True)
#End If
      End If

      If Session.Item("USER")!strUserGroup <> "Dev" Then
        mnuAdmin.Items.RemoveAt(mnuAdmin.Items.Count - 2)
      End If

      mnuAdmin.Items.Item(mnuAdmin.Items.Count - 1).Text = "Logout: " & Session.Item("USER")!strUserName

      If Session.Item("USER")!blnView <> True Then
        'notes: not likely to ever happen. interesting experiment though
        '     : admin.Page_Load happens AFTER $contentPage.Page_Load
        Me.ContentPlaceHolder1.Controls.Clear()

        Dim lblBlank As New WebControls.Label
        lblBlank.ID = "lblBlank"
        lblBlank.CssClass = "labelBrand boxError"
        lblBlank.Text = "You need View rights to access this page. Please contact you systems administrator."
        Me.ContentPlaceHolder1.Controls.Add(lblBlank)

      End If
    End If

  End Sub

End Class