private void GrdJlinerSheetAdd() { if (ValidateFooter()) { Page.Validate("dataFooter"); if (Page.IsValid) { Guid id = new Guid(tbxID.Text); int companyId = Convert.ToInt32(Session["companyID"]); ViewJLinersheetJunctionLiner viewJLinersheetJunctionLinerForDetailId = new ViewJLinersheetJunctionLiner(viewJLinersheetTDS); string detailId = viewJLinersheetJunctionLinerForDetailId.GetNewDetailId(viewJLinersheetTDS); string mn = ""; if (((TextBox)grdJlinerSheet.FooterRow.FindControl("tbxMnFooter")).Text.Trim() != "") mn = ((TextBox)grdJlinerSheet.FooterRow.FindControl("tbxMnFooter")).Text.Trim(); double? distanceFromUsmh = null; if (((TextBox)grdJlinerSheet.FooterRow.FindControl("tbxDistanceFromUsmhFooter")).Text.Trim() != "") distanceFromUsmh = double.Parse(((TextBox)grdJlinerSheet.FooterRow.FindControl("tbxDistanceFromUsmhFooter")).Text.Trim()); string confirmedLatSize = ""; if (((TextBox)grdJlinerSheet.FooterRow.FindControl("tbxConfirmedLatSizeFooter")).Text.Trim() != "") confirmedLatSize = ((TextBox)grdJlinerSheet.FooterRow.FindControl("tbxConfirmedLatSizeFooter")).Text.Trim(); string lateralMaterial = ""; if (((TextBox)grdJlinerSheet.FooterRow.FindControl("tbxLateralMaterialFooter")).Text.Trim() != "") lateralMaterial = ((TextBox)grdJlinerSheet.FooterRow.FindControl("tbxLateralMaterialFooter")).Text.Trim(); string sharedLateral = ""; if (((DropDownList)grdJlinerSheet.FooterRow.FindControl("ddlSharedLateralFooter")).Text.Trim() != "") sharedLateral = ((DropDownList)grdJlinerSheet.FooterRow.FindControl("ddlSharedLateralFooter")).SelectedValue; bool cleanoutRequired = ((CheckBox)grdJlinerSheet.FooterRow.FindControl("ckbxCleanoutRequiredFooter")).Checked; bool pitRequired = ((CheckBox)grdJlinerSheet.FooterRow.FindControl("ckbxPitRequiredFooter")).Checked; bool mHShot = ((CheckBox)grdJlinerSheet.FooterRow.FindControl("ckbxMhShotFooter")).Checked; string mainConnection = ""; if (((DropDownList)grdJlinerSheet.FooterRow.FindControl("ddlMainConnectionFooter")).Text.Trim() != "") mainConnection = ((DropDownList)grdJlinerSheet.FooterRow.FindControl("ddlMainConnectionFooter")).SelectedValue; string transition = ""; if (((DropDownList)grdJlinerSheet.FooterRow.FindControl("ddlTransitionFooter")).Text.Trim() != "") transition = ((DropDownList)grdJlinerSheet.FooterRow.FindControl("ddlTransitionFooter")).SelectedValue; bool cleanoutInstalled = ((CheckBox)grdJlinerSheet.FooterRow.FindControl("ckbxCleanoutInstalledFooter")).Checked; bool pitInstalled = ((CheckBox)grdJlinerSheet.FooterRow.FindControl("ckbxPitInstalledFooter")).Checked; bool cleanoutGrouted = ((CheckBox)grdJlinerSheet.FooterRow.FindControl("ckbxCleanoutGroutedFooter")).Checked; bool cleanoutCored = ((CheckBox)grdJlinerSheet.FooterRow.FindControl("ckbxCleanoutCoredFooter")).Checked; DateTime? prepCompleted = null; if (((RadDatePicker)grdJlinerSheet.FooterRow.FindControl("tkrdpPrepCompletedFooter")).SelectedDate.HasValue) prepCompleted = ((RadDatePicker)grdJlinerSheet.FooterRow.FindControl("tkrdpPrepCompletedFooter")).SelectedDate.Value; string measuredLatLength = ""; if (((TextBox)grdJlinerSheet.FooterRow.FindControl("tbxMeasuredLatLengthFooter")).Text.Trim() != "") measuredLatLength = ((TextBox)grdJlinerSheet.FooterRow.FindControl("tbxMeasuredLatLengthFooter")).Text.Trim(); string measurementsTakenBy = ""; if (((TextBox)grdJlinerSheet.FooterRow.FindControl("tbxMeasurementsTakenByFooter")).Text.Trim() != "") measurementsTakenBy = ((TextBox)grdJlinerSheet.FooterRow.FindControl("tbxMeasurementsTakenByFooter")).Text.Trim(); DateTime? linerInstalled = null; if (((RadDatePicker)grdJlinerSheet.FooterRow.FindControl("tkrdpLinerInstalledFooter")).SelectedDate.HasValue) linerInstalled = ((RadDatePicker)grdJlinerSheet.FooterRow.FindControl("tkrdpLinerInstalledFooter")).SelectedDate.Value; DateTime? finalVideo = null; if (((RadDatePicker)grdJlinerSheet.FooterRow.FindControl("tkrdpFinalVideoFooter")).SelectedDate.HasValue) finalVideo = ((RadDatePicker)grdJlinerSheet.FooterRow.FindControl("tkrdpFinalVideoFooter")).SelectedDate.Value; bool restorationComplete = ((CheckBox)grdJlinerSheet.FooterRow.FindControl("ckbxRestorationCompleteFooter")).Checked; bool linerOrdered = ((CheckBox)grdJlinerSheet.FooterRow.FindControl("ckbxLinerOrderedFooter")).Checked; bool linerInStock = ((CheckBox)grdJlinerSheet.FooterRow.FindControl("ckbxLinerInStockFooter")).Checked; decimal? linerPrice = null; if (((TextBox)grdJlinerSheet.FooterRow.FindControl("tbxLinerPriceFooter")).Text.Trim() != "") linerPrice = decimal.Parse(((TextBox)grdJlinerSheet.FooterRow.FindControl("tbxLinerPriceFooter")).Text.Trim()); string comments = ""; if (((TextBox)grdJlinerSheet.FooterRow.FindControl("tbxCommentFooter")).Text.Trim() != "") comments = ((TextBox)grdJlinerSheet.FooterRow.FindControl("tbxCommentFooter")).Text.Trim(); bool archived = false; bool deleted = false; bool inDatabase = false; ViewJLinersheetJunctionLiner model = new ViewJLinersheetJunctionLiner(viewJLinersheetTDS); model.Insert(id, companyId, 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, inDatabase); Session.Remove("jlinerDummy"); Session["viewJLinersheetTDS"] = viewJLinersheetTDS; jliner = viewJLinersheetTDS.JunctionLiner; Session["jliner"] = jliner; grdJlinerSheet.DataBind(); grdJlinerSheet.PageIndex = grdJlinerSheet.PageCount - 1; } } }
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; } } }