public static void DeleteCubeView(int idSet) { BuilderProcedure bp = new BuilderProcedure(); SDMXIdentifier sdmxDSDKey = DataAccess.GetIdentifierFromIDSet(idSet); try { if (sdmxDSDKey != null) { ISdmxObjects sdmxObjectDel = new SdmxObjectsImpl(); List<SDMXIdentifier> lCatsIdentifiers = DataSDMX.Get_CategorisationIdentifierFromIdFlow(DataAccess.GetDataflowIDFromIDSet(idSet)); ICategorisationObject cat = null; foreach (SDMXIdentifier ident in lCatsIdentifiers) { cat = DataSDMX.GetCategorisation(ident, true); if (cat != null) sdmxObjectDel.AddCategorisation(cat); } IDataflowObject df = DataSDMX.GetDataflow(sdmxDSDKey, true); IDataStructureObject dsd = DataSDMX.GetDSD(sdmxDSDKey, true); if (df != null) sdmxObjectDel.AddDataflow(df); if (dsd != null) sdmxObjectDel.AddDataStructure(dsd); DataSDMX.DeleteStructure(sdmxObjectDel); } bp.Delete_DATASET(idSet); } catch (Exception ex) { throw ex; } }
public void CreateCubeView(int originalIDCat, int userID, string uriDataFlow, List<CubeFilter> lCubeFilter, List<string[]> nameList, List<string[]> descriptionList, int idCat) { BuilderProcedure bp = new BuilderProcedure(); bp.Get_DSD(_sdmxDFKey); int idflow = ISTAT.DBDAL.DataSDMX.GetDataflowID(_sdmxDFKey); try { bp.Create_DATASET(userID, _sdmxDFKey.id, originalIDCat, nameList, descriptionList, _dimensionList, _attributeList, uriDataFlow, false, _originalIDSet, _lCubeColumnsName, lCubeFilter, idflow, idCat); } catch (Exception ex) { //int idflow = ISTAT.DBDAL.DataSDMX.GetDataflowID(_sdmxDFKey); if (idflow > 0) DataSDMX.Delete_Dataflow(idflow); //DataSDMX.DeleteStructure(sdmxObject); throw ex; } }
public static List<object> GetDomains(UserDef loggedUser, bool stub, BuilderProcedure builder = null) { /* try {*/ if (builder == null) builder = BuilderProcedure.Create(); List<object> _result = new List<object>(); // Get all themes List<CategoryScheme> _themes = builder.GetCategoryScheme(); List<Category> _themesUser = (loggedUser.Role == UserDef.RoleDef.Administrator) ? ISTAT.DBDAL.DataAccess.Get_Themes() : ISTAT.DBDAL.DataAccess.Get_Themes(loggedUser.ID); List<string> cacheCategoryScheme = new List<string>(); if (_themes != null) { foreach (CategoryScheme catScheme in _themes) { Dictionary<string, object> _rowScheme = new Dictionary<string, object>(); _rowScheme.Add("id", catScheme.Id); _rowScheme.Add("parent", "#"); _rowScheme.Add("text", string.Format(" [ {0} ] - {1} ", catScheme.Id, ISTAT.ENTITY.TextTypeWrapper.GetStringLocale( catScheme.Names, ISTAT.DBDAL.DataAccess.CurrentCultureInfo))); _rowScheme.Add("type", "categoryScheme"); _rowScheme.Add("icon", "img/cat_sch.png"); _result.Add(_rowScheme); catScheme.Categories.ForEach(cat => { Dictionary<string, object> _row = new Dictionary<string, object>(); _row.Add("id", cat.IDCategory); _row.Add("parent", (cat.IDParentCategory.ToString() != "0") ? cat.IDParentCategory : catScheme.Id); _row.Add("text", string.Format(" [ {0} ] - {1} ", cat.Code, ISTAT.ENTITY.TextTypeWrapper.GetStringLocale( cat.Names, ISTAT.DBDAL.DataAccess.CurrentCultureInfo))); _row.Add("type", "category"); _row.Add("icon", "img/cat.png"); if (_themesUser != null) { IEnumerable<Category> query = from Category catUser in _themesUser where catUser.IDCategory.ToString().Trim() == cat.Code.ToString() select catUser; Dictionary<string, object> _status = new Dictionary<string, object>(); int nRes = query.Count<Category>(); _status.Add("selected", (query != null && nRes > 0)); _row.Add("state", _status); } _result.Add(_row); }); } Dictionary<string, object> uncategorized = new Dictionary<string, object>(); uncategorized.Add("id", "0"); uncategorized.Add("parent", "#"); uncategorized.Add("text", "Uncategorized"); uncategorized.Add("type", "categoryScheme"); uncategorized.Add("icon", "img/cat_sch.png"); _result.Add(uncategorized); } if (stub == false) { List<DataStructure> _structures = ISTAT.DBDAL.DataAccess.Get_DataStructures(); List<DataStructure> _structuresUser = ISTAT.DBDAL.DataAccess.Get_DataStructures(loggedUser.ID); foreach (DataStructure structure in (loggedUser.Role == UserDef.RoleDef.Administrator) ? _structures : _structuresUser) { Dictionary<string, object> _row = new Dictionary<string, object>(); _row.Add("id", "ds_" + structure.IDSet); //TODO: MODIFICARE //string urn = ISTAT.DBDAL.DataAccess.Get_Theme_Urn(structure.IDCat); string urn = structure.IDCat.ToString(); bool inProduction = ISTAT.DBDAL.DataSDMX.Get_DataflowProduction(structure.IDFlow); _row.Add("parent", (urn != "") ? urn : "#"); _row.Add("text", string.Format(" [ {0} ] - {1} ", structure.Code, ISTAT.ENTITY.TextTypeWrapper.GetStringLocale( structure.Names, ISTAT.DBDAL.DataAccess.CurrentCultureInfo))); _row.Add("type", "dataset"); Dictionary<string, object> data = new Dictionary<string, object>(); data.Add("inProduction", inProduction); _row.Add("data", data); _row.Add("icon", (inProduction) ? "img/cube_red.png" : "img/cube.png"); // With LINQ match a list themes for user end current theme IEnumerable<DataStructure> query = from DataStructure structureUser in _structuresUser where structureUser.IDSet == structure.IDSet select structureUser; Dictionary<string, object> _status = new Dictionary<string, object>(); int nRes = query.Count(); _status.Add("selected", (query != null && nRes > 0)); _row.Add("state", _status); _result.Add(_row); } } if (_result.Count == 1) _result.Clear(); return _result; /* } catch (Exception ex) { throw ex; }*/ }