public LoaderProcedure() { _ds = null; _mapping = null; _fileCsvData = null; _filesXmlData = null; _transcodeTime = null; }
public BuilderProcedure() { _ds = null; _fileCsvData = null; _filesXmlData = null; _mapping = null; _transcodeTime = null; _useTranscodeTime = false; }
public Mapping Set_MAPPING(int IDMappingSchema) { Dictionary<string, object> mapping_set = ISTAT.DBDAL.DataAccess.Get_MappingSet(IDMappingSchema); Dictionary<string, object> mapping_items = ISTAT.DBDAL.DataAccess.Get_MappingScheme(IDMappingSchema); if (mapping_set != null) { _ds = new DataStructure(int.Parse(mapping_set["ID_SET"].ToString())); _transcodeTime = new ISTAT.ENTITY.TranscodeTime(); _transcodeTime.periodChar = (TranscodeTime.TypePeriod)mapping_set["TRANSCODE_VALUE"]; _transcodeTime.stopChar = (mapping_set["TRANSCODE_CHAR"].ToString() != string.Empty) ? mapping_set["TRANSCODE_CHAR"].ToString() : string.Empty; _mapping = new Mapping(); _mapping.IDSchema = IDMappingSchema; _mapping.Name = mapping_set["NAME"].ToString(); _mapping.Time = ((DateTime)mapping_set["TIMESTAMP"]).TimeOfDay; _mapping.Description = mapping_set["DESCRIPTION"].ToString(); _mapping.TranscodeUse = (bool)mapping_set["TRANSCODE_USE"]; _mapping.TranscodeTime = _transcodeTime; _mapping.CSV_CHAR = (mapping_set["FILE_CSV_CHAR"].ToString() != string.Empty) ? char.Parse(mapping_set["FILE_CSV_CHAR"].ToString()) : ';'; _mapping.CSV_HASHEADER = (bool)mapping_set["FILE_CSV_HASHEADER"]; if (mapping_items != null) { _mapping.Items = new MappingItem[mapping_items.Count]; int i = 0; foreach (object mapp in mapping_items.Keys) { _mapping.Items[i] = new MappingItem(); Dictionary<int, string> c = mapping_items[mapp.ToString()] as Dictionary<int, string>; _mapping.Items[i]._a = c.Keys.First(); _mapping.Items[i]._b = mapp.ToString(); _mapping.Items[i]._c = c.Values.First(); i++; } } } return _mapping; }
public DataStructure Set_DATASET(int idset) { if (idset < 0) { this._ds = null; return null; } else { this._ds = ISTAT.DBDAL.DataAccess.Get_DataStructure(idset); this._ds.IDSet = idset; this._ds.Dimensions = ISTAT.DBDAL.DataAccess.Get_Dimensions(idset); this._ds.Attributes = ISTAT.DBDAL.DataAccess.Get_Attributes(idset); Org.Sdmxsource.Sdmx.Api.Model.Objects.DataStructure.IDataflowObject df= ISTAT.DBDAL.DataSDMX.GetDataflow(this._ds.DataFlowIdentifier); if (df != null) { this._ds.DSDIdentifier = new SDMXIdentifier() { id = df.DataStructureRef.FullId, agencyid = df.DataStructureRef.AgencyId, version = df.DataStructureRef.Version, }; } return this._ds; } }
public DataStructure Get_DSD(ISTAT.ENTITY.SDMXIdentifier sdmxIdentity) { DataStructure _ds = new ISTAT.ENTITY.DataStructure(); Org.Sdmxsource.Sdmx.Api.Model.Objects.DataStructure.IDataStructureObject dsd = ISTAT.DBDAL.DataSDMX.GetDSD(sdmxIdentity); #region Get Dimension List<Dimension> dims = new List<Dimension>(); foreach (Org.Sdmxsource.Sdmx.Api.Model.Objects.DataStructure.IDimension dim in dsd.DimensionList.Dimensions) { Dimension _dim = new Dimension(dim); dims.Add(_dim); } #endregion #region Get Attribute List<ISTAT.ENTITY.Attribute> atts = new List<ISTAT.ENTITY.Attribute>(); foreach (Org.Sdmxsource.Sdmx.Api.Model.Objects.DataStructure.IAttributeObject att in dsd.Attributes) { ISTAT.ENTITY.Attribute _att = new ISTAT.ENTITY.Attribute(att); atts.Add(_att); } #endregion _ds.Dimensions = dims; _ds.Attributes = atts; _ds.DSDIdentifier = sdmxIdentity; _ds.IDDsd = ISTAT.DBDAL.DataSDMX.Get_IDDsd(sdmxIdentity); _ds.IsFinal = dsd.IsFinal.IsTrue; this._ds = _ds; return _ds; }
public bool Delete_DATASET(int idset) { if (idset < 0) { this._ds = null; return false; } else { int idFlow = ISTAT.DBDAL.DataAccess.Get_DataStructure(idset).IDFlow; ISTAT.DBDAL.DataSDMX.Delete_Dataflow(idFlow); ISTAT.DBDAL.DataAccess.Delete_Datastructure(idset); this._ds = null; return true; } }
public void Set_DataStructure(int IDCube) { if (IDCube >= 0) { _ds = ISTAT.DBDAL.DataAccess.Get_DataStructure(IDCube); _transcodeTime = null; _mapping = null; } }
public static List<DataStructure> Get_DataStructures() { DataWrapper dtw = new DataWrapper(DataWrapper.ECONNECTIONTYPE.SQL, DataAccess.SQLConnString_DB.ConnectionString); if (dtw.TestConnection()) { dtw.DBConnection.Open(); try { //////////////////////// System.Data.IDbCommand cmd = dtw.DBConnection.CreateCommand(); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "dbo.proc_GET_DATASTRUCTS"; System.Data.IDataReader reader = cmd.ExecuteReader(); List<DataStructure> listResult = new List<DataStructure>(); while (reader.Read()) { DataStructure ds = new DataStructure( reader.GetInt32(reader.GetOrdinal("IDSet")), reader.GetString(reader.GetOrdinal("Code")), reader.GetInt32(reader.GetOrdinal("IDDataFlow"))); ds.IDCat = reader.GetInt32(reader.GetOrdinal("IDCat")); List<TextTypeWrapper> names = DataAccess.Get_LocalisedStrings(ds.IDSet, "CatSet"); ds.Names.Add(names[TextTypeWrapper.GetIndexLocale(names, DataAccess.TwoLetterIso)]); listResult.Add(ds); } for (int i = 0; i < listResult.Count; i++) { listResult[i].IDDsd = DataSDMX.Get_IDDsd(listResult[i].IDFlow); } //////////////////////// dtw.DBConnection.Close(); return listResult; } catch (Exception ex) { dtw.DBConnection.Close(); throw ex; return null; } } return null; }
public static DataStructure Get_DataStructureByDataflow(ISTAT.ENTITY.SDMXIdentifier dataflow) { DataWrapper dtw = new DataWrapper(DataWrapper.ECONNECTIONTYPE.SQL, DataAccess.SQLConnString_DB.ConnectionString); if (dtw.TestConnection()) { dtw.DBConnection.Open(); try { //////////////////////// System.Data.IDbCommand cmd = dtw.DBConnection.CreateCommand(); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "dbo.proc_GET_DATASTRUCT_BY_DATAFLOW"; System.Data.IDbDataParameter param_agencyid = cmd.CreateParameter(); param_agencyid.DbType = System.Data.DbType.String; param_agencyid.ParameterName = "agencyid"; param_agencyid.Value = dataflow.agencyid; cmd.Parameters.Add(param_agencyid); System.Data.IDbDataParameter param_id = cmd.CreateParameter(); param_id.DbType = System.Data.DbType.String; param_id.ParameterName = "id"; param_id.Value = dataflow.id; cmd.Parameters.Add(param_id); System.Data.IDbDataParameter param_version = cmd.CreateParameter(); param_version.DbType = System.Data.DbType.String; param_version.ParameterName = "version"; param_version.Value = dataflow.version; cmd.Parameters.Add(param_version); System.Data.IDbDataParameter param_twoLetter = cmd.CreateParameter(); param_twoLetter.DbType = System.Data.DbType.String; param_twoLetter.ParameterName = "TwoLetterISO"; param_twoLetter.Value = DataAccess.TwoLetterIso; cmd.Parameters.Add(param_twoLetter); System.Data.IDataReader reader = cmd.ExecuteReader(); DataStructure ds = null; if (reader.Read()) { ds = new DataStructure( reader.GetInt32(reader.GetOrdinal("IDSet")), reader.GetString(reader.GetOrdinal("Code")), reader.GetInt32(reader.GetOrdinal("IDDataFlow"))); ds.IDCat = reader.GetInt32(reader.GetOrdinal("IDCat")); List<TextTypeWrapper> names = DataAccess.Get_LocalisedStrings(ds.IDSet, "CatSet"); ds.Names.Add(names[TextTypeWrapper.GetIndexLocale(names, DataAccess.TwoLetterIso)]); //ds.Names.Add(new TextTypeWrapper(DataAccess.TwoLetterIso, reader.GetString(reader.GetOrdinal("Value")))); ds.IDDsd = DataSDMX.Get_IDDsd(ds.IDFlow); } //////////////////////// dtw.DBConnection.Close(); return ds; } catch// (Exception ex) { dtw.DBConnection.Close(); return null; } } return null; }
/// <summary> /// Get_DataStructure /// </summary> /// <param name="id_set">ID of Structure in database</param> /// <returns>Return Structure form database | NULL if error</returns> public static DataStructure Get_DataStructure(int id_set) { DataWrapper dtw = new DataWrapper(DataWrapper.ECONNECTIONTYPE.SQL, DataAccess.SQLConnString_DB.ConnectionString); if (dtw.TestConnection()) { dtw.DBConnection.Open(); try { //////////////////////// System.Data.IDbCommand cmd = dtw.DBConnection.CreateCommand(); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "dbo.proc_GET_DATASTRUCT"; System.Data.IDbDataParameter param_idSet = cmd.CreateParameter(); param_idSet.DbType = System.Data.DbType.Int32; param_idSet.ParameterName = "IDSet"; param_idSet.Value = id_set; cmd.Parameters.Add(param_idSet); System.Data.IDbDataParameter param_twoLetter = cmd.CreateParameter(); param_twoLetter.DbType = System.Data.DbType.String; param_twoLetter.ParameterName = "TwoLetterISO"; param_twoLetter.Value = DataAccess.TwoLetterIso; cmd.Parameters.Add(param_twoLetter); System.Data.IDataReader reader = cmd.ExecuteReader(); DataStructure ds = null; if (reader.Read()) { ds = new DataStructure( reader.GetInt32(reader.GetOrdinal("IDSet")), reader.GetString(reader.GetOrdinal("Code")), reader.GetInt32(reader.GetOrdinal("IDDataFlow")), reader.GetInt32(reader.GetOrdinal("IDCat"))); ds.IDDsd = DataSDMX.Get_IDDsd(ds.IDFlow); ds.Names = DataAccess.Get_LocalisedStrings(ds.IDSet, "CatSet"); //string theme_urn = reader.GetString(reader.GetOrdinal("ThemeURN")); /*List<Org.Sdmxsource.Sdmx.Api.Model.Objects.CategoryScheme.ICategoryObject> cats = DataSDMX.GetCategoryScheme(); var listLocThemes = from c in cats where c.Urn.ToString() == theme_urn select c; foreach (Org.Sdmxsource.Sdmx.Api.Model.Objects.Base.ITextTypeWrapper theme in listLocThemes.First().Names) ds.Themes.Add(new TextTypeWrapper(theme.Locale, theme.Value));*/ ds.DataFlowIdentifier = SDMXIdentifier.CreateFromString(reader.GetString(reader.GetOrdinal("Dataflow"))); } //////////////////////// dtw.DBConnection.Close(); return ds; } catch// (Exception ex) { dtw.DBConnection.Close(); return null; } } return null; }
public DataStructure Get_DSD(ISTAT.ENTITY.SDMXIdentifier sdmxIdentity) { DataStructure _ds = new ISTAT.ENTITY.DataStructure(); Org.Sdmxsource.Sdmx.Api.Model.Objects.DataStructure.IDataStructureObject dsd = ISTAT.DBDAL.DataSDMX.GetDSD(sdmxIdentity, false); #region Get Dimension List<Dimension> dims = new List<Dimension>(); foreach (Org.Sdmxsource.Sdmx.Api.Model.Objects.DataStructure.IDimension dim in dsd.DimensionList.Dimensions) { Dimension _dim = new Dimension(dim); dims.Add(_dim); } #endregion #region Get Attribute List<ISTAT.ENTITY.Attribute> atts = new List<ISTAT.ENTITY.Attribute>(); foreach (Org.Sdmxsource.Sdmx.Api.Model.Objects.DataStructure.IAttributeObject att in dsd.Attributes) { ISTAT.ENTITY.Attribute _att = new ISTAT.ENTITY.Attribute(att); if (att.AttachmentGroup != null) { var group = dsd.Groups.FirstOrDefault(e => e.Id == att.AttachmentGroup); if (group != null) _att.DimensionReferences = new List<string>(group.DimensionRefs); } atts.Add(_att); } #endregion _ds.Dimensions = dims; _ds.Attributes = atts; _ds.DSDIdentifier = sdmxIdentity; _ds.IDDsd = ISTAT.DBDAL.DataSDMX.Get_IDDsd(sdmxIdentity); _ds.IsFinal = dsd.IsFinal.IsTrue; this._ds = _ds; return _ds; }
public bool Delete_DATASET(int idset) { if (idset < 0) { this._ds = null; return false; } else { //Elimino le viste QueryBuilderProcedure.DeleteCubeViewsFromIdCube(idset); int idFlow = ISTAT.DBDAL.DataAccess.Get_DataStructure(idset).IDFlow; ISTAT.DBDAL.DataSDMX.Delete_Dataflow(idFlow); ISTAT.DBDAL.DataAccess.Delete_Datastructure(idset); this._ds = null; return true; } }