EchoTex_Payroll/HRM.BO/Fund/Investment/InvestmentTran.cs

275 lines
6.3 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00
using System;
using System.Linq;
using System.Data;
using System.Collections.Generic;
namespace HRM.BO
{
public class InvestmentTran : AuditTrailBase
{
#region Constructor
public InvestmentTran()
: base()
{
ActivityID = 0;
TranTypeID = 0;
CategoryID = 0;
InvestmentID = 0;
TemplateVoucherID = 0;
ProjectID = 0;
TranDate = DateTime.MinValue;
PrincipalAmount = 0.0;
}
#endregion Constructor
#region Properties
#region Property ActivityID : ID
public int ActivityID
{
get; set;
}
#endregion Property ActivityID : ID
#region Property TranTypeID : ID // modified from FMActivityID
public int TranTypeID
{
get; set;
}
#endregion Property TranTypeID : ID
#region Property CategoryID : ID
public int CategoryID
{
get; set;
}
#endregion Property CategoryID : ID
#region Property InvestmentID : ID
public int InvestmentID
{
get; set;
}
#endregion Property InvestmentID : ID
#region Property TemplateVoucherID : ID
public int TemplateVoucherID
{
get; set;
}
#endregion Property TemplateVoucherID : ID
#region Property ProjectID : ID
public int ProjectID
{
get; set;
}
#endregion Property ProjectID : ID
#region Property TranDate : DateTime
public DateTime TranDate
{
get; set;
}
#endregion Property TranDate : DateTime
#region Property PrincipalAmount : double
public double PrincipalAmount
{
get; set;
}
#endregion Property PrincipalAmount : double
#endregion Properties
//#region Service Factory IInvestmentTranService : IInvestmentTranService
//internal static IInvestmentTranService Service
//{
// get { return Services.Factory.CreateService<IInvestmentTranService>(typeof(IInvestmentTranService)); }
//}
//#endregion
//#region Function
//public void Save()
//{
// try
// {
// //base.SetAuditTrailProperties();
// Service.Save(this);
// //Clear Cache
// CacheInfo.ClearCache(typeof(InvestmentTran).FullName);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
//}
//public InvestmentTran Get(ID id)
//{
// #region Cache Header
// InvestmentTran investmentTran = _cache["Get", id] as InvestmentTran;
// if (investmentTran != null)
// return investmentTran;
// #endregion
// try
// {
// investmentTran = Service.Get(id);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(investmentTran, "Get", id);
// #endregion
// return investmentTran;
//}
//public static List<InvestmentTran> Get()
//{
// #region Cache Header
// List<InvestmentTran> investmentTrans = _cache["Get"] as List<InvestmentTran>;
// if (investmentTrans != null)
// return investmentTrans;
// #endregion
// try
// {
// investmentTrans = Service.Get();
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(investmentTrans, "Get");
// #endregion
// return investmentTrans;
//}
//public static List<InvestmentTran> Get(InvestmentInfo investmentInfo)
//{
// #region Cache Header
// List<InvestmentTran> investmentTrans = _cache["Get"] as List<InvestmentTran>;
// if (investmentTrans != null)
// return investmentTrans;
// #endregion
// try
// {
// investmentTrans = Service.Get(investmentInfo);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(investmentTrans, "Get");
// #endregion
// return investmentTrans;
//}
//public static DataTable GetTable()
//{
// try
// {
// return Service.GetTable();
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
//}
//public void Delete(ID investmentTranID)
//{
// try
// {
// Service.Delete(investmentTranID);
// //Clear Cache
// CacheInfo.ClearCache(typeof(InvestmentTran).FullName);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
//}
//#endregion Function
}
#region Class InvestmentTrans
public class InvestmentTrans : List<InvestmentTran>
{
#region Constructor
public InvestmentTrans()
{
}
#endregion
public InvestmentTran GetItemByInvestmentTran(int investmentTranID)
{
return this.Find(delegate (InvestmentTran item) { return item.ID == investmentTranID; });
}
}
#endregion
public interface IInvestmentTranService
{
void Save(InvestmentTran investmentTran);
void Delete(int investmentTranID);
InvestmentTran Get(int investmentTranID);
DataTable GetTable();
List<InvestmentTran> Get(InvestmentInfo investmentInfo);
List<InvestmentTran> Get();
}
}