497 lines
13 KiB
C#
497 lines
13 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Data;
|
|||
|
using Ease.CoreV35;
|
|||
|
using Ease.CoreV35.Model;
|
|||
|
using Ease.CoreV35.Caching;
|
|||
|
using System.Data.Linq.Mapping;
|
|||
|
using Ease.CoreV35.Utility;
|
|||
|
|
|||
|
namespace Payroll.BO
|
|||
|
{
|
|||
|
#region EmployeeBankAccount
|
|||
|
|
|||
|
[Serializable]
|
|||
|
public class EmployeeBankAccount : AuditTrailBase
|
|||
|
{
|
|||
|
#region Cache Store
|
|||
|
|
|||
|
private static Cache _cache = new Cache(typeof(EmployeeBankAccount));
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Constructor
|
|||
|
|
|||
|
public EmployeeBankAccount()
|
|||
|
{
|
|||
|
_employeeID = null;
|
|||
|
_effectDate = DateTime.MinValue;
|
|||
|
_accountNo = string.Empty;
|
|||
|
_branchID = null;
|
|||
|
_accountType = EnumBankAccountType.SalaryAccount;
|
|||
|
_branch = null;
|
|||
|
_employee = null;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Properties
|
|||
|
|
|||
|
#region EmployeeID : ID
|
|||
|
|
|||
|
private ID _employeeID;
|
|||
|
public ID EmployeeID
|
|||
|
{
|
|||
|
get { return _employeeID; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<ID>("EmployeeID", _employeeID, value);
|
|||
|
_employeeID = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region effectDate : DateTime
|
|||
|
|
|||
|
private DateTime _effectDate;
|
|||
|
public DateTime EffectDate
|
|||
|
{
|
|||
|
get { return _effectDate; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<DateTime>("effectDate", _effectDate, value);
|
|||
|
_effectDate = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region accountNo : string
|
|||
|
|
|||
|
private string _accountNo;
|
|||
|
public string AccountNo
|
|||
|
{
|
|||
|
get { return _accountNo; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<string>("accountNo", _accountNo, value);
|
|||
|
_accountNo = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region BranchID : ID
|
|||
|
|
|||
|
private ID _branchID;
|
|||
|
public ID BranchID
|
|||
|
{
|
|||
|
get { return _branchID; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<ID>("BranchID", _branchID, value);
|
|||
|
_branchID = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region accountType : EnumBankAccountType
|
|||
|
|
|||
|
private EnumBankAccountType _accountType;
|
|||
|
public EnumBankAccountType AccountType
|
|||
|
{
|
|||
|
get { return _accountType; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<short>("accountType",(short) _accountType, (short)value);
|
|||
|
_accountType = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region branch : Branch
|
|||
|
|
|||
|
private Branch _branch;
|
|||
|
public Branch Branch
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_branchID.Integer > 0 && _branch == null)
|
|||
|
{
|
|||
|
_branch = new Branch();
|
|||
|
_branch = Branch.Get(_branchID);
|
|||
|
}
|
|||
|
return this._branch;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
_branch = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region employee : Employee
|
|||
|
|
|||
|
private Employee _employee;
|
|||
|
public Employee Employee
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_employeeID.Integer > 0 && _employee == null)
|
|||
|
{
|
|||
|
_employee = new Employee();
|
|||
|
_employee = Employee.Get(_employeeID);
|
|||
|
}
|
|||
|
return this._employee;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
_employee = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Service Factory IEmployeeBankAccountService : IEmployeeBankAccountService
|
|||
|
|
|||
|
internal static IEmployeeBankAccountService Service
|
|||
|
{
|
|||
|
get { return Services.Factory.CreateService<IEmployeeBankAccountService>(typeof(IEmployeeBankAccountService)); }
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Functions
|
|||
|
|
|||
|
public static EmployeeBankAccount Get(ID nID)
|
|||
|
{
|
|||
|
EmployeeBankAccount oEmployeeBankAccount = null;
|
|||
|
#region Cache Header
|
|||
|
oEmployeeBankAccount = (EmployeeBankAccount)_cache["Get", nID];
|
|||
|
if (oEmployeeBankAccount != null)
|
|||
|
return oEmployeeBankAccount;
|
|||
|
#endregion
|
|||
|
oEmployeeBankAccount = EmployeeBankAccount.Service.Get(nID);
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(oEmployeeBankAccount, "Get", nID);
|
|||
|
#endregion
|
|||
|
return oEmployeeBankAccount;
|
|||
|
}
|
|||
|
|
|||
|
public static EmployeeBankAccount Get(ID nEmpID, DateTime dEffectDate)
|
|||
|
{
|
|||
|
EmployeeBankAccount oEmployeeBankAccount = null;
|
|||
|
#region Cache Header
|
|||
|
oEmployeeBankAccount = (EmployeeBankAccount)_cache["Get", nEmpID, dEffectDate];
|
|||
|
if (oEmployeeBankAccount != null)
|
|||
|
return oEmployeeBankAccount;
|
|||
|
#endregion
|
|||
|
oEmployeeBankAccount = EmployeeBankAccount.Service.Get(nEmpID, dEffectDate,SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(oEmployeeBankAccount, "Get", nEmpID, dEffectDate);
|
|||
|
#endregion
|
|||
|
return oEmployeeBankAccount;
|
|||
|
}
|
|||
|
|
|||
|
public static ObjectsTemplate<EmployeeBankAccount> Get()
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
|
|||
|
ObjectsTemplate<EmployeeBankAccount> employeeBankAccounts = _cache["Get"] as ObjectsTemplate<EmployeeBankAccount>;
|
|||
|
if (employeeBankAccounts != null)
|
|||
|
return employeeBankAccounts;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
employeeBankAccounts = Service.Get();
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
#region Cache Footer
|
|||
|
|
|||
|
_cache.Add(employeeBankAccounts, "Get");
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
return employeeBankAccounts;
|
|||
|
}
|
|||
|
public void SetObjectID(int IdValue)
|
|||
|
{
|
|||
|
this.SetID(ID.FromInteger(IdValue));
|
|||
|
}
|
|||
|
|
|||
|
public static ObjectsTemplate<EmployeeBankAccount> GetByEmployeeID(ID nID)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
|
|||
|
ObjectsTemplate<EmployeeBankAccount> employeeBankAccounts = _cache["GetByEmployeeID"] as ObjectsTemplate<EmployeeBankAccount>;
|
|||
|
if (employeeBankAccounts != null)
|
|||
|
return employeeBankAccounts;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
employeeBankAccounts = Service.GetByEmployeeID(nID);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
#region Cache Footer
|
|||
|
|
|||
|
_cache.Add(employeeBankAccounts, "GetByEmployeeID");
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
return employeeBankAccounts;
|
|||
|
}
|
|||
|
|
|||
|
public static DataSet GetEmpBankAdvice(DateTime dSMonthDate,string sEmpID)
|
|||
|
{
|
|||
|
DataSet ds = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
ds = Service.GetEmpBankAdvice(dSMonthDate,sEmpID);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
return ds;
|
|||
|
}
|
|||
|
|
|||
|
public static DataSet GetEmpEuroBankAdvice(DateTime dSMonthDate, string sEmpID)
|
|||
|
{
|
|||
|
DataSet ds = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
ds = Service.GetEmpEuroBankAdvice(dSMonthDate, sEmpID);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
return ds;
|
|||
|
}
|
|||
|
|
|||
|
public static DataSet GetOPIEmpBankAdvice(DateTime dSMonthDate, string sEmpID,int bankID)
|
|||
|
{
|
|||
|
DataSet ds = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
ds = Service.GetOPIEmpBankAdvice(dSMonthDate, sEmpID, bankID);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
return ds;
|
|||
|
}
|
|||
|
public static DataSet GetEmpCarFuelBankAdvice(DateTime dSMonthDate, string sEmpID, int bankID)
|
|||
|
{
|
|||
|
DataSet ds = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
ds = Service.GetEmpCarFuelBankAdvice(dSMonthDate, sEmpID, bankID);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
return ds;
|
|||
|
}
|
|||
|
|
|||
|
public static DataSet GetHNMOPIEmpBankAdvice(DateTime dSMonthDate, string sEmpID)
|
|||
|
{
|
|||
|
DataSet ds = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
ds = Service.GetHNMOPIEmpBankAdvice(dSMonthDate, sEmpID);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
return ds;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public static DataSet GetEmpBankHistory(DateTime dSMonthDate)
|
|||
|
{
|
|||
|
DataSet ds = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
ds = Service.GetEmpBankHistory(dSMonthDate,SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
return ds;
|
|||
|
}
|
|||
|
|
|||
|
public static DataSet GetEmpBankHistory(DateTime dSFromDate, DateTime dSToDate)
|
|||
|
{
|
|||
|
DataSet ds = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
ds = Service.GetEmpBankHistory(dSFromDate, dSToDate,SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
return ds;
|
|||
|
}
|
|||
|
|
|||
|
public static DataSet GetEmpPrvBankHistory(DateTime salaryMonthDate)
|
|||
|
{
|
|||
|
DataSet ds = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
ds = Service.GetEmpPrvBankHistory(salaryMonthDate,SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
return ds;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public ID Save()
|
|||
|
{
|
|||
|
base.SetAuditTrailProperties();
|
|||
|
return EmployeeBankAccount.Service.Save(this);
|
|||
|
}
|
|||
|
public void Delete()
|
|||
|
{
|
|||
|
EmployeeBankAccount.Service.Delete(ID);
|
|||
|
}
|
|||
|
internal void DeleteAll()
|
|||
|
{
|
|||
|
EmployeeBankAccount.Service.DeleteAll();
|
|||
|
}
|
|||
|
|
|||
|
public static ObjectsTemplate<EmployeeBankAccount> GetByDate(DateTime from, DateTime to, string sEmpIDs)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
ObjectsTemplate<EmployeeBankAccount> EmployeeBankAccounts = _cache["GetByDate", from, to] as ObjectsTemplate<EmployeeBankAccount>;
|
|||
|
if (EmployeeBankAccounts != null)
|
|||
|
return EmployeeBankAccounts;
|
|||
|
#endregion
|
|||
|
try
|
|||
|
{
|
|||
|
EmployeeBankAccounts = Service.GetByDate(from, to, SystemInformation.CurrentSysInfo.PayrollTypeID.Integer, sEmpIDs);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(EmployeeBankAccounts, "GetByDate", from, to);
|
|||
|
#endregion
|
|||
|
return EmployeeBankAccounts;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
public static DataSet GetEmpBankAdvice(DateTime salaryMonthDate, int bankID)
|
|||
|
{
|
|||
|
DataSet ds = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
ds = Service.GetEmpBankAdvice(salaryMonthDate, bankID);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
return ds;
|
|||
|
}
|
|||
|
|
|||
|
public static DataSet GetEmpOPIBankAdvice(DateTime salaryMonthDate, int bankID)
|
|||
|
{
|
|||
|
DataSet ds = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
ds = Service.GetEmpOPIBankAdvice(salaryMonthDate, bankID);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
return ds;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region IEmployeeBankAccount Service
|
|||
|
|
|||
|
public interface IEmployeeBankAccountService
|
|||
|
{
|
|||
|
EmployeeBankAccount Get(ID id);
|
|||
|
ObjectsTemplate<EmployeeBankAccount> Get();
|
|||
|
ObjectsTemplate<EmployeeBankAccount> GetByEmployeeID(ID nID);
|
|||
|
DataSet GetEmpBankAdvice(DateTime dSalaryMonthDate,string sEmpID);
|
|||
|
DataSet GetEmpBankHistory(DateTime dSalaryMonthDate, int payrollTypeID);
|
|||
|
DataSet GetEmpBankHistory(DateTime dSFromDate, DateTime dSToDate, int payrollTypeID);
|
|||
|
DataSet GetEmpPrvBankHistory(DateTime salaryMonthDate, int payrollTypeID);
|
|||
|
ID Save(EmployeeBankAccount item);
|
|||
|
void Delete(ID id);
|
|||
|
void DeleteAll();
|
|||
|
EmployeeBankAccount Get(ID nEmpID, DateTime dEffectDate, int payrollTypeID);
|
|||
|
ObjectsTemplate<EmployeeBankAccount> GetByDate(DateTime from, DateTime to, int payrollTypeID, string sEmpIDs);
|
|||
|
DataSet GetEmpEuroBankAdvice(DateTime dSMonthDate, string sEmpID);
|
|||
|
DataSet GetOPIEmpBankAdvice(DateTime dSMonthDate, string sEmpID, int bankID);
|
|||
|
DataSet GetEmpCarFuelBankAdvice(DateTime dSMonthDate, string sEmpID, int bankID);
|
|||
|
DataSet GetHNMOPIEmpBankAdvice(DateTime dSMonthDate, string sEmpID);
|
|||
|
DataSet GetEmpBankAdvice(DateTime salaryMonthDate, int bankID);
|
|||
|
|
|||
|
DataSet GetEmpOPIBankAdvice(DateTime salaryMonthDate, int bankID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|