///////////////////////////////////////////////////////////
// Document.cs
// Implementation of the Class Document
// Generated by Enterprise Architect
// Created on: 28-May-2004 1:21:49 PM
// Original author: Joyce
///////////////////////////////////////////////////////////
using System;
using System.Data;
using CSLA.Data;
using CSLA;//using CSLA;
namespace GZTW.AyaNova.BLL {
[Serializable]
public class Document : BusinessBase {
private Guid mID;
private SmartDate mCreated;
private SmartDate mModified;
private Guid mCreator;
private Guid mModifier;
///
/// Calculated checksum of the data contained in the business object to handle mult-
/// user concurrency
///
private long mOriginalCheckSum;
private string mNotes;
///
/// Binary array of bytes stored in the database as an image field
///
private byte mDocumentData;
///
/// original file name and extension
///
private string mFileName;
///
/// if null than is a actual document stored within the database
/// if not null, is a redirect to a document at a specific location outside the
/// database (i.e webpage, file on server, local directory)
///
private string mURL;
///
/// User friendly name of document
///
private string mName;
~Document(){
}
///
/// Private constructor to prevent direct instantiation
///
private Document()
{
mID=Guid.NewGuid();
mCreated=new SmartDate();
mModified=new SmartDate();
}
///
/// original file name and extension
///
public string FileName {
get{
return mFileName;
}
set{
mFileName = value;
}
}
///
/// user friendly name
///
public string Name
{
get
{
return mName;
}
set
{
mName = value;
}
}
public string Notes {
get{
return mNotes;
}
set{
mNotes = value;
}
}
///
/// Binary array of bytes stored in the database as an image field
///
public byte DocumentData {
get{
return mDocumentData;
}
set{
mDocumentData = value;
}
}
///
/// if null than is a actual document stored within the database
/// if not null, is a redirect to a document at a specific location outside the
/// database (i.e webpage, file on server, local directory)
///
public string URL {
get{
return mURL;
}
set{
mURL = value;
}
}
public override string ToString(){
return "Document:" + mName + mID.ToString();
}
///
///
public override bool Equals(Object obj)
{
if ( obj == null || GetType ( ) != obj.GetType ( ) ) return false;
Document c=(Document)obj;
return mID==c.mID;
}
public override int GetHashCode()
{
return mID.GetHashCode();
}
public static Document NewItem(){
return (Document)DataPortal.Create(new Criteria(Guid.Empty));
}
///
/// Client Guid
public static Document GetItem(Guid _ID){
return (Document)DataPortal.Fetch(new Criteria(_ID));
}
#region criteria
///
/// Criteria for identifying existing object
///
[Serializable]
private class Criteria
{
public Guid ID;
public Criteria(Guid _ID)
{
ID=_ID;
}
}
#endregion
///
/// Delete Document
/// Rules:
/// - can't delete if used anywhere in database
///
/// Client GUID
public static void DeleteItem(Guid _ID)
{
}
///
/// Called by DataPortal so that we can set defaults as needed Would probably do a
/// lookup from the db for default values in a more complete version
///
///
protected override void DataPortal_Create(object Criteria){
}
///
///
protected override void DataPortal_Fetch(object Criteria){
}
///
/// Called by DataPortal to delete/add/update data into the database
///
protected override void DataPortal_Update(){
}
///
/// Remove a Document record from the database but only if you are an
/// administrator
///
///
protected override void DataPortal_Delete(object Criteria){
}
///
/// Get internal id number Read only property because it's set internally, not
/// externally
///
public Guid ID {
get{
return mID;
}
}
///
/// Get created date
/// Rules:
/// - read-only
///
public string Created {
get{
return mCreated.Text;
}
}
///
/// Get modified date
/// Rules:
/// - read-only
///
public string Modified {
get{
return mModified.Text;
}
}
///
/// Get user record ID of person who created this record
/// Rules:
/// - read-only
///
public Guid Creator {
get{
return mCreator;
}
}
///
/// Get user ID of person who modified this record
/// Rules:
/// - read-only
///
public Guid Modifier {
get{
return mModifier;
}
}
}//end Document
}//end namespace GZTW.AyaNova.BLL