/// ////////////////////////////////////////////////////////////////////////
        /// EVENTS
        ///
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!Convert.ToBoolean(Session["sgLFS_APP_VIEW"]))
                {
                    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["record_deleted"] == null))
                {
                    Response.Redirect("./../error_page.aspx?error=" + "Invalid query string in view_fulllength.aspx");
                }

                // Prepare initial values
                Session.Remove("pointRepairDummy");
                addRecordTDS = new AddRecordTDS();

                // If coming from navigator2.aspx or view_scopesheet.aspx
                if (((string)Request.QueryString["source_page"] == "navigator2.aspx") || ((string)Request.QueryString["source_page"] == "view_scopesheet.aspx"))
                {
                    int companyId = Convert.ToInt32(Session["companyID"]);
                    Guid id = (Guid)Session["lfsMasterAreaId"];

                    //... Get lfs master area record
                    LFSRecordGateway lfsRecordGateway = new LFSRecordGateway();
                    tdsLfsRecord = lfsRecordGateway.GetRecordByIdCompanyId(id, companyId);

                    AddRecordPointRepairsGateway addRecordPointRepairsGateway = new AddRecordPointRepairsGateway(addRecordTDS);
                    addRecordPointRepairsGateway.LoadById(id, companyId);

                    //... Store datasets
                    Session["tdsLfsRecord"] = tdsLfsRecord;
                    Session["addRecordTDS"] = addRecordTDS;
                    pointRepairs = addRecordTDS.PointRepairs;
                    Session["pointRepairs"] = pointRepairs;
                }

                // If coming from delete_record.aspx
                if ((string)Request.QueryString["record_deleted"] == "false")
                {
                    //... Restore dataset lfs record
                    tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"];
                    addRecordTDS = (AddRecordTDS)Session["addRecordTDS"];
                }

                // Prepare initial data
                // ... for client
                CompaniesGateway companiesGateway = new CompaniesGateway();
                tbxCOMPANIES_ID.Text = companiesGateway.GetName((int)tdsLfsRecord.LFS_MASTER_AREA.Rows[0]["COMPANIES_ID"], Convert.ToInt32(Session["companyID"]));

                // ... for traffic control
                LFSTrafficControlGateway lfsTrafficControlGateway = new LFSTrafficControlGateway();
                DataSet dsLfsTrafficControl = lfsTrafficControlGateway.GetLFSTrafficControlForDropDownList("");

                ddlDegreeOfTrafficControl.DataSource = dsLfsTrafficControl;
                ddlDegreeOfTrafficControl.DataTextField = "TrafficControl";

                // Databind
                Page.DataBind();

                TDSLFSRecord.LFS_MASTER_AREARow lfsMasterAreaRow = tdsLfsRecord.LFS_MASTER_AREA.FindByIDCOMPANY_ID(new Guid(tbxID.Text), Convert.ToInt32(Session["companyID"]));
                ddlDegreeOfTrafficControl.SelectedValue = (lfsMasterAreaRow.IsDegreeOfTrafficControlNull()) ? "" : lfsMasterAreaRow.DegreeOfTrafficControl;
            }
            else
            {
                // Restore datasets
                tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"];
                addRecordTDS = (AddRecordTDS)Session["addRecordTDS"];
            }
        }
        /// ////////////////////////////////////////////////////////////////////////
        /// EVENTS
        ///
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                // Security check
                if (!Convert.ToBoolean(Session["sgLFS_APP_VIEW"]))
                {
                    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["record_deleted"] == null))
                {
                    Response.Redirect("./../error_page.aspx?error=" + "Invalid query string in view_fulllength.aspx");
                }

                //... Prepare initial
                Session.Remove("pointRepairDummy");
                addRecordTDS = new AddRecordTDS();

                // If coming from navigator2.aspx or view_pointliner.aspx
                if (((string)Request.QueryString["source_page"] == "navigator2.aspx") || ((string)Request.QueryString["source_page"] == "view_pointliner.aspx"))
                {
                    int companyId = Convert.ToInt32(Session["companyID"]);
                    Guid id = (Guid)Session["lfsMasterAreaId"];

                    // Get lfs master area record
                    LFSRecordGateway lfsRecordGateway = new LFSRecordGateway();
                    tdsLfsRecord = lfsRecordGateway.GetRecordByIdCompanyId(id, companyId);

                    AddRecordPointRepairsGateway addRecordPointRepairsGateway = new AddRecordPointRepairsGateway(addRecordTDS);
                    addRecordPointRepairsGateway.LoadById(id, companyId);

                    //... Store datasets
                    Session["tdsLfsRecord"] = tdsLfsRecord;
                    Session["addRecordTDS"] = addRecordTDS;
                    pointRepairs = addRecordTDS.PointRepairs;
                    Session["pointRepairs"] = pointRepairs;
                }

                // If coming from delete_record.aspx
                if ((string)Request.QueryString["record_deleted"] == "false")
                {
                    //... Restore dataset lfs record
                    tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"];
                    addRecordTDS = (AddRecordTDS)Session["addRecordTDS"];
                }

                // Prepare initial data for client
                CompaniesGateway companiesGateway = new CompaniesGateway();
                tbxCOMPANIES_ID.Text = companiesGateway.GetName((int)tdsLfsRecord.LFS_MASTER_AREA.Rows[0]["COMPANIES_ID"], Convert.ToInt32(Session["companyID"]));

                // Databind
                Page.DataBind();
            }
            else
            {
                // Restore dataset lfs record
                tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"];
                addRecordTDS = (AddRecordTDS)Session["addRecordTDS"];
            }
        }