コード例 #1
0
        /// ////////////////////////////////////////////////////////////////////////
        /// 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_jlinersheet.aspx");
                }

                // Prepare initial data
                Session.Remove("jlinerDummy");
                lblMaxNumber.Visible = false;

                // If coming from navigator2.aspx or view_jlinersheet.aspx
                if (((string)Request.QueryString["source_page"] == "navigator2.aspx") || ((string)Request.QueryString["source_page"] == "view_jlinersheet.aspx"))
                {
                    //... Get lfs master area record
                    LFSRecordGateway lfsRecordGateway = new LFSRecordGateway();
                    viewJLinersheetTDS = new ViewJLinersheetTDS();

                    ViewJLinersheetJunctionLinerGateway viewJLinersheetJunctionLinerGateway = new ViewJLinersheetJunctionLinerGateway(viewJLinersheetTDS);
                    viewJLinersheetJunctionLinerGateway.LoadById((Guid)Session["lfsMasterAreaId"], Convert.ToInt32(Session["companyID"]));

                    tdsLfsRecord = lfsRecordGateway.GetRecordByIdCompanyId((Guid)Session["lfsMasterAreaId"], Convert.ToInt32(Session["companyID"]));

                    //... Store datasets
                    Session["tdsLfsRecord"] = tdsLfsRecord;
                    Session["viewJLinersheetTDS"] = viewJLinersheetTDS;
                    jliner = viewJLinersheetTDS.JunctionLiner;
                    Session["jliner"] = jliner;
                }

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

                // ... 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();

                ddlMainLined.SelectedIndex = (tdsLfsRecord.LFS_MASTER_AREA[0].IsMainLinedNull()) ? 2 : ((tdsLfsRecord.LFS_MASTER_AREA[0].MainLined == "Yes") ? 0 : 1);
                ddlBenchingIssue.SelectedIndex = (tdsLfsRecord.LFS_MASTER_AREA[0].IsBenchingIssueNull()) ? 2 : ((tdsLfsRecord.LFS_MASTER_AREA[0].BenchingIssue == "Yes") ? 0 : 1);
            }
            else
            {
                //--- Restore dataset lfs record
                tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"];
                viewJLinersheetTDS = (ViewJLinersheetTDS)Session["viewJLinersheetTDS"];
            }
        }
