/// <summary> /// <para>Required by internal factory methods like AbstractVolumeScanner.CreateVolumeObject()</para> /// <para>Purpose :</para> /// <para> /// - guarantee that _all_ fields of this type are initialized by the caller /// (in contrast to property initialization, which easily makes you miss a property [in particular if a new one was added..]) /// </para> /// <para> /// - seperate fields of a type from fields of its base type (e.g. AbstractVolumeScanner.CreateVolumeObject() initializes all fields of a the Volume base type. /// Caller code only needs to initialize fields of the derived Volume type) /// </para> /// </summary> internal void SetVolumeFields( long volumeID, string title, DateTime added, bool isHashed, string archiveNo, VolumeDriveType driveType, string loanedTo, DateTime loanedDate, DateTime returnDate, string category, string description, string keywords /*, * string clientAppData*/) { this.volumeID = volumeID; this.title = title; this.added = added; this.isHashed = isHashed; this.archiveNo = archiveNo; this.driveType = driveType; this.loanedTo = loanedTo; this.loanedDate = loanedDate; this.returnDate = returnDate; this.category = category; this.description = description; this.keywords = keywords; //this.clientAppData = clientAppData; }
private void ImportMedia(XmlNode node, string borrow, string comment, long volumeID) { FileSystemVolume v = new FileSystemVolume(targetDb); VolumeDriveType driveType = driveTypeMapping[node.Attributes["type"].Value]; DateTime added; if (!DateTime.TryParseExact(node.Attributes["time"].Value, DATETIME_FORMAT, ci.DateTimeFormat, DateTimeStyles.None, out added)) { added = DateTime.MinValue; } v.SetVolumeFields(volumeID, node.Attributes["name"].Value, added, false, node.Attributes["number"].Value, driveType, borrow, DateTime.MinValue, DateTime.MinValue, null, comment, null); v.SetFileSystemVolumeFields(counters[TOTAL_FILES], counters[TOTAL_DIRS], counters[TOTAL_SIZE]); v.InsertIntoDB(); // insert root item DirectoryVolumeItem item = new DirectoryVolumeItem(targetDb); item.SetFileSystemVolumeItemFields(null, DateTime.MinValue, VolumeDatabase.ID_NONE); item.SetVolumeItemFields(volumeID, 1L, 0L, "/", VolumeScanner.FilesystemVolumeScanner.MIME_TYPE_DIRECTORY, MetadataStore.Empty, null, null); item.InsertIntoDB(); }
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 Volume(VolumeDatabase database, VolumeType volumeType) : base(tableName, primarykeyFields) { this.volumeID = 0L; this.title = null; this.added = DateTime.MinValue; this.isHashed = false; this.archiveNo = null; this.driveType = VolumeDriveType.Unknown; this.loanedTo = null; this.loanedDate = DateTime.MinValue; this.returnDate = DateTime.MinValue; this.category = null; this.description = null; this.keywords = null; //this.clientAppData = null; this.database = database; this.volumeType = volumeType; }
/// <summary> /// <para>Required by internal factory methods like AbstractVolumeScanner.CreateVolumeObject()</para> /// <para>Purpose :</para> /// <para> /// - guarantee that _all_ fields of this type are initialized by the caller /// (in contrast to property initialization, which easily makes you miss a property [in particular if a new one was added..]) /// </para> /// <para> /// - seperate fields of a type from fields of its base type (e.g. AbstractVolumeScanner.CreateVolumeObject() initializes all fields of a the Volume base type. /// Caller code only needs to initialize fields of the derived Volume type) /// </para> /// </summary> internal void SetVolumeFields( long volumeID, string title, DateTime added, bool isHashed, string archiveNo, VolumeDriveType driveType, string loanedTo, DateTime loanedDate, DateTime returnDate, string category, string description, string keywords /*, string clientAppData*/) { this.volumeID = volumeID; this.title = title; this.added = added; this.isHashed = isHashed; this.archiveNo = archiveNo; this.driveType = driveType; this.loanedTo = loanedTo; this.loanedDate = loanedDate; this.returnDate = returnDate; this.category = category; this.description = description; this.keywords = keywords; //this.clientAppData = clientAppData; }
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); }