public ReportType() { //this.attributeSetField = new List<ReportedAttributeType>(); this.attributeSetField = new AttributeSetType(); this.targetField = new TargetType(); }
public ReportedAttributeType() { //this.attributeSetField = new List<ReportedAttributeType>(); this.attributeSetField = new AttributeSetType(); this.itemsField = new List<object>(); }
private AttributeSetType Get_AttributeSet(MetadataTypes metadataTypes) { AttributeSetType RetVal; DataTable DtMetadataCategory; string Query; RetVal = null; DtMetadataCategory = null; Query = string.Empty; try { switch (metadataTypes) { case MetadataTypes.Area: Query = "SELECT * FROM UT_Metadata_Category_" + this._language + " WHERE CategoryType = 'A' ORDER BY CategoryOrder ASC;"; break; case MetadataTypes.Indicator: Query = "SELECT * FROM UT_Metadata_Category_" + this._language + " WHERE CategoryType = 'I' ORDER BY CategoryOrder ASC;"; break; case MetadataTypes.Source: Query = "SELECT * FROM UT_Metadata_Category_" + this._language + " WHERE CategoryType = 'S' ORDER BY CategoryOrder ASC;"; break; case MetadataTypes.Layer: Query = "SELECT * FROM UT_Metadata_Category_" + this._language + " WHERE CategoryType = 'A' ORDER BY CategoryOrder ASC;"; break; default: break; } DtMetadataCategory = this._diConnection.ExecuteDataTable(Regex.Replace(Query, "UT_", this._diConnection.DIDataSetDefault(), RegexOptions.IgnoreCase)); if (DtMetadataCategory != null && DtMetadataCategory.Rows.Count > 0) { RetVal = new AttributeSetType(); this.Fill_AttributeSet_Structure(RetVal, DtMetadataCategory); } } catch (Exception ex) { throw ex; } finally { } return RetVal; }
private void Fill_AttributeSet_Values(AttributeSetType AttributeSet, string TargetObjectId, MetadataTypes metadataType) { string Language; Language = string.Empty; try { this.Fill_AttributeSet_Language_Specific_Values(AttributeSet, TargetObjectId, metadataType, this._language); if (this._multiLanguageHandlingRequired == true) { foreach (DataRow LanguageRow in this.DIConnection.DILanguages(this.DIQueries.DataPrefix).Rows) { Language = LanguageRow[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Language.LanguageCode].ToString(); if (Language != this.DIQueries.LanguageCode.Substring(1)) { this.Fill_AttributeSet_Language_Specific_Values(AttributeSet, TargetObjectId, metadataType, Language); } } } } catch (Exception ex) { throw ex; } finally { } }
private void Fill_AttributeSet_Structure(AttributeSetType AttributeSet, DataTable DtMetadataCategory) { ReportedAttributeType ReportedAttribute; DataRow[] ParentRows; string CategoryNId, CategoryGId; AttributeSet.ReportedAttribute = new List<ReportedAttributeType>(); ParentRows = DtMetadataCategory.Select("ParentCategoryNId = -1", "CategoryOrder ASC"); foreach (DataRow ParentRow in ParentRows) { CategoryNId = ParentRow["CategoryNId"].ToString(); CategoryGId = ParentRow["CategoryGId"].ToString(); ReportedAttribute = new ReportedAttributeType(); ReportedAttribute.id = CategoryGId; ReportedAttribute.Annotations = null; this.Add_Children_Attributes(ReportedAttribute, CategoryNId, DtMetadataCategory); AttributeSet.ReportedAttribute.Add(ReportedAttribute); } }
private void Fill_AttributeSet_Language_Specific_Values(AttributeSetType AttributeSet, string TargetObjectId, MetadataTypes metadataType, string Language) { string Query; string TargetNId; List<string> CategoryGIds, CategoryNIds; Dictionary<string, string> DictCategoryNIdGId, DictCategoryGIdValue,DictCategoryPresentational; DataTable DtMetadataCategory, DtMetadataReport; Query = string.Empty; TargetNId = string.Empty; CategoryGIds = null; CategoryNIds = null; DictCategoryNIdGId = null; DictCategoryGIdValue = null; DtMetadataCategory = null; DtMetadataReport = null; try { TargetNId = this.Get_TargetNId(TargetObjectId, metadataType, Language); if (!string.IsNullOrEmpty(TargetNId)) { CategoryGIds = new List<string>(); CategoryNIds = new List<string>(); DictCategoryNIdGId = new Dictionary<string, string>(); DictCategoryGIdValue = new Dictionary<string, string>(); DictCategoryPresentational = new Dictionary<string, string>(); foreach (ReportedAttributeType ReportedAttribute in AttributeSet.ReportedAttribute) { CategoryGIds.Add(ReportedAttribute.id); CategoryGIds.AddRange(this.Get_ChildAttribute_CategoryGIds(ReportedAttribute)); } Query = "SELECT * FROM UT_Metadata_Category_" + Language; if (CategoryGIds.Count > 0) { Query += " WHERE CategoryGId IN ('" + string.Join("','", CategoryGIds.ToArray()) + "');"; } DtMetadataCategory = this._diConnection.ExecuteDataTable(Regex.Replace(Query, "UT_", this._diConnection.DIDataSetDefault(), RegexOptions.IgnoreCase)); foreach (DataRow DrMetadataCategory in DtMetadataCategory.Rows) { CategoryNIds.Add(DrMetadataCategory["CategoryNId"].ToString()); DictCategoryNIdGId.Add(DrMetadataCategory["CategoryNId"].ToString(), DrMetadataCategory["CategoryGId"].ToString()); if (DrMetadataCategory["IsPresentational"].ToString() == "True") { DictCategoryPresentational.Add(DrMetadataCategory["CategoryNId"].ToString(), DrMetadataCategory["CategoryGId"].ToString()); } } Query = "SELECT * FROM UT_MetadataReport_" + Language + " WHERE Target_NId = " + TargetNId; if (CategoryNIds.Count > 0) { Query += " AND Category_NId IN (" + string.Join(",", CategoryNIds.ToArray()) + ");";//commented to add those rows which doesnt have metadata for metadata category } DtMetadataReport = this._diConnection.ExecuteDataTable(Regex.Replace(Query, "UT_", this._diConnection.DIDataSetDefault(), RegexOptions.IgnoreCase)); foreach (DataRow DrMetadataReport in DtMetadataReport.Rows) { DictCategoryGIdValue.Add(DictCategoryNIdGId[DrMetadataReport["Category_NId"].ToString()], DrMetadataReport["Metadata"].ToString()); } foreach (ReportedAttributeType ReportedAttribute in AttributeSet.ReportedAttribute) { if (ReportedAttribute.Items == null) { ReportedAttribute.Items = new List<object>(); } else if (ReportedAttribute.Items.Count == 0) { ReportedAttribute.Items = new List<object>(); } if (DictCategoryGIdValue.ContainsKey(ReportedAttribute.id)) { ReportedAttribute.Items.Add(new TextType(Language, DictCategoryGIdValue[ReportedAttribute.id])); } else if (DictCategoryPresentational.ContainsValue(ReportedAttribute.id)==false && DictCategoryGIdValue.ContainsKey(ReportedAttribute.id) == false && DictCategoryPresentational.Count>0) { ReportedAttribute.Items.Add(new TextType(Language, string.Empty));//to add empty tag where metadata category doesnt have any description or report } this.Fill_Children_Attribute_Values(ReportedAttribute, DictCategoryGIdValue, Language); } } } catch (Exception ex) { throw ex; } finally { } }