コード例 #2
0
        /// <summary>
        /// Save all to database (direct)
        /// </summary>
        /// <param name="companyId">companyId</param>
        /// <param name="newId">newId</param>
        public void Save(int companyId, Guid newId)
        {
            ViewJLinersheetTDS jlinerChanges = (ViewJLinersheetTDS)Data.GetChanges();

            if (jlinerChanges.JunctionLiner.Rows.Count > 0)
            {
                ViewJLinersheetJunctionLinerGateway viewJLinersheetJunctionLinerGateway = new ViewJLinersheetJunctionLinerGateway(jlinerChanges);

                foreach (ViewJLinersheetTDS.JunctionLinerRow row in (ViewJLinersheetTDS.JunctionLinerDataTable)jlinerChanges.JunctionLiner)
                {
                    // Insert new Notes
                    if ((!row.Deleted) && (!row.InDatabase))
                    {
                        string mn = ""; if (!row.IsMNNull()) mn = row.MN;
                        double? distanceFromUSMH = null; if (!row.IsDistanceFromUSMHNull()) distanceFromUSMH = (double)row.DistanceFromUSMH;
                        string confirmedLatSize = ""; if (!row.IsConfirmedLatSizeNull()) confirmedLatSize = row.ConfirmedLatSize;
                        string lateralMaterial = ""; if (!row.IsLateralMaterialNull()) lateralMaterial = row.LateralMaterial;
                        string sharedLateral = ""; if (!row.IsSharedLateralNull()) sharedLateral = row.SharedLateral;
                        bool cleanoutRequired = row.CleanoutRequired;
                        bool pitRequired = row.PitRequired;
                        bool mHShot = row.MHShot;
                        string mainConnection = ""; if (!row.IsMainConnectionNull()) mainConnection = row.MainConnection;
                        string transition = ""; if (!row.IsTransitionNull()) transition = row.Transition;
                        bool cleanoutInstalled = row.CleanoutInstalled;
                        bool pitInstalled = row.PitInstalled;
                        bool cleanoutGrouted = row.CleanoutGrouted;
                        bool cleanoutCored = row.CleanoutCored;
                        DateTime? prepCompleted = null; if (!row.IsPrepCompletedNull()) prepCompleted = (DateTime)row.PrepCompleted;
                        string measuredLatLength = ""; if (!row.IsMeasuredLatLengthNull()) measuredLatLength = row.MeasuredLatLength;
                        string measurementsTakenBy = ""; if (!row.IsMeasurementsTakenByNull()) measurementsTakenBy = row.MeasurementsTakenBy;
                        DateTime? linerInstalled = null; if (!row.IsLinerInstalledNull()) linerInstalled = (DateTime)row.LinerInstalled;
                        DateTime? finalVideo = null; if (!row.IsFinalVideoNull()) finalVideo = (DateTime)row.FinalVideo;
                        bool restorationComplete = row.RestorationComplete;
                        bool linerOrdered = row.LinerOrdered;
                        bool linerInStock = row.LinerInStock;
                        decimal? linerPrice = null; if (!row.IsLinerPriceNull()) linerPrice = (decimal)row.LinerPrice;
                        string comments = ""; if (!row.IsCommentsNull()) comments = row.Comments;
                        bool deleted = false;
                        bool archived = row.Archived;

                        LFSRecordJuntionLiner lfsRecordJuntionLiner = new LFSRecordJuntionLiner(null);
                        lfsRecordJuntionLiner.InsertDirect(newId, row.RefID, row.COMPANY_ID, row.DetailID, mn, distanceFromUSMH, confirmedLatSize, lateralMaterial, sharedLateral, cleanoutRequired, pitRequired, mHShot , mainConnection, transition, cleanoutInstalled, pitInstalled, cleanoutGrouted, cleanoutCored, prepCompleted, measuredLatLength, measurementsTakenBy, linerInstalled, finalVideo, restorationComplete, linerOrdered, linerInStock, linerPrice, comments, deleted, archived);
                    }

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

                        // original values
                        string originalMn = viewJLinersheetJunctionLinerGateway.GetMNOriginal(id, refId, companyId);
                        double? originalDistanceFromUSMH = viewJLinersheetJunctionLinerGateway.GetDistanceFromUSMHOriginal(id, refId, companyId);
                        string originalConfirmedLatSize = viewJLinersheetJunctionLinerGateway.GetConfirmedLatSizeOriginal(id, refId, companyId);
                        string originalLateralMaterial = viewJLinersheetJunctionLinerGateway.GetLateralMaterialOriginal(id, refId, companyId);
                        string originalSharedLateral = viewJLinersheetJunctionLinerGateway.GetSharedLateralOriginal(id, refId, companyId);
                        bool originalCleanoutRequired = viewJLinersheetJunctionLinerGateway.GetCleanoutRequiredOriginal(id, refId, companyId);
                        bool originalPitRequired = viewJLinersheetJunctionLinerGateway.GetPitRequiredOriginal(id, refId, companyId);
                        bool originalMHShot = viewJLinersheetJunctionLinerGateway.GetMHShotOriginal(id, refId, companyId);
                        string originalMainConnection = viewJLinersheetJunctionLinerGateway.GetMainConnectionOriginal(id, refId, companyId);
                        string originalTransition = viewJLinersheetJunctionLinerGateway.GetTransitionOriginal(id, refId, companyId);
                        bool originalCleanoutInstalled = viewJLinersheetJunctionLinerGateway.GetCleanoutInstalledOriginal(id, refId, companyId);
                        bool originalPitInstalled = viewJLinersheetJunctionLinerGateway.GetPitInstalledOriginal(id, refId, companyId);
                        bool originalCleanoutGrouted = viewJLinersheetJunctionLinerGateway.GetCleanoutGroutedOriginal(id, refId, companyId);
                        bool originalCleanoutCored = viewJLinersheetJunctionLinerGateway.GetCleanoutCoredOriginal(id, refId, companyId);
                        DateTime? originalPrepCompleted = viewJLinersheetJunctionLinerGateway.GetPrepCompletedOriginal(id, refId, companyId);
                        string originalMeasuredLatLength = viewJLinersheetJunctionLinerGateway.GetMeasuredLatLengthOriginal(id, refId, companyId);
                        string originalMeasurementsTakenBy = viewJLinersheetJunctionLinerGateway.GetMeasurementsTakenByOriginal(id, refId, companyId);
                        DateTime? originalLinerInstalled = viewJLinersheetJunctionLinerGateway.GetLinerInstalledOriginal(id, refId, companyId);
                        DateTime? originalFinalVideo = viewJLinersheetJunctionLinerGateway.GetFinalVideoOriginal(id, refId, companyId);
                        bool originalRestorationComplete = viewJLinersheetJunctionLinerGateway.GetRestorationCompleteOriginal(id, refId, companyId);
                        bool originalLinerOrdered = viewJLinersheetJunctionLinerGateway.GetLinerOrderedOriginal(id, refId, companyId);
                        bool originalLinerInStock = viewJLinersheetJunctionLinerGateway.GetLinerInStockOriginal(id, refId, companyId);
                        decimal? originalLinerPrice = viewJLinersheetJunctionLinerGateway.GetLinerPriceOriginal(id, refId, companyId);
                        string originalComments = viewJLinersheetJunctionLinerGateway.GetCommentsOriginal(id, refId, companyId);
                        bool originalDeleted = false;
                        bool originalArchived = viewJLinersheetJunctionLinerGateway.GetArchivedOriginal(id, refId, companyId);

                        // new values
                        string newMn = viewJLinersheetJunctionLinerGateway.GetMN(id, refId, companyId);
                        double? newDistanceFromUSMH = viewJLinersheetJunctionLinerGateway.GetDistanceFromUSMH(id, refId, companyId);
                        string newConfirmedLatSize = viewJLinersheetJunctionLinerGateway.GetConfirmedLatSize(id, refId, companyId);
                        string newLateralMaterial = viewJLinersheetJunctionLinerGateway.GetLateralMaterial(id, refId, companyId);
                        string newSharedLateral = viewJLinersheetJunctionLinerGateway.GetSharedLateral(id, refId, companyId);
                        bool newCleanoutRequired = viewJLinersheetJunctionLinerGateway.GetCleanoutRequired(id, refId, companyId);
                        bool newPitRequired = viewJLinersheetJunctionLinerGateway.GetPitRequired(id, refId, companyId);
                        bool newMHShot = viewJLinersheetJunctionLinerGateway.GetMHShot(id, refId, companyId);
                        string newMainConnection = viewJLinersheetJunctionLinerGateway.GetMainConnection(id, refId, companyId);
                        string newTransition = viewJLinersheetJunctionLinerGateway.GetTransition(id, refId, companyId);
                        bool newCleanoutInstalled = viewJLinersheetJunctionLinerGateway.GetCleanoutInstalled(id, refId, companyId);
                        bool newPitInstalled = viewJLinersheetJunctionLinerGateway.GetPitInstalled(id, refId, companyId);
                        bool newCleanoutGrouted = viewJLinersheetJunctionLinerGateway.GetCleanoutGrouted(id, refId, companyId);
                        bool newCleanoutCored = viewJLinersheetJunctionLinerGateway.GetCleanoutCored(id, refId, companyId);
                        DateTime? newPrepCompleted = viewJLinersheetJunctionLinerGateway.GetPrepCompleted(id, refId, companyId);
                        string newMeasuredLatLength = viewJLinersheetJunctionLinerGateway.GetMeasuredLatLength(id, refId, companyId);
                        string newMeasurementsTakenBy = viewJLinersheetJunctionLinerGateway.GetMeasurementsTakenBy(id, refId, companyId);
                        DateTime? newLinerInstalled = viewJLinersheetJunctionLinerGateway.GetLinerInstalled(id, refId, companyId);
                        DateTime? newFinalVideo = viewJLinersheetJunctionLinerGateway.GetFinalVideo(id, refId, companyId);
                        bool newRestorationComplete = viewJLinersheetJunctionLinerGateway.GetRestorationComplete(id, refId, companyId);
                        bool newLinerOrdered = viewJLinersheetJunctionLinerGateway.GetLinerOrdered(id, refId, companyId);
                        bool newLinerInStock = viewJLinersheetJunctionLinerGateway.GetLinerInStock(id, refId, companyId);
                        decimal? newLinerPrice = viewJLinersheetJunctionLinerGateway.GetLinerPrice(id, refId, companyId);
                        string newComments = viewJLinersheetJunctionLinerGateway.GetComments(id, refId, companyId);
                        bool newDeleted = false;
                        bool newArchived = viewJLinersheetJunctionLinerGateway.GetArchived(id, refId, companyId);

                        LFSRecordJuntionLiner lfsRecordJuntionLiner = new LFSRecordJuntionLiner(null);
                        lfsRecordJuntionLiner.UpdateDirect(id, refId, row.COMPANY_ID, row.DetailID, originalMn, originalDistanceFromUSMH, originalConfirmedLatSize, originalLateralMaterial, originalSharedLateral, originalCleanoutRequired, originalPitRequired, originalMHShot, originalMainConnection, originalTransition, originalCleanoutInstalled, originalPitInstalled, originalCleanoutGrouted, originalCleanoutCored, originalPrepCompleted, originalMeasuredLatLength, originalMeasurementsTakenBy, originalLinerInstalled, originalFinalVideo, originalRestorationComplete, originalLinerOrdered, originalLinerInStock, originalLinerPrice, originalComments, originalDeleted, originalArchived, id, refId, row.COMPANY_ID, row.DetailID, newMn, newDistanceFromUSMH, newConfirmedLatSize, newLateralMaterial, newSharedLateral, newCleanoutRequired, newPitRequired, newMHShot, newMainConnection, newTransition, newCleanoutInstalled, newPitInstalled, newCleanoutGrouted, newCleanoutCored, newPrepCompleted, newMeasuredLatLength, newMeasurementsTakenBy, newLinerInstalled, newFinalVideo, newRestorationComplete, newLinerOrdered, newLinerInStock, newLinerPrice, newComments, newDeleted, newArchived);
                    }

                    // Deleted notes
                    if ((row.Deleted) && (row.InDatabase))
                    {
                        LFSRecordJuntionLiner lfsRecordJuntionLiner = new LFSRecordJuntionLiner(null);
                        lfsRecordJuntionLiner.DeleteDirect(row.ID, row.RefID, row.COMPANY_ID);
                    }
                }
            }
        }
