public static void Copy(ILogImageData src, ILogImageData dest) { dest.ID = src.ID; dest.DataFromDate = src.DataFromDate; dest.LogId = src.LogId; dest.Url = src.Url; dest.Name = src.Name; }
private void createRecord(Storage.Database db, ILogImageData data) { using (MemoryStream ms = new MemoryStream(DataBuffer)) using (BinaryWriter bw = new BinaryWriter(ms)) { ms.Position = 0; ms.Position = 150; bw.Write(Utils.Conversion.DateTimeToLong(data.DataFromDate)); //150 ms.Position = 180; bw.Write(data.LogId ?? ""); ms.Position = 220; bw.Write(data.Url ?? ""); ms.Position = 420; bw.Write(data.Name ?? ""); RecordInfo = db.RequestLogImageRecord(data.ID, data.LogId ?? "", DataBuffer, ms.Position, 10); } }
//new record to be stored public LogImage(Storage.Database db, ILogImageData data) : base(null) { _id = data.ID; using (MemoryStream ms = new MemoryStream(_buffer)) using (BinaryWriter bw = new BinaryWriter(ms)) { ms.Position = 0; //todo: add string length checks!!! ms.Position = 150; bw.Write(data.DataFromDate.ToFileTime()); //150 ms.Position = 180; bw.Write(data.LogId??""); ms.Position = 220; bw.Write(data.Url??""); ms.Position = 420; bw.Write(data.Name??""); RecordInfo = db.RequestLogRecord(data.ID, _buffer, ms.Position, 10); } db.LogImageCollection.Add(this); }
//new record to be stored public LogImage(Storage.Database db, ILogImageData data) : this(null) { createRecord(db, data); db.LogImageCollection.Add(this); }