Imports CAMS_BL
Imports CAMS_ADMIN

Public Class frmContractorStage
    Inherits CAMSBasePage

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object
    Protected WithEvents ddlContractor As System.Web.UI.WebControls.DropDownList
    Protected WithEvents btnCancel As System.Web.UI.WebControls.Button
    Protected WithEvents btnExport As System.Web.UI.HtmlControls.HtmlInputButton
    Protected WithEvents mnuCams As Menu

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Access Validation to page
        If Not Me.IsPostBack Then
            Dim oEC_User As EC_User = Me.GetUserFromSession

            If Not oEC_User Is Nothing Then
                If Me.HasAccessTo(Me.GetControlID("frmContractorStage.aspx"), oEC_User.AccessGroup) = False Then
                    Me.RedirectToMsgPage(Constants.CONST_ERROR_ACCESSDENIED_TOPAGE)
                End If
            End If

        End If
        'End Access Validation

        mnuCams.CurrentGroup = Constants.MENU_REPORTS_ID
        mnuCams.CurrentItem = Constants.MENU_REPORTS_CONTRACTOR_ID

        If Me.IsPostBack = False Then
            LoadControls()
        End If

        'Added by Raul Callupe
        If Me.IsPostBack = False Then
            Dim stbOutput As New System.Text.StringBuilder
            stbOutput.Append("<script language='Javascript'>")
            stbOutput.Append("var pag = window.parent.frames(0);")
            stbOutput.Append("pag.document.all.lblPath.innerHTML='Reports/Stage Analysis'")
            stbOutput.Append("</script>")
            Response.Write(stbOutput.ToString)
        End If
        'End Added

    End Sub

    Private Sub LoadControls()
        Dim oCC_Contractor As New CC_Contractor
        Dim dsData As DataSet
        Try
            dsData = oCC_Contractor.GetContractors(0, 0)
            If Not dsData Is Nothing Then
                Util.FillDropDownList(dsData.Tables(0).DefaultView, ddlContractor, "CONTRACTORID", "COMPANYNAME", True, New ListItem("Select...", ""))
            End If
        Catch
        End Try
    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.RedirectToHome()
    End Sub
End Class