コード例 #3
0
        protected void grdJlinerSheet_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Edit) || (e.Row.RowState == (DataControlRowState.Edit | DataControlRowState.Alternate))))
            {
                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);

                ViewJLinersheetJunctionLinerGateway viewJLinersheetJunctionLinerGateway = new ViewJLinersheetJunctionLinerGateway(viewJLinersheetTDS);

                // For Prep Completed
                if (viewJLinersheetJunctionLinerGateway.Table.Rows.Count > 0)
                {
                    if (viewJLinersheetJunctionLinerGateway.GetPrepCompleted(id, refId, companyId).HasValue)
                    {
                        ((RadDatePicker)e.Row.FindControl("tkrdpPrepCompletedEdit")).SelectedDate = viewJLinersheetJunctionLinerGateway.GetPrepCompleted(id, refId, companyId);
                    }
                }

                // For Liner Installed
                if (viewJLinersheetJunctionLinerGateway.Table.Rows.Count > 0)
                {
                    if (viewJLinersheetJunctionLinerGateway.GetLinerInstalled(id, refId, companyId).HasValue)
                    {
                        ((RadDatePicker)e.Row.FindControl("tkrdpLinerInstalledEdit")).SelectedDate = viewJLinersheetJunctionLinerGateway.GetLinerInstalled(id, refId, companyId);
                    }
                }

                // For Final Video
                if (viewJLinersheetJunctionLinerGateway.Table.Rows.Count > 0)
                {
                    if (viewJLinersheetJunctionLinerGateway.GetFinalVideo(id, refId, companyId).HasValue)
                    {
                        ((RadDatePicker)e.Row.FindControl("tkrdpFinalVideoEdit")).SelectedDate = viewJLinersheetJunctionLinerGateway.GetFinalVideo(id, refId, companyId);
                    }
                }

                // For Transition
                if (viewJLinersheetJunctionLinerGateway.Table.Rows.Count > 0)
                {
                    ((DropDownList)e.Row.FindControl("ddlTransitionEdit")).SelectedValue = viewJLinersheetJunctionLinerGateway.GetTransition(id, refId, companyId);
                }

                // For Main connection
                if (viewJLinersheetJunctionLinerGateway.Table.Rows.Count > 0)
                {
                    ((DropDownList)e.Row.FindControl("ddlMainConnectionEdit")).SelectedValue = viewJLinersheetJunctionLinerGateway.GetMainConnection(id, refId, companyId);
                }

                // For Shared Lateral
                if (viewJLinersheetJunctionLinerGateway.Table.Rows.Count > 0)
                {
                    ((DropDownList)e.Row.FindControl("ddlSharedLateralEdit")).SelectedValue = viewJLinersheetJunctionLinerGateway.GetSharedLateral(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 the limit is reached
                ViewJLinersheetJunctionLiner viewJLinersheetJunctionLinerForDetailId = new ViewJLinersheetJunctionLiner(viewJLinersheetTDS);
                string newDetailId = viewJLinersheetJunctionLinerForDetailId.GetNewDetailId(viewJLinersheetTDS);

                if (newDetailId != "-1")
                {
                    ((Label)e.Row.FindControl("lblMnFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblDistanceFromUsmhFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblConfirmedLatSizeFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblLateralMaterialFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblSharedLateralFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblCleanoutRequiredFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblPitRequiredFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblMhShotFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblMainConnectionFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblTransitionFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblCleanoutInstalledFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblCleanoutGroutedFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblClenoutCoredFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblPitInstalledFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblPrepCompletedFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblMeasuredLatLengthFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblMeasurementsTakenByFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblLinerInstalledFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblFinalVideoFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblRestorationCompleteFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblLinerOrdered")).Visible = true;
                    ((Label)e.Row.FindControl("lblLinerInStockFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblLinerPriceFooter")).Visible = true;
                    ((Label)e.Row.FindControl("lblCommentsFooter")).Visible = true;

                    ((TextBox)e.Row.FindControl("tbxMnFooter")).Visible = true;
                    ((TextBox)e.Row.FindControl("tbxDistanceFromUsmhFooter")).Visible = true;
                    ((TextBox)e.Row.FindControl("tbxConfirmedLatSizeFooter")).Visible = true;
                    ((TextBox)e.Row.FindControl("tbxLateralMaterialFooter")).Visible = true;
                    ((DropDownList)e.Row.FindControl("ddlSharedLateralFooter")).Visible = true;
                    ((CheckBox)e.Row.FindControl("ckbxCleanoutRequiredFooter")).Visible = true;
                    ((CheckBox)e.Row.FindControl("ckbxPitRequiredFooter")).Visible = true;
                    ((CheckBox)e.Row.FindControl("ckbxMhShotFooter")).Visible = true;
                    ((DropDownList)e.Row.FindControl("ddlMainConnectionFooter")).Visible = true;
                    ((DropDownList)e.Row.FindControl("ddlTransitionFooter")).Visible = true;
                    ((CheckBox)e.Row.FindControl("ckbxCleanoutInstalledFooter")).Visible = true;
                    ((CheckBox)e.Row.FindControl("ckbxPitInstalledFooter")).Visible = true;
                    ((CheckBox)e.Row.FindControl("ckbxCleanoutGroutedFooter")).Visible = true;
                    ((CheckBox)e.Row.FindControl("ckbxCleanoutCoredFooter")).Visible = true;
                    ((RadDatePicker)e.Row.FindControl("tkrdpPrepCompletedFooter")).Visible = true;
                    ((TextBox)e.Row.FindControl("tbxMeasuredLatLengthFooter")).Visible = true;
                    ((TextBox)e.Row.FindControl("tbxMeasurementsTakenByFooter")).Visible = true;
                    ((RadDatePicker)e.Row.FindControl("tkrdpLinerInstalledFooter")).Visible = true;
                    ((RadDatePicker)e.Row.FindControl("tkrdpFinalVideoFooter")).Visible = true;
                    ((CheckBox)e.Row.FindControl("ckbxRestorationCompleteFooter")).Visible = true;
                    ((CheckBox)e.Row.FindControl("ckbxLinerOrderedFooter")).Visible = true;
                    ((CheckBox)e.Row.FindControl("ckbxLinerInStockFooter")).Visible = true;
                    ((TextBox)e.Row.FindControl("tbxLinerPriceFooter")).Visible = true;
                    ((TextBox)e.Row.FindControl("tbxCommentFooter")).Visible = true;
                    e.Row.FindControl("ibtnAdd").Visible = true;
                    lblMaxNumber.Visible = false;

                    if (!Convert.ToBoolean(Session["sgLFS_APP_EDIT"]))
                    {
                        ((Label)e.Row.FindControl("lblMnFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblDistanceFromUsmhFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblConfirmedLatSizeFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblLateralMaterialFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblSharedLateralFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblCleanoutRequiredFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblPitRequiredFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblMhShotFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblMainConnectionFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblTransitionFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblCleanoutInstalledFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblCleanoutGroutedFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblClenoutCoredFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblPitInstalledFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblPrepCompletedFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblMeasuredLatLengthFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblMeasurementsTakenByFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblLinerInstalledFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblFinalVideoFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblRestorationCompleteFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblLinerOrdered")).Visible = false;
                        ((Label)e.Row.FindControl("lblLinerInStockFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblLinerPriceFooter")).Visible = false;
                        ((Label)e.Row.FindControl("lblCommentsFooter")).Visible = false;

                        ((TextBox)e.Row.FindControl("tbxMnFooter")).Visible = false;
                        ((TextBox)e.Row.FindControl("tbxDistanceFromUsmhFooter")).Visible = false;
                        ((TextBox)e.Row.FindControl("tbxConfirmedLatSizeFooter")).Visible = false;
                        ((TextBox)e.Row.FindControl("tbxLateralMaterialFooter")).Visible = false;
                        ((DropDownList)e.Row.FindControl("ddlSharedLateralFooter")).Visible = false;
                        ((CheckBox)e.Row.FindControl("ckbxCleanoutRequiredFooter")).Visible = false;
                        ((CheckBox)e.Row.FindControl("ckbxPitRequiredFooter")).Visible = false;
                        ((CheckBox)e.Row.FindControl("ckbxMhShotFooter")).Visible = false;
                        ((DropDownList)e.Row.FindControl("ddlMainConnectionFooter")).Visible = false;
                        ((DropDownList)e.Row.FindControl("ddlTransitionFooter")).Visible = false;
                        ((CheckBox)e.Row.FindControl("ckbxCleanoutInstalledFooter")).Visible = false;
                        ((CheckBox)e.Row.FindControl("ckbxPitInstalledFooter")).Visible = false;
                        ((CheckBox)e.Row.FindControl("ckbxCleanoutGroutedFooter")).Visible = false;
                        ((CheckBox)e.Row.FindControl("ckbxCleanoutCoredFooter")).Visible = false;
                        ((RadDatePicker)e.Row.FindControl("tkrdpPrepCompletedFooter")).Visible = false;
                        ((TextBox)e.Row.FindControl("tbxMeasuredLatLengthFooter")).Visible = false;
                        ((TextBox)e.Row.FindControl("tbxMeasurementsTakenByFooter")).Visible = false;
                        ((RadDatePicker)e.Row.FindControl("tkrdpLinerInstalledFooter")).Visible = false;
                        ((RadDatePicker)e.Row.FindControl("tkrdpFinalVideoFooter")).Visible = false;
                        ((CheckBox)e.Row.FindControl("ckbxRestorationCompleteFooter")).Visible = false;
                        ((CheckBox)e.Row.FindControl("ckbxLinerOrderedFooter")).Visible = false;
                        ((CheckBox)e.Row.FindControl("ckbxLinerInStockFooter")).Visible = false;
                        ((TextBox)e.Row.FindControl("tbxLinerPriceFooter")).Visible = false;
                        ((TextBox)e.Row.FindControl("tbxCommentFooter")).Visible = false;
                        e.Row.FindControl("ibtnAdd").Visible = false;
                    }
                }
                else
                {
                    ((Label)e.Row.FindControl("lblMnFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblDistanceFromUsmhFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblConfirmedLatSizeFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblLateralMaterialFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblSharedLateralFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblCleanoutRequiredFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblPitRequiredFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblMhShotFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblMainConnectionFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblTransitionFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblCleanoutInstalledFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblCleanoutGroutedFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblClenoutCoredFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblPitInstalledFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblPrepCompletedFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblMeasuredLatLengthFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblMeasurementsTakenByFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblLinerInstalledFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblFinalVideoFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblRestorationCompleteFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblLinerOrdered")).Visible = false;
                    ((Label)e.Row.FindControl("lblLinerInStockFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblLinerPriceFooter")).Visible = false;
                    ((Label)e.Row.FindControl("lblCommentsFooter")).Visible = false;

                    ((TextBox)e.Row.FindControl("tbxMnFooter")).Visible = false;
                    ((TextBox)e.Row.FindControl("tbxDistanceFromUsmhFooter")).Visible = false;
                    ((TextBox)e.Row.FindControl("tbxConfirmedLatSizeFooter")).Visible = false;
                    ((TextBox)e.Row.FindControl("tbxLateralMaterialFooter")).Visible = false;
                    ((DropDownList)e.Row.FindControl("ddlSharedLateralFooter")).Visible = false;
                    ((CheckBox)e.Row.FindControl("ckbxCleanoutRequiredFooter")).Visible = false;
                    ((CheckBox)e.Row.FindControl("ckbxPitRequiredFooter")).Visible = false;
                    ((CheckBox)e.Row.FindControl("ckbxMhShotFooter")).Visible = false;
                    ((DropDownList)e.Row.FindControl("ddlMainConnectionFooter")).Visible = false;
                    ((DropDownList)e.Row.FindControl("ddlTransitionFooter")).Visible = false;
                    ((CheckBox)e.Row.FindControl("ckbxCleanoutInstalledFooter")).Visible = false;
                    ((CheckBox)e.Row.FindControl("ckbxPitInstalledFooter")).Visible = false;
                    ((CheckBox)e.Row.FindControl("ckbxCleanoutGroutedFooter")).Visible = false;
                    ((CheckBox)e.Row.FindControl("ckbxCleanoutCoredFooter")).Visible = false;
                    ((RadDatePicker)e.Row.FindControl("tkrdpPrepCompletedFooter")).Visible = false;
                    ((TextBox)e.Row.FindControl("tbxMeasuredLatLengthFooter")).Visible = false;
                    ((TextBox)e.Row.FindControl("tbxMeasurementsTakenByFooter")).Visible = false;
                    ((RadDatePicker)e.Row.FindControl("tkrdpLinerInstalledFooter")).Visible = false;
                    ((RadDatePicker)e.Row.FindControl("tkrdpFinalVideoFooter")).Visible = false;
                    ((CheckBox)e.Row.FindControl("ckbxRestorationCompleteFooter")).Visible = false;
                    ((CheckBox)e.Row.FindControl("ckbxLinerOrderedFooter")).Visible = false;
                    ((CheckBox)e.Row.FindControl("ckbxLinerInStockFooter")).Visible = false;
                    ((TextBox)e.Row.FindControl("tbxLinerPriceFooter")).Visible = false;
                    ((TextBox)e.Row.FindControl("tbxCommentFooter")).Visible = false;
                    e.Row.FindControl("ibtnAdd").Visible = false;
                    lblMaxNumber.Visible = false;
                }
            }
        }