/// <summary>
        /// ProcessForReport
        /// </summary>
        /// <param name="plLiningPlanTDS">TDS for process</param>
        public void ProcessForReport(PlLiningPlanTDS plLiningPlanTDS)
        {
            foreach (PlLiningPlanTDS.PlLiningPlanRow plLiningPlanRow in plLiningPlanTDS.PlLiningPlan.Rows)
            {
                if (plLiningPlanRow.Selected != "9")
                {
                    // Create row for report
                    PlLiningPlanTDS.PlLiningPlanRow newRow = ((PlLiningPlanTDS.PlLiningPlanDataTable)Table).NewPlLiningPlanRow();

                    newRow.WorkID = plLiningPlanRow.WorkID;
                    newRow.RepairPointID = plLiningPlanRow.RepairPointID;
                    newRow.FlowOrderID = plLiningPlanRow.FlowOrderID;
                    newRow.Selected = plLiningPlanRow.Selected;
                    if (!plLiningPlanRow.IsDate_Null()) newRow.Date_ = plLiningPlanRow.Date_;
                    if (!plLiningPlanRow.IsStreetNull()) newRow.Street = plLiningPlanRow.Street;
                    if (!plLiningPlanRow.IsUsmhDescriptionNull()) newRow.UsmhDescription = plLiningPlanRow.UsmhDescription;
                    if (!plLiningPlanRow.IsDsmhDescriptionNull()) newRow.DsmhDescription = plLiningPlanRow.DsmhDescription;
                    newRow.Type = plLiningPlanRow.Type;
                    if (!plLiningPlanRow.IsReamDistanceNull()) newRow.ReamDistance = plLiningPlanRow.ReamDistance;
                    if (!plLiningPlanRow.IsReamDateNull()) newRow.ReamDate = plLiningPlanRow.ReamDate;
                    if (!plLiningPlanRow.IsLinerDistanceNull()) newRow.LinerDistance = plLiningPlanRow.LinerDistance;
                    if (!plLiningPlanRow.IsDirectionNull()) newRow.Direction = plLiningPlanRow.Direction;
                    if (!plLiningPlanRow.IsReinstatesNull()) newRow.Reinstates = plLiningPlanRow.Reinstates;
                    if (!plLiningPlanRow.IsLTMHNull()) newRow.LTMH = plLiningPlanRow.LTMH;
                    if (!plLiningPlanRow.IsVTMHNull()) newRow.VTMH = plLiningPlanRow.VTMH;
                    if (!plLiningPlanRow.IsDistanceNull()) newRow.Distance = plLiningPlanRow.Distance;
                    if (!plLiningPlanRow.IsSize_Null()) newRow.Size_ = plLiningPlanRow.Size_;
                    if (!plLiningPlanRow.IsInstallDateNull()) newRow.InstallDate = plLiningPlanRow.InstallDate;
                    if (!plLiningPlanRow.IsMHShotNull()) newRow.MHShot = plLiningPlanRow.MHShot;
                    if (!plLiningPlanRow.IsGroutDistanceNull()) newRow.GroutDistance = plLiningPlanRow.GroutDistance;
                    if (!plLiningPlanRow.IsGroutDateNull()) newRow.GroutDate = plLiningPlanRow.GroutDate;
                    if (!plLiningPlanRow.IsApprovalNull()) newRow.Approval = plLiningPlanRow.Approval;
                    newRow.ExtraRepair = plLiningPlanRow.ExtraRepair;
                    newRow.Cancelled = plLiningPlanRow.Cancelled;
                    if (!plLiningPlanRow.IsLinerNull()) newRow.Liner = plLiningPlanRow.Liner;
                    if (!plLiningPlanRow.IsLinerMNNull()) newRow.LinerMN = plLiningPlanRow.LinerMN;
                    if (!plLiningPlanRow.IsVideoNull()) newRow.Video = plLiningPlanRow.Video;
                    if (!plLiningPlanRow.IsVideoMNNull()) newRow.VideoMN = plLiningPlanRow.VideoMN;
                    if (!plLiningPlanRow.IsDefectQualifierNull()) newRow.DefectQualifier = plLiningPlanRow.DefectQualifier;
                    if (!plLiningPlanRow.IsDefectDetailsNull()) newRow.DefectDetails = plLiningPlanRow.DefectDetails;

                    // Update comments
                    if (!plLiningPlanRow.IsCommentsNull())
                    {
                        newRow.Comments = plLiningPlanRow.Comments.Replace("<br>", "\n");
                    }

                    newRow.Deleted = plLiningPlanRow.Deleted;
                    newRow.COMPANY_ID = plLiningPlanRow.COMPANY_ID;

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

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

                // Tag Page
                hdfCompanyId.Value = Session["companyID"].ToString();
                hdfCurrentProjectId.Value = Request.QueryString["project_id"].ToString();
                hdfCurrentClientId.Value = Request.QueryString["client_id"].ToString();
                hdfWorkType.Value = "Point Repairs";

                // Prepare initial data

                // ... for client
                int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString());
                int companyId = Int32.Parse(hdfCompanyId.Value);

                CompaniesGateway companiesGateway = new CompaniesGateway();
                companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId);

                // ... for project
                int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString());
                ProjectGateway projectGateway = new ProjectGateway();
                projectGateway.LoadByProjectId(currentProjectId);
                string name = projectGateway.GetName(currentProjectId);
                if (name.Length > 23) name = name.Substring(0, 20) + "...";
                lblTitleProjectName.Text = " > Project: " + name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ") > Lining Plan";

                // ... for the grid
                prLiningPlanTDS = new PlLiningPlanTDS();
                int projectId = Int32.Parse(hdfCurrentProjectId.Value);

                PrLiningPlanGateway prLiningPlanGateway = new PrLiningPlanGateway(prLiningPlanTDS);
                prLiningPlanGateway.ClearBeforeFill = false;
                prLiningPlanGateway.Load(projectId, companyId);

                grdLiningPlan.DataSource = prLiningPlanGateway.Table;
                grdLiningPlan.DataBind();

                // Check results
                if (prLiningPlanTDS.PlLiningPlan.Rows.Count > 0)
                {
                    tPreview.Visible = true;
                    tdNoResults.Visible = false;
                    tbFooterToolbar.Visible = true;
                }
                else
                {
                    tPreview.Visible = false;
                    tdNoResults.Visible = true;
                    tbFooterToolbar.Visible = false;
                }

                // Check results
                if (prLiningPlanTDS.PlLiningPlan.Rows.Count == 1)
                {
                    tbFooterToolbar.Visible = false;
                }

                // Store dataset
                Session["prLiningPlanTDS"] = prLiningPlanTDS;
            }
            else
            {
                // Restore dataset
                prLiningPlanTDS = (PlLiningPlanTDS)Session["prLiningPlanTDS"];

                // ... for the grid
                PrLiningPlanGateway prLiningPlanGateway = new PrLiningPlanGateway(prLiningPlanTDS);
                grdLiningPlan.DataSource = prLiningPlanGateway.Table;
                grdLiningPlan.DataBind();
            }
        }