public static object GetRQMTDataProperty(string cacheType, string propertyType, string key) { object value = null; int id = 0; Int32.TryParse(key, out id); // some keys will be plain strings, but we do this up here as a helper for downstream code that expects ids or numbers if (cacheType == WTSCacheType.RQMT_TYPE) { DataTable dt = MasterData.RQMT_TypeList_Get(true); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { int idFound = Convert.ToInt32(row["RQMTTypeID"]); if (idFound == id) { if (propertyType == WTSCachePropertyType.NAME) { value = row["RQMTType"].ToString(); } else if (propertyType == WTSCachePropertyType.DATAROW) { value = row; } else { value = row[propertyType] != DBNull.Value ? row[propertyType].ToString() : null; } break; } } } } else if (cacheType == WTSCacheType.RQMT_COMPLEXITY) { DataTable dt = RQMT.RQMTComplexityList_Get(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { int idFound = Convert.ToInt32(row["RQMTComplexityID"]); if (idFound == id) { if (key == WTSCachePropertyType.NAME) { value = row["RQMTComplexity"].ToString(); } else if (propertyType == WTSCachePropertyType.DATAROW) { value = row; } else { value = row[propertyType] != DBNull.Value ? row[propertyType].ToString() : null; } break; } } } } return(value); }
private void LoadControls() { // suites ddl DataTable dtSuites = MasterData.SystemSuiteList_Get(0); PopulateDDLFromDataTable(ddlSuite, dtSuites, "WTS_SYSTEM_SUITEID", "WTS_SYSTEM_SUITE", null, null, false); SuiteOptions = CreateOptionStringFromDataTable(dtSuites, "WTS_SYSTEM_SUITEID", "WTS_SYSTEM_SUITE", "0", "", true); // systems DataTable dtSystems = MasterData.SystemList_Get(includeArchive: true, WTS_SYSTEM_SUITEID: 0); SystemOptions = CreateOptionStringFromDataTable(dtSystems, "WTS_SYSTEMID", "WTS_SYSTEM", "0", "", true); List <string> columnsToRemove = new List <string>(); List <string> columnsToKeep = new List <string>() { "WTS_SystemSuiteID", "WTS_SystemSuite", "WTS_SystemID", "WTS_SYSTEM" }; foreach (DataColumn col in dtSystems.Columns) { if (!columnsToKeep.Contains(col.ColumnName)) { columnsToRemove.Add(col.ColumnName); } } foreach (string colName in columnsToRemove) { dtSystems.Columns.Remove(colName); } dtSystems.AcceptChanges(); dtSystems = dtSystems.DefaultView.ToTable(true); dtSystemsJSON = JsonConvert.SerializeObject(dtSystems); // workarea ddl DataTable dtWorkAreas = MasterData.WorkAreaList_Get(); WorkAreaOptions = CreateOptionStringFromDataTable(dtWorkAreas, "WorkAreaID", "WorkArea", "0", "", true); DataTable dtWorkAreaSystems = MasterData.WorkArea_SystemList_Get(); columnsToRemove = new List <string>(); columnsToKeep = new List <string>() { "WorkArea_SystemID", "WorkArea", "WorkAreaID", "WTS_SYSTEM", "WTS_SYSTEMID" }; foreach (DataColumn col in dtWorkAreaSystems.Columns) { if (!columnsToKeep.Contains(col.ColumnName)) { columnsToRemove.Add(col.ColumnName); } } foreach (string colName in columnsToRemove) { dtWorkAreaSystems.Columns.Remove(colName); } dtWorkAreaSystems.AcceptChanges(); dtWorkAreaSystems = dtWorkAreaSystems.DefaultView.ToTable(true); dtWorkAreaSystemsJSON = JsonConvert.SerializeObject(dtWorkAreaSystems); // RQMTType ddl (purpose) DataTable dtTypes = RQMT.RQMTTypeList_Get(); PopulateDDLFromDataTable(ddlRQMTType, dtTypes, "RQMTTypeID", "RQMTType", null, null, false, "InternalType"); RQMTTypeOptions = CreateOptionStringFromDataTable(dtTypes, "RQMTTypeID", "RQMTType", "0", "", true, "InternalType"); // Description Types option list DataTable dtDescTypes = RQMT.RQMTDescriptionTypeList_Get(); DescriptionTypeOptions = CreateOptionStringFromDataTable(dtDescTypes, "RQMTDescriptionTypeID", "RQMTDescriptionType", null, null, true); // RQMTComplexity DataTable dtComplexity = RQMT.RQMTComplexityList_Get(); ComplexityOptions = CreateOptionStringFromDataTable(dtComplexity, "RQMTComplexityID", "RQMTComplexity", null, null, true); // Functionality DataTable dtFunctionality = MasterData.WorkloadGroupList_Get(); dtFunctionality.DefaultView.Sort = "WorkloadGroup"; dtFunctionality = dtFunctionality.DefaultView.ToTable(); FunctionalitySelectOptions = CreateOptionStringFromDataTable(dtFunctionality, "WorkloadGroupID", "WorkloadGroup", "0", "", true, null); FunctionalityCheckBoxOptions = CreateCheckBoxStringFromDataTable(dtFunctionality, "WorkloadGroupID", "WorkloadGroup", true, 1, null); // Attributes AttributeOptions = new Dictionary <string, string>(); DataTable dtStage = RQMT.RQMTAttribute_Get((int)WTS.Enums.RQMTAttributeTypeEnum.Stage); AttributeOptions["stage"] = CreateOptionStringFromDataTable(dtStage, "RQMTAttributeID", "RQMTAttribute", "0", "", true); DataTable dtCrit = RQMT.RQMTAttribute_Get((int)WTS.Enums.RQMTAttributeTypeEnum.Criticality); AttributeOptions["criticality"] = CreateOptionStringFromDataTable(dtCrit, "RQMTAttributeID", "RQMTAttribute", "0", "", true); DataTable dtStatus = RQMT.RQMTAttribute_Get((int)WTS.Enums.RQMTAttributeTypeEnum.Status); AttributeOptions["status"] = CreateOptionStringFromDataTable(dtStatus, "RQMTAttributeID", "RQMTAttribute", "0", "", true); if (!string.IsNullOrWhiteSpace((string)Session["copied.rqmts"])) { string[] arr = ((string)Session["copied.rqmts"]).Split(','); string[] rqmts = arr[0].Split('|'); CopiedRQMTs = ""; CopiedRQMTSystems = arr[1]; for (int i = 0; i < rqmts.Length; i++) { string rqmt = rqmts[i]; if (CopiedRQMTs.Length > 0) { CopiedRQMTs += ", "; } if (CopiedRQMTs.Contains(rqmt)) { CopiedRQMTs += rqmt + "*"; } else { CopiedRQMTs += rqmt; } } } //ShowMultipleSetQuickAddWarning DataTable userSettingDt = LoggedInUser.UserSettingList_Get(LoggedInUserID, 2); if (userSettingDt != null && userSettingDt.Rows.Count > 0 && userSettingDt.Rows[0]["SettingValue"].ToString() == "0") { QuickAddWarningEnabled = false; } }