Example #1
0
 public DataFileVM(DataFile dataFile, DataSetVM dataSet)
 {
     this.dataFile = dataFile;
     this.dataSet = dataSet;
 }
Example #2
0
 private XElement CreatePhysicalInstance(DataFile dataFileModel)
 {
     //d:PhysicalInstance
     DataSet dataSetModel = studyUnit.FindDataSetModel(dataFileModel.DataSetId);
     XElement physicalInstance = new XElement(pi + TAG_PHYSICAL_INSTANCE,
         CreateIDAttribute(dataFileModel.PhysicalInstanceId),
         CreateVersionAttribute(),
         CreateAgencyAttribute(),
         CreateReferenceID(pi + TAG_RECORD_LAYOUT_REFERENCE, dataFileModel.RecordLayoutId, RecordLayoutSchemeId()), //RecordLayoutReference+
         new XElement(pi + TAG_DATA_FILE_IDENTIFICATION,  //DataFileIdentification+
             CreateIDAttribute(dataFileModel.DataFileIdentificationId),
             new XElement(pi + TAG_URI, dataFileModel.Uri)),//URI+
         new XElement(pi + TAG_GROSS_FILE_STRUCTURE, //GrossFileStructure?
             CreateIDAttribute(dataFileModel.GrossFileStructureId),
             new XElement(pi + TAG_CASE_QUANTITY, "0"), //CaseQuantity?
             new XElement(pi + TAG_OVERALL_RECORD_COUNT, dataSetModel.VariableGuids.Count))); //OverallRecordCount?
     return physicalInstance;
 }
Example #3
0
 public static DataFile createDataFile()
 {
     DataFile dataFile = new DataFile();
     dataFile.Charset = "UTF-8";
     dataFile.Format = "Delimited";
     dataFile.DelimiterCode = "1";
     return dataFile;
 }
Example #4
0
 private DataFileVM createDataFile(DataFile dataFileModel, DataSetVM dataSet)
 {
     DataFileVM dataFile = new DataFileVM(dataFileModel, dataSet);
     dataFile.Parent = this;
     dataFile.Delimiters = Options.Delimiters;
     return dataFile;
 }
Example #5
0
        public static DataFile CreateDataFile(XElement physicalStructureElem, IEnumerable<XElement> recordLayoutElems, IEnumerable<XElement> physicalInstanceElems)
        {
            string id = (string)physicalStructureElem.Attribute(ATTR_ID);
            if (id == null)
            {
                return null;
            }
            DataFile dataFileModel = new DataFile();
            dataFileModel.Id = id;
            dataFileModel.Format = (string)physicalStructureElem.Element(p + TAG_FORMAT);
            string delimiterLabel = (string)physicalStructureElem.Element(p + TAG_DEFAULT_DELIMITER);
            dataFileModel.DelimiterCode = Options.FindCodeByLabel(Options.Delimiters, delimiterLabel);
            dataFileModel.DataSetId = ReadReferenceID(physicalStructureElem, p + TAG_LOGICAL_RECORD_REFERENCE);

            XElement recordLayoutElem = FindRecordLayoutElem(recordLayoutElems, dataFileModel.Id);
            if (recordLayoutElem != null)
            {
                string recordLayoutId = (string)recordLayoutElem.Attribute(ATTR_ID);
                XElement physicalInstanceElem = FindPhysicalInstanceElem(physicalInstanceElems, recordLayoutId);
                if (physicalInstanceElem != null)
                {
                    XElement dataFileIdentificationElem = physicalInstanceElem.Element(pi + TAG_DATA_FILE_IDENTIFICATION);
                    if (dataFileIdentificationElem != null)
                    {
                        dataFileModel.Uri = (string)dataFileIdentificationElem.Element(pi + TAG_URI);
                    }
                }
            }
            return dataFileModel;
        }
Example #6
0
        private static DataSetItem CreateDataSetItem(XElement fileDscrElem)
        {
            string id = (string)fileDscrElem.Attribute(ATTR_ID);
            if (string.IsNullOrEmpty(id))
            {
                return null;
            }
            string uri = (string)fileDscrElem.Attribute(ATTR_URI);

            XElement fileTxtElem = fileDscrElem.Element(cb + TAG_FILE_TXT);
            if (fileTxtElem == null)
            {
                return null;
            }

            string title = (string)fileTxtElem.Element(cb + TAG_FILE_NAME);
            string memo = (string)fileTxtElem.Element(cb + TAG_FILE_CONT);
            string format = (string)fileTxtElem.Element(cb + TAG_FORMAT);
            DataSet dataSet = new DataSet()
            {
                Id = id,
                Title = title,
                Memo = memo
            };
            DataFile dataFile = new DataFile()
            {
                Uri = uri,
                Format = format
            };
            dataFile.DataSetId = dataSet.Id;

            return new DataSetItem(dataSet, dataFile);
        }
Example #7
0
 public DataSetItem(DataSet dataSet, DataFile dataFile)
 {
     DataSet = dataSet;
     DataFile = dataFile;
 }