264 lines
6.2 KiB
C#
264 lines
6.2 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using Ease.CoreV35;
|
|||
|
using Ease.CoreV35.Model;
|
|||
|
using Ease.CoreV35.Caching;
|
|||
|
using System.Data.Linq.Mapping;
|
|||
|
|
|||
|
namespace Payroll.BO
|
|||
|
{
|
|||
|
#region FSHead
|
|||
|
|
|||
|
[Serializable]
|
|||
|
public class FSHead : BasicBaseObject
|
|||
|
{
|
|||
|
#region Cache Store
|
|||
|
|
|||
|
private static Cache _cache = new Cache(typeof(FSHead));
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Constructor
|
|||
|
|
|||
|
public FSHead()
|
|||
|
{
|
|||
|
_code = string.Empty;
|
|||
|
_name = string.Empty;
|
|||
|
_isTaxable = false;
|
|||
|
_isLoan = false;
|
|||
|
_isPaymenttoVendor = false;
|
|||
|
_remarks = "";
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Input validator
|
|||
|
public string[] InputValidator()
|
|||
|
{
|
|||
|
string[] sErrorString = new string[2];
|
|||
|
if (this.Code == "")
|
|||
|
{
|
|||
|
sErrorString[0] = "Code can not be empty";
|
|||
|
sErrorString[1] = "Code";
|
|||
|
return sErrorString;
|
|||
|
}
|
|||
|
if (this.Name == "")
|
|||
|
{
|
|||
|
sErrorString[0] = "Description can not be empty";
|
|||
|
sErrorString[1] = "Description";
|
|||
|
return sErrorString;
|
|||
|
}
|
|||
|
if (this.IsLoan || this.IsPaymenttoVendor)
|
|||
|
{
|
|||
|
if (this.Remarks == "")
|
|||
|
{
|
|||
|
sErrorString[0] = "Remarks can not be empty";
|
|||
|
sErrorString[1] = "Remarks";
|
|||
|
return sErrorString;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
sErrorString = null;
|
|||
|
return sErrorString;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Properties
|
|||
|
|
|||
|
#region code : string
|
|||
|
|
|||
|
private string _code;
|
|||
|
public string Code
|
|||
|
{
|
|||
|
get { return _code; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<string>("code", _code, value);
|
|||
|
_code = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region name : string
|
|||
|
|
|||
|
private string _name;
|
|||
|
public string Name
|
|||
|
{
|
|||
|
get { return _name; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<string>("name", _name, value);
|
|||
|
_name = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
#region Remarks : string
|
|||
|
|
|||
|
private string _remarks;
|
|||
|
public string Remarks
|
|||
|
{
|
|||
|
get { return _remarks; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<string>("remarks", _remarks, value);
|
|||
|
_remarks = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region IsTaxable : bool
|
|||
|
|
|||
|
private bool _isTaxable;
|
|||
|
public bool IsTaxable
|
|||
|
{
|
|||
|
get { return _isTaxable; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<bool>("accountingformat", _isTaxable, value);
|
|||
|
_isTaxable = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
#region IsLoan : bool
|
|||
|
|
|||
|
private bool _isLoan;
|
|||
|
public bool IsLoan
|
|||
|
{
|
|||
|
get { return _isLoan; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<bool>("accountingformat", _isLoan, value);
|
|||
|
_isLoan = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
#region IsPaymenttoVendor : bool
|
|||
|
|
|||
|
private bool _isPaymenttoVendor;
|
|||
|
public bool IsPaymenttoVendor
|
|||
|
{
|
|||
|
get { return _isPaymenttoVendor; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<bool>("accountingformat", _isPaymenttoVendor, value);
|
|||
|
_isPaymenttoVendor = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Service Factory IBankService : IBankService
|
|||
|
|
|||
|
internal static IFSHeadService Service
|
|||
|
{
|
|||
|
get { return Services.Factory.CreateService<IFSHeadService>(typeof(IFSHeadService)); }
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Functions
|
|||
|
public string GetNextCode()
|
|||
|
{
|
|||
|
return FSHead.Service.GetNextCode();
|
|||
|
}
|
|||
|
public static FSHead Get(ID nID)
|
|||
|
{
|
|||
|
FSHead oFSHead = null;
|
|||
|
#region Cache Header
|
|||
|
oFSHead = (FSHead)_cache["Get", nID];
|
|||
|
if (oFSHead != null)
|
|||
|
return oFSHead;
|
|||
|
#endregion
|
|||
|
oFSHead = FSHead.Service.Get(nID);
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(oFSHead, "Get", nID);
|
|||
|
#endregion
|
|||
|
return oFSHead;
|
|||
|
}
|
|||
|
public static ObjectsTemplate<FSHead> Get()
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
ObjectsTemplate<FSHead> FSHeads = _cache["Get"] as ObjectsTemplate<FSHead>;
|
|||
|
if (FSHeads != null)
|
|||
|
return FSHeads;
|
|||
|
#endregion
|
|||
|
try
|
|||
|
{
|
|||
|
FSHeads = Service.Get();
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(FSHeads, "Get");
|
|||
|
#endregion
|
|||
|
return FSHeads;
|
|||
|
}
|
|||
|
|
|||
|
public static ObjectsTemplate<FSHead> Get(EnumStatus status)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
|
|||
|
ObjectsTemplate<FSHead> FSHeads = _cache["Get", status] as ObjectsTemplate<FSHead>;
|
|||
|
if (FSHeads != null)
|
|||
|
return FSHeads;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
FSHeads = Service.Get(status);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
#region Cache Footer
|
|||
|
|
|||
|
_cache.Add(FSHeads, "Get", status);
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
return FSHeads;
|
|||
|
}
|
|||
|
public ID Save()
|
|||
|
{
|
|||
|
this.SetAuditTrailProperties();
|
|||
|
return FSHead.Service.Save(this);
|
|||
|
}
|
|||
|
|
|||
|
public void Delete(ID id)
|
|||
|
{
|
|||
|
FSHead.Service.Delete(id);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region IFSHead Service
|
|||
|
|
|||
|
public interface IFSHeadService
|
|||
|
{
|
|||
|
FSHead Get(ID id);
|
|||
|
ObjectsTemplate<FSHead> Get();
|
|||
|
ObjectsTemplate<FSHead> Get(EnumStatus status);
|
|||
|
ID Save(FSHead item);
|
|||
|
string GetNextCode();
|
|||
|
void Delete(ID id);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|