コード例 #1
0
ファイル: Ja2DataAccess.cs プロジェクト: egorovav/Ja2Project
 private Ja2Data.SlfFile.Record DownloadUnstreucturedRecord(SlfRecord aUnstructuredRec)
 {
     Ja2Data.SlfFile.Record.Header _header = this.DownloadSlfRecordHeader(aUnstructuredRec.SlfRecordHeader);
     Ja2Data.SlfFile.Record        _rec    = new Ja2Data.SlfFile.Record(_header);
     _rec.Data = aUnstructuredRec.UnstructuredData.Data;
     return(_rec);
 }
コード例 #2
0
        public override int Upload(BinaryReader aReader, int aSlfFileId)
        {
            int _count = 0;

            foreach (Ja2Data.SlfFile.Record _file in this.FFiles)
            {
                try
                {
                    aReader.BaseStream.Position = _file.Offset;

                    SlfRecord        _slfRec = new SlfRecord();
                    UnstructuredData _data   = new UnstructuredData();
                    _data.Data        = aReader.ReadBytes((int)_file.Length);
                    _data.UserId      = this.FUserId;
                    _data.DateCreated = DateTime.Now;
                    this.FUnstructuredData.Add(_data);
                    _slfRec.UnstructuredData = _data;

                    _slfRec.SlfFileId = aSlfFileId;

                    SlfRecordHeader _recHeader = base.CreateSlfRecordHeader(_file);
                    base.FHeaders.Add(_recHeader);
                    _slfRec.SlfRecordHeader = _recHeader;
                    _slfRec.ID = _file.FileNameExtention;

                    _slfRec.UserId      = this.FUserId;
                    _slfRec.DateCreated = DateTime.Now;

                    this.FSlfRecords.Add(_slfRec);

                    this.AddRecordsToDataSet();
                    _count += this.SaveChanges();
                }
                catch (Exception _exc)
                {
                    string _excMess = String.Format("Uploading file {0} exception\n", _file.FileName);
                    throw new Exception(_excMess, _exc);
                }
            }

            return(_count);
        }