Exemplo n.º 1
0
 public ArtefactInfo(string id, string agencyId, string version, string urn, ArtefactTypes type, string fileName, XmlDocument content)
 {
     this._id = id;
     this._agencyId = agencyId;
     this._version = version;
     this._urn = urn;
     this._type = type;
     this._fileName = fileName;
     this._content = content;
 }
Exemplo n.º 2
0
 public ArtefactRef(string id, string agencyId, string version, string language, string name, string description, ArtefactTypes artefactType)
 {
     this._id = id;
     this._agencyId = agencyId;
     this._version = version;
     this._language = language;
     this._name = name;
     this._description = description;
     this._artefactType = artefactType;
 }
    private void Save_Artefacts_Details_For_Uploaded_DSD_In_Database(int DbNId, string Id, string AgencyId, string Version, string URN, ArtefactTypes Type, string FileLocation, string FileName)
    {
        string InsertQuery;
        DIConnection DIConnection;
        System.Data.Common.DbParameter DbParam;
        List<System.Data.Common.DbParameter> DbParams;

        InsertQuery = string.Empty;
        DIConnection = null;

        string AppPhysicalPath = string.Empty;
        string DbFolder = string.Empty;

        try
        {
            AppPhysicalPath = HttpContext.Current.Request.PhysicalApplicationPath;
            DbFolder = Constants.FolderName.Data + DbNId.ToString() + "\\";

            DIConnection = new DIConnection(DIServerType.MsAccess, string.Empty, string.Empty, Server.MapPath("~//stock//Database.mdb"),
                           string.Empty, string.Empty);
            DbParams = new List<System.Data.Common.DbParameter>();

            InsertQuery = "INSERT INTO Artefacts (DBNId, Id, AgencyId, Version, URN, Type, FileLocation)" +
                          " VALUES(@DBNId, @Id, @AgencyId, @Version, @URN, @Type, @FileLocation);";

            DbParams = new List<System.Data.Common.DbParameter>();

            DbParam = DIConnection.CreateDBParameter();
            DbParam.ParameterName = "DBNId";
            DbParam.DbType = DbType.Int32;
            DbParam.Value = DbNId;

            DbParams.Add(DbParam);

            DbParam = DIConnection.CreateDBParameter();
            DbParam.ParameterName = "Id";
            DbParam.DbType = DbType.String;
            DbParam.Value = Id;
            DbParams.Add(DbParam);

            DbParam = DIConnection.CreateDBParameter();
            DbParam.ParameterName = "AgencyId";
            DbParam.DbType = DbType.String;
            DbParam.Value = AgencyId;
            DbParams.Add(DbParam);

            DbParam = DIConnection.CreateDBParameter();
            DbParam.ParameterName = "Version";
            DbParam.DbType = DbType.String;
            DbParam.Value = Version;
            DbParams.Add(DbParam);

            DbParam = DIConnection.CreateDBParameter();
            DbParam.ParameterName = "URN";
            DbParam.DbType = DbType.String;
            DbParam.Value = URN;
            DbParams.Add(DbParam);

            DbParam = DIConnection.CreateDBParameter();
            DbParam.ParameterName = "Type";
            DbParam.DbType = DbType.Int32;
            DbParam.Value = Convert.ToInt32(Type);
            DbParams.Add(DbParam);

            DbParam = DIConnection.CreateDBParameter();
            DbParam.ParameterName = "FileLocation";
            DbParam.DbType = DbType.String;

            switch (Type)
            {
                case ArtefactTypes.ConceptS:
                    DbParam.Value = Path.Combine(AppPhysicalPath, DbFolder + Constants.FolderName.SDMX.Concepts + FileName);
                    break;
                case ArtefactTypes.DSD:
                    DbParam.Value = Path.Combine(AppPhysicalPath, DbFolder + Constants.FolderName.SDMX.sdmx + FileName);
                    break;
                case ArtefactTypes.MSD:
                    DbParam.Value = Path.Combine(AppPhysicalPath, DbFolder + Constants.FolderName.SDMX.MSD + FileName);
                    break;
                case ArtefactTypes.CL:
                    DbParam.Value = Path.Combine(AppPhysicalPath, DbFolder + Constants.FolderName.SDMX.Codelists + FileName);
                    break;
                case ArtefactTypes.CategoryS:
                    DbParam.Value = Path.Combine(AppPhysicalPath, DbFolder + Constants.FolderName.SDMX.Categories + FileName);
                    break;
                case ArtefactTypes.DFD:
                    DbParam.Value = Path.Combine(AppPhysicalPath, DbFolder + Constants.FolderName.SDMX.ProvisioningMetadata + FileName);
                    break;
                case ArtefactTypes.MFD:
                    DbParam.Value = Path.Combine(AppPhysicalPath, DbFolder + Constants.FolderName.SDMX.ProvisioningMetadata + FileName);
                    break;
                case ArtefactTypes.Complete:
                    DbParam.Value = Path.Combine(AppPhysicalPath, DbFolder + Constants.FolderName.SDMX.sdmx + FileName);
                    break;
                case ArtefactTypes.Summary:
                    DbParam.Value = Path.Combine(AppPhysicalPath, DbFolder + Constants.FolderName.SDMX.sdmx + FileName);
                    break;
                case ArtefactTypes.Report:
                    DbParam.Value = Path.Combine(AppPhysicalPath, DbFolder + Constants.FolderName.SDMX.sdmx + FileName);
                    break;
                case ArtefactTypes.PA:
                    DbParam.Value = Path.Combine(AppPhysicalPath, DbFolder + Constants.FolderName.SDMX.PAs + FileName);
                    break;
                case ArtefactTypes.Mapping:
                    DbParam.Value = Path.Combine(AppPhysicalPath, DbFolder + Constants.FolderName.SDMX.sdmx + FileName);
                    break;
                case ArtefactTypes.Header:
                    DbParam.Value = Path.Combine(AppPhysicalPath, DbFolder + Constants.FolderName.SDMX.sdmx + FileName);
                    break;
                default:
                    break;
            }

            DbParams.Add(DbParam);

            DIConnection.ExecuteDataTable(InsertQuery, CommandType.Text, DbParams);

        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);
            throw ex;
        }
        finally
        {
            if (DIConnection != null)
            {
                DIConnection.Dispose();
            }
        }
    }
Exemplo n.º 4
0
        private ArtefactInfo Prepare_ArtefactInfo_From_OrganisationScheme(SDMXObjectModel.Structure.OrganisationSchemeType OrganisationScheme, string FileName, ArtefactTypes artefactType)
        {
            ArtefactInfo RetVal;
            SDMXObjectModel.Message.StructureType Structure;
            XmlDocument XmlContent;

            RetVal = null;
            XmlContent = null;

            try
            {
                Structure = this.Get_Structure_Object(OrganisationScheme);
                XmlContent = Serializer.SerializeToXmlDocument(typeof(SDMXObjectModel.Message.StructureType), Structure);
                RetVal = new ArtefactInfo(OrganisationScheme.id, OrganisationScheme.agencyID, OrganisationScheme.version, string.Empty, artefactType, FileName, XmlContent);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }

            return RetVal;
        }