/// <summary>
 /// InitData
 /// </summary>
 protected override void InitData()
 {
     _data = new SubcontractorHoursInformationTDS();
 }
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                if (!(Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_SUBCONTRACTOR_HOURS_ADMIN"])))
                {
                    // Security check
                    if (!(Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_SUBCONTRACTOR_HOURS_VIEW"]) && Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_SUBCONTRACTOR_HOURS_EDIT"])))
                    {
                        Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                    }

                    // Validate query string
                    if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["project_id"] == null) || ((string)Request.QueryString["ref_id"] == null))
                    {
                        Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in subcontractor_hours_summary.aspx");
                    }
                }

                // Initialize  variables
                hdfProjectId.Value = Request.QueryString["project_id"].ToString();
                hdfRefId.Value = Request.QueryString["ref_id"].ToString();
                hdfCompanyId.Value = Session["companyID"].ToString();

                // If coming from
                int refId = Int32.Parse(hdfRefId.Value);
                int projectId = Int32.Parse(hdfProjectId.Value);

                // ... subcontractor_hours_navigator2.aspx
                if (Request.QueryString["source_page"] == "subcontractor_hours_navigator2.aspx")
                {
                    StoreNavigatorState();
                    ViewState["update"] = "si";

                    int companyId = Int32.Parse(hdfCompanyId.Value);

                    subcontractorHoursInformationTDS = new SubcontractorHoursInformationTDS();

                    SubcontractorHoursInformationBasicInformationGateway subcontractorHoursInformationBasicInformationGateway = new SubcontractorHoursInformationBasicInformationGateway(subcontractorHoursInformationTDS);
                    subcontractorHoursInformationBasicInformationGateway.LoadByProjectIdRefId(projectId, refId,companyId);

                    // ... Store dataset
                    Session["subcontractorHoursInformationTDS"] = subcontractorHoursInformationTDS;
                }

                // ... subcontractor_hours_summary.aspx or subcontractor_hours_edit.aspx
                if ((Request.QueryString["source_page"] == "subcontractor_hours_summary.aspx") || (Request.QueryString["source_page"] == "subcontractor_hours_edit.aspx"))
                {
                    StoreNavigatorState();
                    ViewState["update"] = Request.QueryString["update"];

                    int companyId = Int32.Parse(hdfCompanyId.Value);

                    // ... Restore dataset
                    subcontractorHoursInformationTDS = (SubcontractorHoursInformationTDS)Session["subcontractorHoursInformationTDS"];
                }

                // ... Data for current employee
                LoadData(projectId, refId);
            }
            else
            {
                // Restore datasets
                subcontractorHoursInformationTDS = (SubcontractorHoursInformationTDS)Session["subcontractorHoursInformationTDS"];
            }
        }