This commit is contained in:
278
source/bizobjects/AyaLib/Document.cs
Normal file
278
source/bizobjects/AyaLib/Document.cs
Normal file
@@ -0,0 +1,278 @@
|
||||
///////////////////////////////////////////////////////////
|
||||
// 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;
|
||||
/// <summary>
|
||||
/// Calculated checksum of the data contained in the business object to handle mult-
|
||||
/// user concurrency
|
||||
/// </summary>
|
||||
private long mOriginalCheckSum;
|
||||
private string mNotes;
|
||||
/// <summary>
|
||||
/// Binary array of bytes stored in the database as an image field
|
||||
/// </summary>
|
||||
private byte mDocumentData;
|
||||
/// <summary>
|
||||
/// original file name and extension
|
||||
/// </summary>
|
||||
private string mFileName;
|
||||
/// <summary>
|
||||
/// 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)
|
||||
/// </summary>
|
||||
private string mURL;
|
||||
|
||||
/// <summary>
|
||||
/// User friendly name of document
|
||||
/// </summary>
|
||||
private string mName;
|
||||
|
||||
|
||||
|
||||
~Document(){
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private constructor to prevent direct instantiation
|
||||
/// </summary>
|
||||
private Document()
|
||||
{
|
||||
mID=Guid.NewGuid();
|
||||
mCreated=new SmartDate();
|
||||
mModified=new SmartDate();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// original file name and extension
|
||||
/// </summary>
|
||||
public string FileName {
|
||||
get{
|
||||
return mFileName;
|
||||
}
|
||||
set{
|
||||
mFileName = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// user friendly name
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
set
|
||||
{
|
||||
mName = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Notes {
|
||||
get{
|
||||
return mNotes;
|
||||
}
|
||||
set{
|
||||
mNotes = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Binary array of bytes stored in the database as an image field
|
||||
/// </summary>
|
||||
public byte DocumentData {
|
||||
get{
|
||||
return mDocumentData;
|
||||
}
|
||||
set{
|
||||
mDocumentData = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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)
|
||||
/// </summary>
|
||||
public string URL {
|
||||
get{
|
||||
return mURL;
|
||||
}
|
||||
set{
|
||||
mURL = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString(){
|
||||
return "Document:" + mName + mID.ToString();
|
||||
|
||||
}
|
||||
|
||||
///
|
||||
/// <param name="obj"></param>
|
||||
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));
|
||||
}
|
||||
|
||||
///
|
||||
/// <param name="_ID">Client Guid</param>
|
||||
public static Document GetItem(Guid _ID){
|
||||
return (Document)DataPortal.Fetch(new Criteria(_ID));
|
||||
}
|
||||
|
||||
#region criteria
|
||||
/// <summary>
|
||||
/// Criteria for identifying existing object
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
private class Criteria
|
||||
{
|
||||
public Guid ID;
|
||||
public Criteria(Guid _ID)
|
||||
{
|
||||
ID=_ID;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Delete Document
|
||||
/// Rules:
|
||||
/// - can't delete if used anywhere in database
|
||||
/// </summary>
|
||||
/// <param name="_ID">Client GUID</param>
|
||||
public static void DeleteItem(Guid _ID)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
/// <param name="Criteria"></param>
|
||||
protected override void DataPortal_Create(object Criteria){
|
||||
|
||||
}
|
||||
|
||||
///
|
||||
/// <param name="Criteria"></param>
|
||||
protected override void DataPortal_Fetch(object Criteria){
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called by DataPortal to delete/add/update data into the database
|
||||
/// </summary>
|
||||
protected override void DataPortal_Update(){
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove a Document record from the database but only if you are an
|
||||
/// administrator
|
||||
/// </summary>
|
||||
/// <param name="Criteria"></param>
|
||||
protected override void DataPortal_Delete(object Criteria){
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get internal id number Read only property because it's set internally, not
|
||||
/// externally
|
||||
/// </summary>
|
||||
public Guid ID {
|
||||
get{
|
||||
return mID;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get created date
|
||||
/// Rules:
|
||||
/// - read-only
|
||||
/// </summary>
|
||||
public string Created {
|
||||
get{
|
||||
return mCreated.Text;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get modified date
|
||||
/// Rules:
|
||||
/// - read-only
|
||||
/// </summary>
|
||||
public string Modified {
|
||||
get{
|
||||
return mModified.Text;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get user record ID of person who created this record
|
||||
/// Rules:
|
||||
/// - read-only
|
||||
/// </summary>
|
||||
public Guid Creator {
|
||||
get{
|
||||
return mCreator;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get user ID of person who modified this record
|
||||
/// Rules:
|
||||
/// - read-only
|
||||
/// </summary>
|
||||
public Guid Modifier {
|
||||
get{
|
||||
return mModifier;
|
||||
}
|
||||
}
|
||||
|
||||
}//end Document
|
||||
|
||||
}//end namespace GZTW.AyaNova.BLL
|
||||
Reference in New Issue
Block a user