/// ////////////////////////////////////////////////////////////////////////
        /// 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"];
            }
        }
        protected void grdPointRepairs_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Edit) || (e.Row.RowState == (DataControlRowState.Edit | DataControlRowState.Alternate))))
            {
                // Initialize values
                Guid id = new Guid(((Label)e.Row.FindControl("lblId")).Text);
                int refId = Int32.Parse(((Label)e.Row.FindControl("lblRefId")).Text);
                int companyId = Int32.Parse(((Label)e.Row.FindControl("lblCOMPANY_ID")).Text);

                AddRecordPointRepairsGateway addRecordPointRepairsGateway = new AddRecordPointRepairsGateway(addRecordTDS);

                // ... for direction
                if (addRecordPointRepairsGateway.GetDirection(id, refId, companyId) != "")
                {
                    ((DropDownList)e.Row.FindControl("ddlDirectionEdit")).SelectedValue = addRecordPointRepairsGateway.GetDirection(id, refId, companyId);
                }
                else
                {
                    ((DropDownList)e.Row.FindControl("ddlDirectionEdit")).SelectedIndex = 4;
                }

                // ... for MhShoot
                if (addRecordPointRepairsGateway.GetMHShot(id, refId, companyId) != "")
                {
                    ((DropDownList)e.Row.FindControl("ddlMhShotEdit")).SelectedValue = addRecordPointRepairsGateway.GetMHShot(id, refId, companyId);
                }
                else
                {
                    ((DropDownList)e.Row.FindControl("ddlMhShotEdit")).SelectedIndex = 2;
                }

                // ... For Install Date
                if (addRecordPointRepairsGateway.Table.Rows.Count > 0)
                {
                    if (addRecordPointRepairsGateway.GetInstallDate(id, refId, companyId).HasValue)
                    {
                        ((RadDatePicker)e.Row.FindControl("tkrdpInstallDateEdit")).SelectedDate = (DateTime)addRecordPointRepairsGateway.GetInstallDate(id, refId, companyId);
                    }
                }
            }

            if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Normal) || (e.Row.RowState == (DataControlRowState.Normal | DataControlRowState.Alternate))))
            {
                // Validation of permissions
                if (Convert.ToBoolean(Session["sgLFS_APP_EDIT"]))
                {
                    // Button Validation
                    e.Row.FindControl("ibtnEdit").Visible = true;
                    e.Row.FindControl("ibtnDelete").Visible = true;
                }
                else
                {
                    // Button validation
                    e.Row.FindControl("ibtnEdit").Visible = false;
                    e.Row.FindControl("ibtnDelete").Visible = false;
                }
            }

            if (e.Row.RowType == DataControlRowType.Footer)
            {
                if (Convert.ToBoolean(Session["sgLFS_APP_EDIT"]))
                {
                    // Initialize variables
                    ((DropDownList)e.Row.FindControl("ddlMhShotFooter")).SelectedIndex = 2;
                    ((DropDownList)e.Row.FindControl("ddlDirectionFooter")).SelectedIndex = 4;

                    // If the limit is reached
                    AddRecordPointRepairs addRecordPointRepairs = new AddRecordPointRepairs(addRecordTDS);
                    string newDetailId = addRecordPointRepairs.GetNewPointRepairsDetailId(addRecordTDS);

                    if (newDetailId == "-1")
                    {
                        ((RadDatePicker)e.Row.FindControl("tkrdpInstallDateFooter")).Visible = false;
                        ((TextBox)e.Row.FindControl("tbxLinerDistanceFooter")).Visible = false;
                        ((CheckBox)e.Row.FindControl("ddlDirectionFooter")).Visible = false;
                        ((TextBox)e.Row.FindControl("tbxLtMhFooter")).Visible = false;
                        ((TextBox)e.Row.FindControl("tbxVtMhFooter")).Visible = false;
                        ((TextBox)e.Row.FindControl("tbxDistanceFooter")).Visible = false;
                        ((TextBox)e.Row.FindControl("tbxSizeFooter")).Visible = false;
                        ((DropDownList)e.Row.FindControl("ddlMhShotFooter")).Visible = false;
                        ((CheckBox)e.Row.FindControl("ckbxExptraRepairFooter")).Visible = false;
                        ((CheckBox)e.Row.FindControl("ckbxCancelledFooter")).Visible = false;
                        ((CheckBox)e.Row.FindControl("ckbxApprovedFooter")).Visible = false;
                        ((CheckBox)e.Row.FindControl("ckbxNotApprovedFooter")).Visible = false;
                        ((TextBox)e.Row.FindControl("tbxCommentFooter")).Visible = false;
                        e.Row.FindControl("ibtnAdd").Visible = false;
                        lblMaxNumber.Visible = true;
                    }
                    else
                    {
                        ((RadDatePicker)e.Row.FindControl("tkrdpInstallDateFooter")).Visible = true;
                        ((TextBox)e.Row.FindControl("tbxLinerDistanceFooter")).Visible = true;
                        ((DropDownList)e.Row.FindControl("ddlDirectionFooter")).Visible = true;
                        ((TextBox)e.Row.FindControl("tbxLtMhFooter")).Visible = true;
                        ((TextBox)e.Row.FindControl("tbxVtMhFooter")).Visible = true;
                        ((TextBox)e.Row.FindControl("tbxDistanceFooter")).Visible = true;
                        ((TextBox)e.Row.FindControl("tbxSizeFooter")).Visible = true;
                        ((DropDownList)e.Row.FindControl("ddlMhShotFooter")).Visible = true;
                        ((CheckBox)e.Row.FindControl("ckbxExptraRepairFooter")).Visible = true;
                        ((CheckBox)e.Row.FindControl("ckbxCancelledFooter")).Visible = true;
                        ((CheckBox)e.Row.FindControl("ckbxApprovedFooter")).Visible = true;
                        ((CheckBox)e.Row.FindControl("ckbxNotApprovedFooter")).Visible = true;
                        ((TextBox)e.Row.FindControl("tbxCommentFooter")).Visible = true;
                        e.Row.FindControl("ibtnAdd").Visible = true;
                        lblMaxNumber.Visible = false;
                    }
                }
                else
                {
                    ((RadDatePicker)e.Row.FindControl("tkrdpInstallDateFooter")).Visible = false;
                    ((TextBox)e.Row.FindControl("tbxLinerDistanceFooter")).Visible = false;
                    ((TextBox)e.Row.FindControl("tbxDirectionFooter")).Visible = false;
                    ((TextBox)e.Row.FindControl("tbxLtMhFooter")).Visible = false;
                    ((TextBox)e.Row.FindControl("tbxVtMhFooter")).Visible = false;
                    ((TextBox)e.Row.FindControl("tbxDistanceFooter")).Visible = false;
                    ((TextBox)e.Row.FindControl("tbxSizeFooter")).Visible = false;
                    ((DropDownList)e.Row.FindControl("ddlMhShotFooter")).Visible = false;
                    ((CheckBox)e.Row.FindControl("ckbxExptraRepairFooter")).Visible = false;
                    ((CheckBox)e.Row.FindControl("ckbxCancelledFooter")).Visible = false;
                    ((CheckBox)e.Row.FindControl("ckbxApprovedFooter")).Visible = false;
                    ((CheckBox)e.Row.FindControl("ckbxNotApprovedFooter")).Visible = false;
                    ((TextBox)e.Row.FindControl("tbxCommentFooter")).Visible = false;
                    e.Row.FindControl("ibtnAdd").Visible = false;
                    lblMaxNumber.Visible = false;
                }
            }
        }
        /// ////////////////////////////////////////////////////////////////////////
        /// 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"];
            }
        }
        /// <summary>
        /// Save all PR to database (direct)
        /// </summary>
        /// <param name="companyId">companyId</param>
        /// <param name="newId">newId</param>
        public void Save(int companyId, Guid newId)
        {
            AddRecordTDS pointRepairsChanges = (AddRecordTDS)Data.GetChanges();

            if (pointRepairsChanges != null)
            {
                if (pointRepairsChanges.PointRepairs.Rows.Count > 0)
                {
                    AddRecordPointRepairsGateway addRecordPointRepairsGateway = new AddRecordPointRepairsGateway(pointRepairsChanges);

                    foreach (AddRecordTDS.PointRepairsRow row in (AddRecordTDS.PointRepairsDataTable)pointRepairsChanges.PointRepairs)
                    {
                        // Insert new Notes
                        if ((!row.Deleted) && (!row.InDatabase))
                        {
                            string repairSize = ""; if (!row.IsRepairSizeNull()) repairSize = row.RepairSize;
                            DateTime? installDate = null; if (!row.IsInstallDateNull()) installDate = row.InstallDate;
                            string distance = ""; if (!row.IsDistanceNull()) distance = row.Distance;
                            decimal? cost = null; if (!row.IsCostNull()) cost = row.Cost;
                            int? reinstates = null; if (!row.IsReinstatesNull()) reinstates = row.Reinstates;
                            string ltatMh = ""; if (!row.IsLTAtMHNull()) ltatMh = row.LTAtMH;
                            string vtatMh = ""; if (!row.IsVTAtMHNull()) vtatMh = row.VTAtMH;
                            string linerDistance = ""; if (!row.IsLinerDistanceNull()) linerDistance = row.LinerDistance;
                            string direction = ""; if (!row.IsDirectionNull()) direction = row.Direction;
                            string mhShot = ""; if (!row.IsMHShotNull()) mhShot = row.MHShot;
                            string comments = ""; if (!row.IsCommentsNull()) comments = row.Comments;

                            LFSRecordPointRepairs lfsRecordPointRepairs = new LFSRecordPointRepairs(null);
                            lfsRecordPointRepairs.InsertDirect(newId, row.RefID, row.COMPANY_ID, row.DetailID, repairSize, installDate, distance, cost, reinstates, ltatMh, vtatMh, linerDistance, direction, mhShot, comments, row.Deleted, row.ExtraRepair, row.Cancelled, row.Approved, row.NotApproved, row.Archived);
                        }

                        // Update Notes
                        if ((!row.Deleted) && (row.InDatabase))
                        {
                            Guid id = row.ID;
                            int refId = row.RefID;

                            // original values
                            string originalDetailId = addRecordPointRepairsGateway.GetDetailIDOriginal(id, refId, companyId);
                            string originalRepairSize = addRecordPointRepairsGateway.GetRepairSizeOriginal(id, refId, companyId);
                            DateTime? originalInstallDate = addRecordPointRepairsGateway.GetInstallDateOriginal(id, refId, companyId);
                            string originalDistance = addRecordPointRepairsGateway.GetDistanceOriginal(id, refId, companyId);
                            decimal? originalCost = addRecordPointRepairsGateway.GetCostOriginal(id, refId, companyId);
                            int? originalReinstates = addRecordPointRepairsGateway.GetReinstatesOriginal(id, refId, companyId);
                            string originalLTAtMH = addRecordPointRepairsGateway.GetLTAtMHOriginal(id, refId, companyId);
                            string originalVTAtMH = addRecordPointRepairsGateway.GetVTAtMHOriginal(id, refId, companyId);
                            string originalLinerDistance = addRecordPointRepairsGateway.GetLinerDistanceOriginal(id, refId, companyId);
                            string originalDirection = addRecordPointRepairsGateway.GetDirectionOriginal(id, refId, companyId);
                            string originalMhShot = addRecordPointRepairsGateway.GetMHShotOriginal(id, refId, companyId);
                            string originalComments = addRecordPointRepairsGateway.GetCommentsOriginal(id, refId, companyId);
                            bool originalDeleted = false;
                            bool originalExtraRepair = addRecordPointRepairsGateway.GetExtraRepairOriginal(id, refId, companyId);
                            bool originalCancelled = addRecordPointRepairsGateway.GetCancelledOriginal(id, refId, companyId);
                            bool originalApproved = addRecordPointRepairsGateway.GetApprovedOriginal(id, refId, companyId);
                            bool originalNotApproved = addRecordPointRepairsGateway.GetNotApprovedOriginal(id, refId, companyId);
                            bool originalArchived = addRecordPointRepairsGateway.GetArchivedOriginal(id, refId, companyId);

                            // new values
                            string newDetailId = addRecordPointRepairsGateway.GetDetailID(id, refId, companyId);
                            string newRepairSize = addRecordPointRepairsGateway.GetRepairSize(id, refId, companyId);
                            DateTime? newInstallDate = addRecordPointRepairsGateway.GetInstallDate(id, refId, companyId);
                            string newDistance = addRecordPointRepairsGateway.GetDistance(id, refId, companyId);
                            decimal? newCost = addRecordPointRepairsGateway.GetCost(id, refId, companyId);
                            int? newReinstates = addRecordPointRepairsGateway.GetReinstates(id, refId, companyId);
                            string newLTAtMH = addRecordPointRepairsGateway.GetLTAtMH(id, refId, companyId);
                            string newVTAtMH = addRecordPointRepairsGateway.GetVTAtMH(id, refId, companyId);
                            string newLinerDistance = addRecordPointRepairsGateway.GetLinerDistance(id, refId, companyId);
                            string newDirection = addRecordPointRepairsGateway.GetDirection(id, refId, companyId);
                            string newMhShot = addRecordPointRepairsGateway.GetMHShot(id, refId, companyId);
                            string newComments = addRecordPointRepairsGateway.GetComments(id, refId, companyId);
                            bool newDeleted = false;
                            bool newExtraRepair = addRecordPointRepairsGateway.GetExtraRepair(id, refId, companyId);
                            bool newCancelled = addRecordPointRepairsGateway.GetCancelled(id, refId, companyId);
                            bool newApproved = addRecordPointRepairsGateway.GetApproved(id, refId, companyId);
                            bool newNotApproved = addRecordPointRepairsGateway.GetNotApproved(id, refId, companyId);
                            bool newArchived = addRecordPointRepairsGateway.GetArchived(id, refId, companyId);

                            LFSRecordPointRepairs lfsRecordPointRepairs = new LFSRecordPointRepairs(null);
                            lfsRecordPointRepairs.UpdateDirect(id, refId, companyId, originalDetailId, originalRepairSize, originalInstallDate, originalDistance, originalCost, originalReinstates, originalLTAtMH, originalVTAtMH, originalLinerDistance, originalDirection, originalMhShot, originalComments, originalDeleted, originalExtraRepair, originalCancelled, originalApproved, originalNotApproved, originalArchived, id, refId, companyId, newDetailId, newRepairSize, newInstallDate, newDistance, newCost, newReinstates, newLTAtMH, newVTAtMH, newLinerDistance, newDirection, newMhShot, newComments, newDeleted, newExtraRepair, newCancelled, newApproved, newNotApproved, newArchived);
                        }

                        // Deleted notes
                        if ((row.Deleted) && (row.InDatabase))
                        {
                            LFSRecordPointRepairs lfsRecordPointRepairs = new LFSRecordPointRepairs(null);
                            lfsRecordPointRepairs.DeleteDirect(row.ID, row.RefID, row.COMPANY_ID);
                        }
                    }
                }
            }
        }
        protected void grdPointRepairs_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Edit) || (e.Row.RowState == (DataControlRowState.Edit | DataControlRowState.Alternate))))
            {
                // Initialize values
                Guid id = new Guid(((Label)e.Row.FindControl("lblId")).Text);
                int refId = Int32.Parse(((Label)e.Row.FindControl("lblRefId")).Text);
                int companyId = Int32.Parse(((Label)e.Row.FindControl("lblCOMPANY_ID")).Text);

                AddRecordPointRepairsGateway addRecordPointRepairsGateway = new AddRecordPointRepairsGateway(addRecordTDS);

                if (addRecordPointRepairsGateway.Table.Rows.Count > 0)
                {
                    if (addRecordPointRepairsGateway.GetInstallDate(id, refId, companyId).HasValue)
                    {
                        ((RadDatePicker)e.Row.FindControl("tkrdpInstallDateEdit")).SelectedDate = (DateTime)addRecordPointRepairsGateway.GetInstallDate(id, refId, companyId);
                    }
                }
            }

            if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Normal) || (e.Row.RowState == (DataControlRowState.Normal | DataControlRowState.Alternate))))
            {
                if (Convert.ToBoolean(Session["sgLFS_APP_EDIT"]))
                {
                    // Button Validation
                    e.Row.FindControl("ibtnEdit").Visible = true;
                    e.Row.FindControl("ibtnDelete").Visible = true;
                }
                else
                {
                    // Button validation
                    e.Row.FindControl("ibtnEdit").Visible = false;
                    e.Row.FindControl("ibtnDelete").Visible = false;
                }
            }

            if (e.Row.RowType == DataControlRowType.Footer)
            {
                if (Convert.ToBoolean(Session["sgLFS_APP_EDIT"]))
                {
                    // If the limit is reached
                    AddRecordPointRepairs addRecordPointRepairs = new AddRecordPointRepairs(addRecordTDS);
                    string newDetailId = addRecordPointRepairs.GetNewPointRepairsDetailId(addRecordTDS);

                    if (newDetailId == "-1")
                    {
                        ((RadDatePicker)e.Row.FindControl("tkrdpInstallDateFooter")).Visible = false;
                        ((TextBox)e.Row.FindControl("tbxRepairSizeFooter")).Visible = false;
                        ((TextBox)e.Row.FindControl("tbxDistanceFooter")).Visible = false;
                        ((TextBox)e.Row.FindControl("tbxCostFooter")).Visible = false;
                        ((TextBox)e.Row.FindControl("tbxReinstatesFooter")).Visible = false;
                        e.Row.FindControl("ibtnAdd").Visible = false;
                        lblMaxNumber.Visible = true;
                    }
                    else
                    {
                        ((RadDatePicker)e.Row.FindControl("tkrdpInstallDateFooter")).Visible = true;
                        ((TextBox)e.Row.FindControl("tbxRepairSizeFooter")).Visible = true;
                        ((TextBox)e.Row.FindControl("tbxDistanceFooter")).Visible = true;
                        ((TextBox)e.Row.FindControl("tbxCostFooter")).Visible = true;
                        ((TextBox)e.Row.FindControl("tbxReinstatesFooter")).Visible = true;
                        e.Row.FindControl("ibtnAdd").Visible = true;
                        lblMaxNumber.Visible = false;
                    }
                }
                else
                {
                    ((RadDatePicker)e.Row.FindControl("tkrdpInstallDateFooter")).Visible = false;
                    ((TextBox)e.Row.FindControl("tbxRepairSizeFooter")).Visible = false;
                    ((TextBox)e.Row.FindControl("tbxDistanceFooter")).Visible = false;
                    ((TextBox)e.Row.FindControl("tbxCostFooter")).Visible = false;
                    ((TextBox)e.Row.FindControl("tbxReinstatesFooter")).Visible = false;
                    e.Row.FindControl("ibtnAdd").Visible = false;
                    lblMaxNumber.Visible = false;
                }
            }
        }