private PrNavigatorTDS SubmitSearch() { // Retrieve clauses string whereClause = GetWhereClause(); string orderByClause = GetOrderByClause(); string workType = hdfWorkType.Value.Trim(); string conditionValue1 = ""; string conditionValue2 = ""; string name = ""; int companyId = Int32.Parse(hdfCompanyId.Value.Trim()); int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.Trim()); // ... Load data for condition 1 WorkTypeViewConditionGateway workTypeViewConditionGateway = new WorkTypeViewConditionGateway(); workTypeViewConditionGateway.LoadByWorkTypeConditionId(workType, int.Parse(ddlCondition1.SelectedValue), companyId); name = workTypeViewConditionGateway.GetName(workType, companyId, int.Parse(ddlCondition1.SelectedValue)); conditionValue1 = workTypeViewConditionGateway.GetColumn_(workType, companyId, int.Parse(ddlCondition1.SelectedValue)); // ... If condition 2 exists if (ddlCondition2.SelectedValue != "-1") { // ... Load data for condition 2 WorkTypeViewConditionGateway workTypeViewConditionGateway2 = new WorkTypeViewConditionGateway(); workTypeViewConditionGateway2.LoadByWorkTypeConditionId(workType, int.Parse(ddlCondition2.SelectedValue), companyId); conditionValue2 = workTypeViewConditionGateway2.GetColumn_(workType, companyId, int.Parse(ddlCondition2.SelectedValue)); } // ... Load data PrNavigator prNavigator = new PrNavigator(); prNavigator.Load(whereClause, orderByClause, conditionValue1, tbxCondition1.Text.Trim(), conditionValue2, tbxCondition2.Text.Trim(), companyId, currentProjectId, workType, name); return (PrNavigatorTDS)prNavigator.Data; }
private string modifyWhereClauseForCondition(string whereClause, int conditionId, string textForSearch, string operatorValue) { string workType = hdfWorkType.Value.Trim(); int companyId = Int32.Parse(hdfCompanyId.Value.Trim()); WorkTypeViewConditionGateway workTypeViewConditionGateway = new WorkTypeViewConditionGateway(); workTypeViewConditionGateway.LoadByWorkTypeConditionId(workType, conditionId, companyId); string name = workTypeViewConditionGateway.GetName(workType, companyId, conditionId); string conditionValue = workTypeViewConditionGateway.GetColumn_(workType, companyId, conditionId); string tableName = workTypeViewConditionGateway.GetTable_(workType, companyId, conditionId); if (tableName == "AM_ASSET_SEWER_MATERIAL") tableName = "AASM"; if (tableName == "AM_ASSET_SEWER_MH") tableName = "AASMH"; if (tableName == "AM_ASSET_SEWER_SECTION") tableName = "AASS"; if (tableName == "LFS_ASSET_SEWER_SECTION") tableName = "LASS"; if (tableName == "LFS_WORK") tableName = "LW"; if (tableName == "LFS_WORK_FULLLENGTHLINING") tableName = "LWFLL"; if (tableName == "LFS_WORK_FULLLENGTHLINING_M1") tableName = "LWFLLM1"; if (tableName == "LFS_WORK_FULLLENGTHLINING_M2") tableName = "LWFLLM2"; if (tableName == "LFS_WORK_FULLLENGTHLINING_P1") tableName = "LWFLP1"; if (tableName == "LFS_WORK_POINT_REPAIRS") tableName = "LWPR"; if (tableName == "LFS_WORK_POINT_REPAIRS_REPAIR") tableName = "LWPRR"; if (tableName == "LFS_WORK_REHABASSESSMENT") tableName = "LWRA"; if (((conditionValue == "USMH") || (conditionValue == "DSMH") || (conditionValue == "CXIsRemoved") || (conditionValue == "USMHAddress") || (conditionValue == "DSMHAddress") || (conditionValue == "VideoLength") || (conditionValue == "TrafficControl") || (conditionValue == "MaterialType") || (conditionValue == "RoboticPrepRequired")) && (textForSearch == "%")) { whereClause = whereClause + " AND (( AASS.AssetID LIKE '%')"; whereClause = whereClause + " OR ( AASS.AssetID IS NULL))"; } // FOR TEXT FIELDS. (Id(Section), SubArea, Street, Comments, MapSize, Size_, MapLength, Length, ClientID, MeasurementTakenBy, RoboticDistances, RepairPointID, Type, DefectQualifier, DefectDetails, Approval, ReamDistance, LinerDistance, Direction, LTMH, VTMH, Distance, MHShot, GroutDistance, Repair Comments, Repair Size, Repair Length ) if ((conditionValue == "FlowOrderID") || (conditionValue == "SubArea") || (conditionValue == "Street") || (conditionValue == "Comments" && name == "Comments") || (conditionValue == "MapSize") || (conditionValue == "Size_" && name == "Confirmed Size") || (conditionValue == "MapLength") || (conditionValue == "Length" && name == "Steel Tape Length") || (conditionValue == "ClientID") || (conditionValue == "MeasurementTakenBy") || (conditionValue == "RoboticDistances") || (conditionValue == "RepairPointID") || (conditionValue == "Type") || (conditionValue == "DefectQualifier") || (conditionValue == "DefectDetails") || (conditionValue == "Approval") || (conditionValue == "ReamDistance") || (conditionValue == "LinerDistance") || (conditionValue == "Direction") || (conditionValue == "LTMH") || (conditionValue == "VTMH") || (conditionValue == "Distance") || (conditionValue == "MHShot") || (conditionValue == "GroutDistance") || (conditionValue == "Comments" && name == "Repair Comments") || (conditionValue == "Size_" && name == "Repair Size") || (conditionValue == "Length" && name == "Repair Length")) { // ... For operator = if (operatorValue == "=") { // Search if (textForSearch == "%") { whereClause = whereClause + " AND ((" + tableName + "." + conditionValue + " LIKE '%')"; whereClause = whereClause + " OR (" + tableName + "." + conditionValue + " IS NULL))"; } else { if (textForSearch == "") { whereClause = whereClause + " AND (" + tableName + "." + conditionValue + " IS NULL )"; } else { if (textForSearch.Contains("\"")) { if (conditionValue == "Comments") { textForSearch = textForSearch.Replace("'", "''"); whereClause = whereClause + "AND (" + tableName + "." + conditionValue + " LIKE '%" + textForSearch + "%')"; } else { textForSearch = textForSearch.Replace("\"", ""); whereClause = whereClause + "AND (" + tableName + "." + conditionValue + " = '" + textForSearch + "')"; } } else { textForSearch = textForSearch.Replace("'", "''"); whereClause = whereClause + "AND (" + tableName + "." + conditionValue + " LIKE '%" + textForSearch + "%')"; } } } } else { // ... For operator <> if (operatorValue == "<>") { if (textForSearch == "") { whereClause = whereClause + " AND ((" + tableName + "." + conditionValue + " LIKE '%')"; whereClause = whereClause + " OR (" + tableName + "." + conditionValue + " IS NOT NULL))"; } else { if (textForSearch == "%") { whereClause = whereClause + " AND (" + tableName + "." + conditionValue + " IS NULL)"; } else { if (textForSearch.Contains("\"")) { if (conditionValue == "Comments") { textForSearch = textForSearch.Replace("'", "''"); whereClause = whereClause + " AND ((" + tableName + "." + conditionValue + " NOT LIKE '%" + textForSearch + "%')"; whereClause = whereClause + " OR (" + tableName + "." + conditionValue + " IS NULL))"; } else { textForSearch = textForSearch.Replace("\"", ""); whereClause = whereClause + "AND ((" + tableName + "." + conditionValue + " <> '" + textForSearch + "')"; whereClause = whereClause + " OR (" + tableName + "." + conditionValue + " IS NULL))"; } } else { textForSearch = textForSearch.Replace("'", "''"); whereClause = whereClause + " AND ((" + tableName + "." + conditionValue + " NOT LIKE '%" + textForSearch + "%')"; whereClause = whereClause + " OR (" + tableName + "." + conditionValue + " IS NULL))"; } } } } } } else { if (((conditionValue == "USMH") || (conditionValue == "DSMH")) && (textForSearch == "%")) { whereClause = whereClause + " AND (( AASS.AssetID LIKE '%')"; whereClause = whereClause + " OR ( AASS.AssetID IS NULL))"; } } // FOR DATE FIELDS. (ProposedLiningDate, DeadlineLiningDate, FinalVideoDate, RepairConfirmationDate, ReamDate, InstallDate, GroutDate) if ((conditionValue == "ProposedLiningDate") || (conditionValue == "DeadlineLiningDate") || (conditionValue == "FinalVideoDate") || (conditionValue == "RepairConfirmationDate") || (conditionValue == "ReamDate") || (conditionValue == "InstallDate") || (conditionValue == "GroutDate")) { // ... For operator = if (operatorValue == "=") { // ... Search if (textForSearch == "") { whereClause = whereClause + " AND (CAST(CONVERT(varchar," + tableName + "." + conditionValue + ", 101) AS smalldatetime) IS NULL)"; } else { if (textForSearch == "%") { whereClause = whereClause + " AND ((CAST(CONVERT(varchar," + tableName + "." + conditionValue + ", 101) AS smalldatetime) IS NOT NULL) OR "; whereClause = whereClause + "(CAST(CONVERT(varchar," + tableName + "." + conditionValue + ", 101) AS smalldatetime) IS NULL))"; } else { if ((Validator.IsValidDate(textForSearch)) && (textForSearch.Length > 7)) { whereClause = whereClause + " AND ( CAST(CONVERT(varchar," + tableName + "." + conditionValue + ", 101) AS smalldatetime) = '" + textForSearch + "')"; } else { whereClause = whereClause + " AND (CAST(CONVERT(varchar," + tableName + "." + conditionValue + ", 101) AS smalldatetime) LIKE '%" + textForSearch + "%')"; } } } } else { // ... For operator <> if (operatorValue == "<>") { // ... Search if (textForSearch == "") { whereClause = whereClause + " AND (CAST(CONVERT(varchar," + tableName + "." + conditionValue + ", 101) AS smalldatetime) IS NOT NULL)"; } else { if (textForSearch == "%") { whereClause = whereClause + " AND (CAST(CONVERT(varchar," + tableName + "." + conditionValue + ", 101) AS smalldatetime) IS NULL)"; } else { if ((Validator.IsValidDate(textForSearch)) && (textForSearch.Length > 7)) { whereClause = whereClause + " AND ((CAST(CONVERT(varchar," + tableName + "." + conditionValue + ", 101) AS smalldatetime) != '" + textForSearch + "')"; whereClause = whereClause + " OR (CAST(CONVERT(varchar," + tableName + "." + conditionValue + ", 101) AS smalldatetime) IS NULL))"; } else { whereClause = whereClause + " AND ((CAST(CONVERT(varchar," + tableName + "." + conditionValue + ", 101) AS smalldatetime) NOT LIKE '%" + textForSearch + "%')"; whereClause = whereClause + " OR (CAST(CONVERT(varchar," + tableName + "." + conditionValue + ", 101) AS smalldatetime) IS NULL))"; } } } } else { // ... For other operators // ... Determine the operator string whereOperator = ""; if (operatorValue == "'>='") { whereOperator = ">="; } else { if (operatorValue == "'<='") { whereOperator = "<="; } else { whereOperator = operatorValue; } } // ... Determine the where clause if ((Validator.IsValidDate(textForSearch)) && (textForSearch.Length > 7)) { whereClause = whereClause + " AND (CAST(CONVERT(varchar," + tableName + "." + conditionValue + ", 101) AS smalldatetime)" + whereOperator + " '" + textForSearch + "')"; } else { if (operatorValue == ">" || operatorValue == "'<='") { whereClause = whereClause + " AND (CAST(CONVERT(varchar," + tableName + "." + conditionValue + ", 101) AS smalldatetime)" + whereOperator + " '12/31/" + textForSearch + "')"; } else { whereClause = whereClause + " AND (CAST(CONVERT(varchar," + tableName + "." + conditionValue + ", 101) AS smalldatetime)" + whereOperator + " '" + textForSearch + "')"; } } } } } // ... FOR INTEGER AND DOUBLE FIELDS. (Laterals, LiveLaterals, EstimatedJoints, JointsTestSealed, Reinstates) if ((conditionValue == "Laterals") || (conditionValue == "LiveLaterals") || (conditionValue == "EstimatedJoints") || (conditionValue == "JointsTestSealed") || (conditionValue == "Reinstates")) { // ... For operator = if (operatorValue == "=") { if (textForSearch == "") { whereClause = whereClause + " AND (" + tableName + "." + conditionValue + " IS NULL )"; } else { if (textForSearch == "%") { whereClause = whereClause + " AND ((" + tableName + "." + conditionValue + " LIKE '%')"; whereClause = whereClause + " OR (" + tableName + "." + conditionValue + " IS NULL))"; } else { whereClause = whereClause + " AND (" + tableName + "." + conditionValue + operatorValue + textForSearch + ")"; } } } else { // ... For operator <> if (operatorValue == "<>") { if (textForSearch == "") { whereClause = whereClause + " AND ((" + tableName + "." + conditionValue + " LIKE '%')"; whereClause = whereClause + " OR (" + tableName + "." + conditionValue + " IS NOT NULL))"; } else { if (textForSearch == "%") { whereClause = whereClause + " AND (" + tableName + "." + conditionValue + " IS NULL )"; } else { whereClause = whereClause + " AND ((" + tableName + "." + conditionValue + operatorValue + textForSearch + ")"; whereClause = whereClause + " OR (" + tableName + "." + conditionValue + " IS NULL))"; } } } else { // ... For other operators // ... Determine the operator string whereOperator = ""; if (operatorValue == "'>='") { whereOperator = ">="; } else { if (operatorValue == "'<='") { whereOperator = "<="; } else { whereOperator = operatorValue; } } whereClause = whereClause + " AND (" + tableName + "." + conditionValue + whereOperator + textForSearch + ")"; } } } // FOR BOOLEAN FIELDS (BypassRequired, IssueIdentified, IssueLFS, IssueClient, IssueSales, IssueGivenToClient, IssueInvestigation, IssueResolved, ExtraRepair, Cancelled) if ((conditionValue == "BypassRequired") || (conditionValue == "IssueIdentified") || (conditionValue == "IssueLFS") || (conditionValue == "IssueClient") || (conditionValue == "IssueSales") || (conditionValue == "IssueGivenToClient") || (conditionValue == "IssueInvestigation") || (conditionValue == "IssueResolved") || (conditionValue == "ExtraRepair") || (conditionValue == "Cancelled")) { // ... For operator = if (operatorValue == "=") { if (textForSearch != "") { if ((textForSearch.ToUpper() == "Y") || (textForSearch.ToUpper() == "YES")) { whereClause = whereClause + " AND (" + tableName + "." + conditionValue + " = 1)"; } else { if ((textForSearch.ToUpper() == "N") || (textForSearch.ToUpper() == "NO")) { whereClause = whereClause + " AND (" + tableName + "." + conditionValue + " = 0)"; } else { if (textForSearch == "%") { whereClause = whereClause + " AND ((" + tableName + "." + conditionValue + " = 1) OR (" + tableName + "." + conditionValue + " = 0))"; } } } } } else { // ... For operator <> if (operatorValue == "<>") { if (textForSearch != "") { if ((textForSearch.ToUpper() == "Y") || (textForSearch.ToUpper() == "YES")) { whereClause = whereClause + " AND (" + tableName + "." + conditionValue + " = 0)"; } else { if ((textForSearch.ToUpper() == "N") || (textForSearch.ToUpper() == "NO")) { whereClause = whereClause + " AND(" + tableName + "." + conditionValue + " = 1)"; } else { if (textForSearch == "%") { whereClause = whereClause + " AND ((" + tableName + "." + conditionValue + " = 1) OR (" + tableName + "." + conditionValue + " = 0))"; } } } } } } } return whereClause; }
private void RestoreNavigatorState() { // Search condition 1 // Columns To Display string columnsToDisplay = Request.QueryString["columns_to_display"]; string columnsToDisplay2 = Request.QueryString["columns_to_display2"]; // Search condition // ... For Condition 1 odsViewForDisplayList.DataBind(); ddlCondition1.DataSourceID = "odsViewForDisplayList"; ddlCondition1.DataValueField = "ConditionID"; ddlCondition1.DataTextField = "Name"; ddlCondition1.DataBind(); ddlCondition1.SelectedValue = Request.QueryString["search_ddlCondition1"]; tbxCondition1.Text = Request.QueryString["search_tbxCondition1"]; ddlOperator1.SelectedValue = Request.QueryString["search_ddlOperator1"]; // ... For Condition 2 odsViewForDisplayList2.DataBind(); ddlCondition2.DataSourceID = "odsViewForDisplayList2"; ddlCondition2.DataValueField = "ConditionID"; ddlCondition2.DataTextField = "Name"; ddlCondition2.DataBind(); ddlCondition2.SelectedValue = Request.QueryString["search_ddlCondition2"]; tbxCondition2.Text = Request.QueryString["search_tbxCondition2"]; ddlOperator2.SelectedValue = Request.QueryString["search_ddlOperator2"]; // ... For View int companyId = Int32.Parse(hdfCompanyId.Value.Trim()); string workType = hdfWorkType.Value; int loginId = Convert.ToInt32(Session["loginID"]); string viewTypeGlobal = ""; string viewTypePersonal = "Personal"; // Global Views check if (Convert.ToBoolean(Session["sgLFS_GLOBALVIEWS_VIEW"])) { viewTypeGlobal = "Global"; } WorkViewList workViewList = new WorkViewList(); workViewList.LoadAndAddItem(workType, viewTypeGlobal, viewTypePersonal, loginId, companyId); ddlView.DataSource = workViewList.Table; ddlView.DataValueField = "ViewID"; ddlView.DataTextField = "Name"; ddlView.DataBind(); ddlView.SelectedValue = Request.QueryString["search_ddlView"]; //Other values //... For SortBy odsSortByList.DataBind(); ddlSortBy.DataSourceID = "odsSortByList"; ddlSortBy.DataValueField = "SortID"; ddlSortBy.DataTextField = "Name"; ddlSortBy.DataBind(); ddlSortBy.SelectedValue = Request.QueryString["search_sort_by"]; // ... For BtnOrigin hdfBtnOrigin.Value = Request.QueryString["btn_origin"]; cbxIdSection.Checked = (columnsToDisplay2.IndexOf("FlowOrderID") >= 0 ? true : false); cbxIdRepair.Checked = (columnsToDisplay2.IndexOf("RepairPointID") >= 0 ? true : false); cbxSubArea.Checked = (columnsToDisplay2.IndexOf("SubArea") >= 0 ? true : false); cbxStreet.Checked = (columnsToDisplay2.IndexOf("Street") >= 0 ? true : false); cbxUsmh.Checked = (columnsToDisplay2.IndexOf(" USMH,") >= 0 ? true : false); cbxUsmhAddress.Checked = (columnsToDisplay2.IndexOf("USMHAddress") >= 0 ? true : false); cbxDsmh.Checked = (columnsToDisplay2.IndexOf(" DSMH") >= 0 ? true : false); cbxDsmhAddress.Checked = (columnsToDisplay2.IndexOf("DSMHAddress") >= 0 ? true : false); cbxMapSize.Checked = (columnsToDisplay2.IndexOf("MapSize") >= 0 ? true : false); cbxConfirmedSize.Checked = (columnsToDisplay2.IndexOf("Size_") >= 0 ? true : false); cbxMapLength.Checked = (columnsToDisplay2.IndexOf("MapLength") >= 0 ? true : false); cbxSteelTapeLength.Checked = (columnsToDisplay2.IndexOf("Length") >= 0 ? true : false); cbxVideoLength.Checked = (columnsToDisplay2.IndexOf("VideoLength") >= 0 ? true : false); cbxLaterals.Checked = (columnsToDisplay2.IndexOf("Laterals") >= 0 ? true : false); cbxLiveLaterals.Checked = (columnsToDisplay2.IndexOf("LiveLaterals") >= 0 ? true : false); cbxClientId.Checked = (columnsToDisplay2.IndexOf("ClientID") >= 0 ? true : false); cbxMeasurementsTakenBy.Checked = (columnsToDisplay2.IndexOf("MeasurementTakenBy") >= 0 ? true : false); cbxPreFlushDate.Checked = (columnsToDisplay2.IndexOf("PreFlushDate") >= 0 ? true : false); cbxPreVideoDate.Checked = (columnsToDisplay2.IndexOf("PreVideoDate") >= 0 ? true : false); cbxP1Date.Checked = (columnsToDisplay2.IndexOf("P1Date") >= 0 ? true : false); cbxRepairConfirmationDate.Checked = (columnsToDisplay2.IndexOf("RepairConfirmationDate") >= 0 ? true : false); cbxTrafficControl.Checked = (columnsToDisplay2.IndexOf("TrafficControl") >= 0 ? true : false); cbxMaterial.Checked = (columnsToDisplay2.IndexOf("MaterialType") >= 0 ? true : false); cbxBypassRequired.Checked = (columnsToDisplay2.IndexOf("BypassRequired") >= 0 ? true : false); cbxRoboticPrepRequired.Checked = (columnsToDisplay2.IndexOf("RoboticPrepRequired") >= 0 ? true : false); cbxCXIsRemoved.Checked = (columnsToDisplay2.IndexOf("CXIsRemoved") >= 0 ? true : false); cbxRoboticDistances.Checked = (columnsToDisplay2.IndexOf("RoboticDistances") >= 0 ? true : false); cbxProposedLiningDate.Checked = (columnsToDisplay2.IndexOf("ProposedLiningDate") >= 0 ? true : false); cbxDeadlineLiningDate.Checked = (columnsToDisplay2.IndexOf("DeadlineLiningDate") >= 0 ? true : false); cbxGroutDate.Checked = (columnsToDisplay2.IndexOf("GroutDate") >= 0 ? true : false); cbxFinalVideo.Checked = (columnsToDisplay2.IndexOf("FinalVideoDate") >= 0 ? true : false); cbxEstimatedJoints.Checked = (columnsToDisplay2.IndexOf("EstimatedJoints") >= 0 ? true : false); cbxJointsTestSealed.Checked = (columnsToDisplay2.IndexOf("JointsTestSealed") >= 0 ? true : false); cbxIssueIdentified.Checked = (columnsToDisplay2.IndexOf("IssueIdentified") >= 0 ? true : false); cbxLFSIssue.Checked = (columnsToDisplay2.IndexOf("IssueLFS") >= 0 ? true : false); cbxClientIssue.Checked = (columnsToDisplay2.IndexOf("IssueClient") >= 0 ? true : false); cbxSalesIssue.Checked = (columnsToDisplay2.IndexOf("IssueSales") >= 0 ? true : false); cbxIssueGivenToClient.Checked = (columnsToDisplay2.IndexOf("IssueGivenToClient") >= 0 ? true : false); cbxIssueInvestigation.Checked = (columnsToDisplay2.IndexOf("IssueInvestigation") >= 0 ? true : false); cbxIssueResolved.Checked = (columnsToDisplay2.IndexOf("IssueResolved") >= 0 ? true : false); cbxComments.Checked = (columnsToDisplay2.IndexOf("Comments") >= 0 ? true : false); cbxRepairType.Checked = (columnsToDisplay2.IndexOf("Type") >= 0 ? true : false); cbxDefectQualifier.Checked = (columnsToDisplay2.IndexOf("DefectQualifier") >= 0 ? true : false); cbxDefectDetails.Checked = (columnsToDisplay2.IndexOf("DefectDetails") >= 0 ? true : false); cbxExtraRepair.Checked = (columnsToDisplay2.IndexOf("ExtraRepair") >= 0 ? true : false); cbxCancelled.Checked = (columnsToDisplay2.IndexOf("Cancelled") >= 0 ? true : false); cbxApproval.Checked = (columnsToDisplay2.IndexOf("Approval") >= 0 ? true : false); cbxRepairComments.Checked = (columnsToDisplay2.IndexOf("Comments") >= 0 ? true : false); cbxReamDistance.Checked = (columnsToDisplay2.IndexOf("ReamDistance") >= 0 ? true : false); cbxReamDate.Checked = (columnsToDisplay2.IndexOf("ReamDate") >= 0 ? true : false); cbxLinerDistance.Checked = (columnsToDisplay2.IndexOf("LinerDistance") >= 0 ? true : false); cbxDirection.Checked = (columnsToDisplay2.IndexOf("Direction") >= 0 ? true : false); cbxReinstates.Checked = (columnsToDisplay2.IndexOf("Reinstates") >= 0 ? true : false); cbxLtMh.Checked = (columnsToDisplay2.IndexOf("LTMH") >= 0 ? true : false); cbxVtMh.Checked = (columnsToDisplay2.IndexOf("VTMH") >= 0 ? true : false); cbxDistance.Checked = (columnsToDisplay2.IndexOf("Distance") >= 0 ? true : false); cbxRepairSize.Checked = (columnsToDisplay2.IndexOf("Size_") >= 0 ? true : false); cbxRepairLength.Checked = (columnsToDisplay2.IndexOf("Length") >= 0 ? true : false); cbxInstallDate.Checked = (columnsToDisplay2.IndexOf("InstallDate") >= 0 ? true : false); cbxMhShot.Checked = (columnsToDisplay2.IndexOf("MHShot") >= 0 ? true : false); cbxGroutDistance.Checked = (columnsToDisplay2.IndexOf("GroutDistance") >= 0 ? true : false); // Grid's columns grdPrNavigator.Columns[2].Visible = (columnsToDisplay.IndexOf("FlowOrderID") >= 0 ? true : false); grdPrNavigator.Columns[3].Visible = (columnsToDisplay.IndexOf("SubArea") >= 0 ? true : false); grdPrNavigator.Columns[4].Visible = (columnsToDisplay.IndexOf("Street") >= 0 ? true : false); grdPrNavigator.Columns[5].Visible = (columnsToDisplay.IndexOf(" USMH,") >= 0 ? true : false); grdPrNavigator.Columns[6].Visible = (columnsToDisplay.IndexOf("USMHAddress") >= 0 ? true : false); grdPrNavigator.Columns[7].Visible = (columnsToDisplay.IndexOf(" DSMH") >= 0 ? true : false); grdPrNavigator.Columns[8].Visible = (columnsToDisplay.IndexOf("DSMHAddress") >= 0 ? true : false); grdPrNavigator.Columns[9].Visible = (columnsToDisplay.IndexOf("MapSize") >= 0 ? true : false); grdPrNavigator.Columns[10].Visible = (columnsToDisplay.IndexOf("Size_") >= 0 ? true : false); grdPrNavigator.Columns[11].Visible = (columnsToDisplay.IndexOf("MapLength") >= 0 ? true : false); grdPrNavigator.Columns[12].Visible = (columnsToDisplay.IndexOf("Length") >= 0 ? true : false); grdPrNavigator.Columns[13].Visible = (columnsToDisplay.IndexOf("VideoLength") >= 0 ? true : false); grdPrNavigator.Columns[14].Visible = (columnsToDisplay.IndexOf("Laterals") >= 0 ? true : false); grdPrNavigator.Columns[15].Visible = (columnsToDisplay.IndexOf("LiveLaterals") >= 0 ? true : false); grdPrNavigator.Columns[16].Visible = (columnsToDisplay.IndexOf("ClientID") >= 0 ? true : false); grdPrNavigator.Columns[17].Visible = (columnsToDisplay.IndexOf("MeasurementTakenBy") >= 0 ? true : false); grdPrNavigator.Columns[18].Visible = (columnsToDisplay.IndexOf("PreFlushDate") >= 0 ? true : false); grdPrNavigator.Columns[19].Visible = (columnsToDisplay.IndexOf("PreVideoDate") >= 0 ? true : false); grdPrNavigator.Columns[20].Visible = (columnsToDisplay.IndexOf("P1Date") >= 0 ? true : false); grdPrNavigator.Columns[21].Visible = (columnsToDisplay.IndexOf("RepairConfirmationDate") >= 0 ? true : false); grdPrNavigator.Columns[22].Visible = (columnsToDisplay.IndexOf("TrafficControl") >= 0 ? true : false); grdPrNavigator.Columns[23].Visible = (columnsToDisplay.IndexOf("MaterialType") >= 0 ? true : false); grdPrNavigator.Columns[24].Visible = (columnsToDisplay.IndexOf("BypassRequired") >= 0 ? true : false); grdPrNavigator.Columns[25].Visible = (columnsToDisplay.IndexOf("RoboticPrepRequired") >= 0 ? true : false); grdPrNavigator.Columns[26].Visible = (columnsToDisplay.IndexOf("CXIsRemoved") >= 0 ? true : false); grdPrNavigator.Columns[27].Visible = (columnsToDisplay.IndexOf("RoboticDistances") >= 0 ? true : false); grdPrNavigator.Columns[28].Visible = (columnsToDisplay.IndexOf("ProposedLiningDate") >= 0 ? true : false); grdPrNavigator.Columns[29].Visible = (columnsToDisplay.IndexOf("DeadlineLiningDate") >= 0 ? true : false); grdPrNavigator.Columns[30].Visible = (columnsToDisplay.IndexOf("FinalVideoDate") >= 0 ? true : false); grdPrNavigator.Columns[31].Visible = (columnsToDisplay.IndexOf("EstimatedJoints") >= 0 ? true : false); grdPrNavigator.Columns[32].Visible = (columnsToDisplay.IndexOf("JointsTestSealed") >= 0 ? true : false); grdPrNavigator.Columns[33].Visible = (columnsToDisplay.IndexOf("IssueIdentified") >= 0 ? true : false); grdPrNavigator.Columns[34].Visible = (columnsToDisplay.IndexOf("IssueLFS") >= 0 ? true : false); grdPrNavigator.Columns[35].Visible = (columnsToDisplay.IndexOf("IssueClient") >= 0 ? true : false); grdPrNavigator.Columns[36].Visible = (columnsToDisplay.IndexOf("IssueSales") >= 0 ? true : false); grdPrNavigator.Columns[37].Visible = (columnsToDisplay.IndexOf("IssueGivenToClient") >= 0 ? true : false); grdPrNavigator.Columns[38].Visible = (columnsToDisplay.IndexOf("IssueInvestigation") >= 0 ? true : false); grdPrNavigator.Columns[39].Visible = (columnsToDisplay.IndexOf("IssueResolved") >= 0 ? true : false); grdPrNavigator.Columns[40].Visible = (columnsToDisplay.IndexOf("Comments") >= 0 ? true : false); grdPrNavigator.Columns[41].Visible = false; grdPrNavigator.Columns[41].Visible = (columnsToDisplay.IndexOf("RepairPointID") >= 0 ? true : false); // Special case for repairs // For condition 1 WorkTypeViewConditionGateway workTypeViewConditionGateway = new WorkTypeViewConditionGateway(); workTypeViewConditionGateway.LoadByWorkTypeConditionId(workType, int.Parse(ddlCondition1.SelectedValue), companyId); string name = workTypeViewConditionGateway.GetName(workType, companyId, int.Parse(ddlCondition1.SelectedValue)); string conditionValue1 = workTypeViewConditionGateway.GetColumn_(workType, companyId, int.Parse(ddlCondition1.SelectedValue)); if ((conditionValue1 == "RepairPointID") || (conditionValue1 == "Type") || (conditionValue1 == "DefectQualifier") || (conditionValue1 == "DefectDetails") || (conditionValue1 == "ExtraRepair") || (conditionValue1 == "Cancelled") || (conditionValue1 == "Approval") || (conditionValue1 == "Comments" && name == "Repair Comments") || (conditionValue1 == "ReamDistance") || (conditionValue1 == "ReamDate") || (conditionValue1 == "LinerDistance") || (conditionValue1 == "Direction") || (conditionValue1 == "Reinstates") || (conditionValue1 == "LTMH") || (conditionValue1 == "VTMH") || (conditionValue1 == "Distance") || (conditionValue1 == "Size_" && name == "Repair Size") || (conditionValue1 == "Length" && name == "Repair Length") || (conditionValue1 == "InstallDate") || (conditionValue1 == "MHShot") || (conditionValue1 == "GroutDistance") || (conditionValue1 == "GroutDate")) { grdPrNavigator.Columns[41].Visible = true; } if (ddlCondition2.SelectedValue != "-1") { WorkTypeViewConditionGateway workTypeViewConditionGateway2 = new WorkTypeViewConditionGateway(); workTypeViewConditionGateway2.LoadByWorkTypeConditionId(workType, int.Parse(ddlCondition2.SelectedValue), companyId); string name2 = workTypeViewConditionGateway2.GetName(workType, companyId, int.Parse(ddlCondition2.SelectedValue)); string conditionValue2 = workTypeViewConditionGateway2.GetColumn_(workType, companyId, int.Parse(ddlCondition2.SelectedValue)); if ((conditionValue2 == "RepairPointID") || (conditionValue2 == "Type") || (conditionValue2 == "DefectQualifier") || (conditionValue2 == "DefectDetails") || (conditionValue2 == "ExtraRepair") || (conditionValue2 == "Cancelled") || (conditionValue2 == "Approval") || (conditionValue2 == "Comments" && name == "Repair Comments") || (conditionValue2 == "ReamDistance") || (conditionValue2 == "ReamDate") || (conditionValue2 == "LinerDistance") || (conditionValue2 == "Direction") || (conditionValue2 == "Reinstates") || (conditionValue2 == "LTMH") || (conditionValue2 == "VTMH") || (conditionValue2 == "Distance") || (conditionValue2 == "Size_" && name == "Repair Size") || (conditionValue2 == "Length" && name == "Repair Length") || (conditionValue2 == "InstallDate") || (conditionValue2 == "MHShot") || (conditionValue2 == "GroutDistance") || (conditionValue2 == "GroutDate")) { grdPrNavigator.Columns[41].Visible = true; } } }
/// <summary> /// GetConditionsForSummary /// </summary> /// <param name="workType"></param> /// <param name="companyId"></param> /// <returns></returns> public string GetConditionsForSummary(string workType, int companyId) { string conditions = ""; foreach (WorkViewTDS.WorkViewConditionNewRow row in (WorkViewTDS.WorkViewConditionNewDataTable)Data.Tables["WorkViewConditionNew"]) { if (!row.Deleted) { WorkTypeViewCondition workTypeViewCondition = new WorkTypeViewCondition(); workTypeViewCondition.LoadByWorkTypeConditionId(workType, row.ConditionID, companyId); WorkTypeViewConditionGateway workTypeViewConditionGateway = new WorkTypeViewConditionGateway(workTypeViewCondition.Data); if (row.Value_ == "") { conditions = conditions + "Condition" + row.ConditionNumber + ": " + workTypeViewConditionGateway.GetName(workType, companyId, row.ConditionID) + " " + row.Sign + " (empty), "; } else { conditions = conditions + "Condition" + row.ConditionNumber + ": " + workTypeViewConditionGateway.GetName(workType, companyId, row.ConditionID) + " " + row.Sign + " " + row.Value_ + ", "; } } } if (conditions.Length > 2) { conditions = conditions.Substring(0, conditions.Length - 2); } return conditions; }