internal override void ReadFromVolumeDBRecord(IRecordData recordData) { base.ReadFromVolumeDBRecord(recordData); long tmp = (long)recordData["Size"]; duration = TimeSpan.FromSeconds(tmp); }
internal override void WriteToVolumeDBRecord(IRecordData recordData) { base.WriteToVolumeDBRecord(recordData); recordData.AddField("Files", tracks); recordData.AddField("Size", (long)duration.TotalSeconds); }
internal override void ReadFromVolumeDBRecord(IRecordData recordData) { base.ReadFromVolumeDBRecord(recordData); files = (long)recordData["Files"]; dirs = (long)recordData["Dirs"]; size = (long)recordData["Size"]; }
internal override void ReadFromVolumeDBRecord(IRecordData recordData) { name = Util.ReplaceDBNull <string>(recordData["Name"], null); description = Util.ReplaceDBNull <string>(recordData["Description"], null); created = Util.ReplaceDBNull <DateTime>(recordData["Created"], DateTime.MinValue); version = (int)(long)recordData["Version"]; guid = (string)recordData["GUID"]; }
internal override void WriteToVolumeDBRecord(IRecordData recordData) { recordData.AddField("Name", name); recordData.AddField("Description", description); recordData.AddField("Created", created); recordData.AddField("Version", version); recordData.AddField("GUID", guid); }
internal override void WriteToVolumeDBRecord(IRecordData recordData) { base.WriteToVolumeDBRecord(recordData); recordData.AddField("Files", files); recordData.AddField("Dirs", dirs); recordData.AddField("Size", size); }
//private static void ValidateFilename(string filename) //{ // if (filename == null) // throw new ArgumentNullException("filename"); // if (filename.Length == 0) // throw new ArgumentException("filename is empty"); //} internal override void ReadFromVolumeDBRecord(IRecordData recordData) { base.ReadFromVolumeDBRecord(recordData); //filename = (string) recordData["Filename"]; //extension = Util.ReplaceDBNull<string>( recordData["Extension"], null); size = (long)recordData["Size"]; hash = Util.ReplaceDBNull <string>(recordData["Hash"], null); }
internal override void WriteToVolumeDBRecord(IRecordData recordData) { base.WriteToVolumeDBRecord(recordData); //recordData.AddField("Filename", filename); //recordData.AddField("Extension", extension); recordData.AddField("Size", size); recordData.AddField("Hash", hash); }
//private static void ValidatePath(string path) //{ // if (path == null) // throw new ArgumentNullException("path"); // if (path.Length == 0) // throw new ArgumentException("path is emtpy"); //} internal override void ReadFromVolumeDBRecord(IRecordData recordData) { base.ReadFromVolumeDBRecord(recordData); location = Util.ReplaceDBNull <string>(recordData["Location"], null); /* root item doesnt have a location */ //createdDate = Util.ReplaceDBNull<DateTime>( recordData["CreatedDate"], DateTime.MinValue); lastWriteTime = Util.ReplaceDBNull <DateTime>(recordData["LastWriteTime"], DateTime.MinValue); symLinkTargetID = (long)recordData["SymLinkTargetID"]; }
internal override void WriteToVolumeDBRecord(IRecordData recordData) { base.WriteToVolumeDBRecord(recordData); recordData.AddField("Location", location); //recordData.AddField("CreatedDate", m_createdDate); recordData.AddField("LastWriteTime", lastWriteTime); //recordData.AddField("SymLinkTargetID", symLinkTargetID < -1 ? -1 : symLinkTargetID); recordData.AddField("SymLinkTargetID", symLinkTargetID); }
public DnsEntry(DataBuffer buffer) { try { _domain = buffer.ReadDomainName(); byte b = buffer.ReadByte(); _recType = (RecordType)buffer.ReadShortInt(); _classType = buffer.ReadShortInt(); _ttl = buffer.ReadInt(); int length = buffer.ReadByte(); switch (_recType) { case RecordType.A: _data = new ARecord(buffer); break; case RecordType.NS: _data = new NSRecord(buffer); break; case RecordType.CNAME: _data = new CNameRecord(buffer); break; case RecordType.SOA: _data = new SoaRecord(buffer); break; case RecordType.MB: _data = new MBRecord(buffer); break; case RecordType.MG: _data = new MGRecord(buffer); break; case RecordType.MR: _data = new MRRecord(buffer); break; case RecordType.NULL: _data = new NullRecord(buffer, length); break; case RecordType.WKS: _data = new WksRecord(buffer, length); break; case RecordType.PTR: _data = new PtrRecord(buffer); break; case RecordType.HINFO: _data = new HInfoRecord(buffer, length); break; case RecordType.MINFO: _data = new MInfoRecord(buffer); break; case RecordType.MX: _data = new MXRecord(buffer); break; case RecordType.TXT: _data = new TxtRecord(buffer, length); break; case RecordType.RP: _data = new RPRecord(buffer); break; case RecordType.AFSDB: _data = new AfsdbRecord(buffer); break; case RecordType.X25: _data = new X25Record(buffer); break; case RecordType.ISDN: _data = new IsdnRecord(buffer); break; case RecordType.RT: _data = new RTRecord(buffer); break; case RecordType.NSAP: _data = new NsapRecord(buffer, length); break; case RecordType.SIG: _data = new SigRecord(buffer, length); break; case RecordType.KEY: _data = new KeyRecord(buffer, length); break; case RecordType.PX: _data = new PXRecord(buffer); break; case RecordType.AAAA: _data = new AAAARecord(buffer); break; case RecordType.LOC: _data = new LocRecord(buffer); break; case RecordType.SRV: _data = new SrvRecord(buffer); break; case RecordType.NAPTR: _data = new NaptrRecord(buffer); break; case RecordType.KX: _data = new KXRecord(buffer); break; case RecordType.A6: _data = new A6Record(buffer); break; case RecordType.DNAME: _data = new DNameRecord(buffer); break; case RecordType.DS: _data = new DSRecord(buffer, length); break; case RecordType.TKEY: _data = new TKeyRecord(buffer); break; case RecordType.TSIG: _data = new TSigRecord(buffer); break; default: throw new DnsQueryException("Invalid DNS Record Type in DNS Response", null); } } catch (Exception ex) { _data = new ExceptionRecord(ex.Message); throw ex; } }
internal override void ReadFromVolumeDBRecord(IRecordData recordData) { volumeID = (long)recordData["VolumeID"]; itemID = (long)recordData["ItemID"]; //rootID = (long) recordData["RootID"]; parentID = (long)recordData["ParentID"]; name = Util.ReplaceDBNull <string>(recordData["Name"], null); mimeType = Util.ReplaceDBNull <string>(recordData["MimeType"], null); metaData = new MetadataStore(Util.ReplaceDBNull <string>(recordData["MetaData"], null)); note = Util.ReplaceDBNull <string>(recordData["Note"], null); keywords = Util.ReplaceDBNull <string>(recordData["Keywords"], null); }
internal override void WriteToVolumeDBRecord(IRecordData recordData) { recordData.AddField("VolumeID", volumeID); recordData.AddField("ItemID", itemID); //recordData.AddField("RootID", rootID); recordData.AddField("ParentID", parentID); recordData.AddField("ItemType", itemType); recordData.AddField("Name", name); recordData.AddField("MimeType", mimeType); // NOTE : metadata can't be null since it is a struct recordData.AddField("MetaData", metaData.MetadataString); recordData.AddField("Note", note); recordData.AddField("Keywords", keywords); }
internal override void ReadFromVolumeDBRecord(IRecordData recordData) { volumeID = (long)recordData["VolumeID"]; title = Util.ReplaceDBNull <string>(recordData["Title"], null); added = Util.ReplaceDBNull <DateTime>(recordData["Added"], DateTime.MinValue); isHashed = (bool)recordData["IsHashed"]; archiveNo = Util.ReplaceDBNull <string>(recordData["ArchiveNr"], null); driveType = (VolumeDriveType)(int)(long)recordData["DriveType"]; loanedTo = Util.ReplaceDBNull <string>(recordData["Loaned_To"], null); loanedDate = Util.ReplaceDBNull <DateTime>(recordData["Loaned_Date"], DateTime.MinValue); returnDate = Util.ReplaceDBNull <DateTime>(recordData["Return_Date"], DateTime.MinValue); category = Util.ReplaceDBNull <string>(recordData["Category"], null); description = Util.ReplaceDBNull <string>(recordData["Description"], null); keywords = Util.ReplaceDBNull <string>(recordData["Keywords"], null); //clientAppData = Util.ReplaceDBNull<string>( recordData["ClientAppData"], null); }
internal override void WriteToVolumeDBRecord(IRecordData recordData) { recordData.AddField("VolumeID", volumeID); recordData.AddField("Title", title); recordData.AddField("Added", added); recordData.AddField("VolumeType", volumeType); recordData.AddField("IsHashed", isHashed); recordData.AddField("ArchiveNr", archiveNo); recordData.AddField("DriveType", driveType); recordData.AddField("Loaned_To", loanedTo); recordData.AddField("Loaned_Date", loanedDate); recordData.AddField("Return_Date", returnDate); recordData.AddField("Category", category); recordData.AddField("Description", description); recordData.AddField("Keywords", keywords); //recordData.AddField("ClientAppData", clientAppData); }
public HomeController(IMoneyExchangeService moneyExchangeService, ICheckCourse checkCourse, IRecordData recordData) { _moneyExchangeService = moneyExchangeService; _checkCourse = checkCourse; _recordData = recordData; }
internal override void WriteToVolumeDBRecord(IRecordData recordData) { base.WriteToVolumeDBRecord(recordData); recordData.AddField("IsContainer", true); }
private void WriteRecords(IVolumeDBRecord[] records, bool update) { List <string> sqlCommands = new List <string>(); StringBuilder sqlcmd = new StringBuilder(); int changed = 0; try { if (update) { foreach (IVolumeDBRecord record in records) { if (record.IsNew) { throw new InvalidOperationException("Database record can not be updated because it has not been inserted yet"); } // reset stringbuilder sqlcmd.Length = 0; sqlcmd.Append("UPDATE ").Append(record.TableName).Append(" SET "); int n = 0; IRecordData recData = record.GetRecordData(); foreach (FieldnameValuePair pair in recData) { if (n > 0) { sqlcmd.Append(", "); } string val = SqlPrepareValue(pair.Value, true); sqlcmd.Append(pair.Fieldname).Append(" = ").Append(val); n++; } string[] primarykeyFields = record.PrimaryKeyFields; if ((primarykeyFields != null) && (primarykeyFields.Length > 0)) // single-record-tables (e.g. table DatabaseProperties) may not have a primary key { sqlcmd.Append(" WHERE "); for (int i = 0; i < primarykeyFields.Length; i++) { if (i > 0) { sqlcmd.Append(" AND "); } string pk = primarykeyFields[i]; sqlcmd.Append(pk).Append(" = ").Append(recData[pk]); } } // string idField = record.TableIDField; // if (!string.IsNullOrEmpty(idField)) // single-record-tables (e.g. table DatabaseProperties) may not have a primary key // sqlcmd.Append(" WHERE ").Append(idField).Append(" = ").Append(recData[idField]); sqlCommands.Add(sqlcmd.ToString()); } } else // insert { StringBuilder fields = new StringBuilder(); StringBuilder values = new StringBuilder(); foreach (IVolumeDBRecord record in records) { if (!record.IsNew) { throw new InvalidOperationException("Database record has already been inserted"); } // reset stringbuilders sqlcmd.Length = 0; fields.Length = 0; values.Length = 0; sqlcmd.Append("INSERT INTO ").Append(record.TableName).Append(' '); int n = 0; IRecordData recData = record.GetRecordData(); foreach (FieldnameValuePair pair in recData) { if (n > 0) { fields.Append(", "); values.Append(", "); } string val = SqlPrepareValue(pair.Value, true); fields.Append(pair.Fieldname); values.Append(val); n++; } sqlcmd.Append('(').Append(fields.ToString()).Append(") VALUES (").Append(values.ToString()).Append(')'); record.IsNew = false; // mark the record object as not-new changed++; sqlCommands.Add(sqlcmd.ToString()); } } if (sqlCommands.Count > 1) { sql.ExecuteNonQuery(sqlCommands.ToArray()); } else { sql.ExecuteNonQuery(sqlCommands[0]); } } catch (Exception) { // undo changes if (!update) { for (int i = 0; i < changed; records[i++].IsNew = true) { ; } } throw; } }
internal override void ReadFromVolumeDBRecord(IRecordData recordData) { name = Util.ReplaceDBNull<string>( recordData["Name"], null); description = Util.ReplaceDBNull<string>( recordData["Description"], null); created = Util.ReplaceDBNull<DateTime>( recordData["Created"], DateTime.MinValue); version = (int)(long) recordData["Version"]; guid = (string) recordData["GUID"]; }
void IVolumeDBRecord.SetRecordData(IRecordData recordData) { ReadFromVolumeDBRecord(recordData); }
public RecordService(IRecordData record) { _datalayer = record; }
abstract void WriteToVolumeDBRecord(IRecordData recordData);
//private static void ValidateFilename(string filename) //{ // if (filename == null) // throw new ArgumentNullException("filename"); // if (filename.Length == 0) // throw new ArgumentException("filename is empty"); //} internal override void ReadFromVolumeDBRecord(IRecordData recordData) { base.ReadFromVolumeDBRecord(recordData); //filename = (string) recordData["Filename"]; //extension = Util.ReplaceDBNull<string>( recordData["Extension"], null); size = (long) recordData["Size"]; hash = Util.ReplaceDBNull<string>( recordData["Hash"], null); }
internal override void ReadFromVolumeDBRecord(IRecordData recordData) { volumeID = (long) recordData["VolumeID"]; title = Util.ReplaceDBNull<string>( recordData["Title"], null); added = Util.ReplaceDBNull<DateTime>( recordData["Added"], DateTime.MinValue); isHashed = (bool) recordData["IsHashed"]; archiveNo = Util.ReplaceDBNull<string>( recordData["ArchiveNr"], null); driveType = (VolumeDriveType)(int)(long) recordData["DriveType"]; loanedTo = Util.ReplaceDBNull<string>( recordData["Loaned_To"], null); loanedDate = Util.ReplaceDBNull<DateTime>( recordData["Loaned_Date"], DateTime.MinValue); returnDate = Util.ReplaceDBNull<DateTime>( recordData["Return_Date"], DateTime.MinValue); category = Util.ReplaceDBNull<string>( recordData["Category"], null); description = Util.ReplaceDBNull<string>( recordData["Description"], null); keywords = Util.ReplaceDBNull<string>( recordData["Keywords"], null); //clientAppData = Util.ReplaceDBNull<string>( recordData["ClientAppData"], null); }
//private static void ValidatePath(string path) //{ // if (path == null) // throw new ArgumentNullException("path"); // if (path.Length == 0) // throw new ArgumentException("path is emtpy"); //} internal override void ReadFromVolumeDBRecord(IRecordData recordData) { base.ReadFromVolumeDBRecord(recordData); location = Util.ReplaceDBNull<string>( recordData["Location"], null); /* root item doesnt have a location */ //createdDate = Util.ReplaceDBNull<DateTime>( recordData["CreatedDate"], DateTime.MinValue); lastWriteTime = Util.ReplaceDBNull<DateTime>( recordData["LastWriteTime"], DateTime.MinValue); symLinkTargetID = (long) recordData["SymLinkTargetID"]; }
public RecordService(IRecordData recordData) { _recordData = recordData; }
abstract void ReadFromVolumeDBRecord(IRecordData recordData);
internal override void ReadFromVolumeDBRecord(IRecordData recordData) { volumeID = (long) recordData["VolumeID"]; itemID = (long) recordData["ItemID"]; //rootID = (long) recordData["RootID"]; parentID = (long) recordData["ParentID"]; name = Util.ReplaceDBNull<string>( recordData["Name"], null); mimeType = Util.ReplaceDBNull<string>( recordData["MimeType"], null); metaData = new MetadataStore(Util.ReplaceDBNull<string>( recordData["MetaData"], null)); note = Util.ReplaceDBNull<string>( recordData["Note"], null); keywords = Util.ReplaceDBNull<string>( recordData["Keywords"], null); }