739 lines
26 KiB
C#
739 lines
26 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 JVSetup
|
|
[Serializable]
|
|
public class JVSetup : BasicBaseObject
|
|
{
|
|
public delegate void ItemChanged();
|
|
|
|
#region Cache Store
|
|
private static Cache _cache = new Cache(typeof(JVSetup));
|
|
#endregion
|
|
|
|
#region Constructor
|
|
public JVSetup()
|
|
{
|
|
_description = string.Empty;
|
|
_gLCode = string.Empty;
|
|
_isConfirmed = false;
|
|
_isEmployeeDetail = false;
|
|
_jvTypeID = null;
|
|
_monthDate = DateTime.MinValue;
|
|
_sequenceNo = 0;
|
|
_showCC = false;
|
|
_bookToCC = false;
|
|
_bookToPC = false;
|
|
_side = (int)EnumSide.Add;
|
|
_sideCode = string.Empty;
|
|
_jvSetupDetails = null;
|
|
_EmpType = EnumJVEmpType.RegardLess;
|
|
}
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
#region Description
|
|
private string _description;
|
|
public string Description
|
|
{
|
|
get
|
|
{
|
|
return _description;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<string>("description", _description, value);
|
|
_description = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region GLCode
|
|
private string _gLCode;
|
|
public string GLCode
|
|
{
|
|
get
|
|
{
|
|
return _gLCode;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<string>("glCode", _gLCode, value);
|
|
_gLCode = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region IsConfirmed
|
|
private bool _isConfirmed;
|
|
public bool IsConfirmed
|
|
{
|
|
get
|
|
{
|
|
return _isConfirmed;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<bool>("isConfirmed", _isConfirmed, value);
|
|
_isConfirmed = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region IsEmployeeDetail
|
|
private bool _isEmployeeDetail;
|
|
public bool IsEmployeeDetail
|
|
{
|
|
get
|
|
{
|
|
return _isEmployeeDetail;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<bool>("isEmployeeDetail", _isEmployeeDetail, value);
|
|
_isEmployeeDetail = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region JVTypeID
|
|
private ID _jvTypeID;
|
|
public ID JVTypeID
|
|
{
|
|
get
|
|
{
|
|
return _jvTypeID;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<ID>("jvTypeID", _jvTypeID, value);
|
|
_jvTypeID = value;
|
|
}
|
|
}
|
|
#endregion
|
|
#region EmployeeID
|
|
private ID _EmployeeID;
|
|
public ID EmployeeID
|
|
{
|
|
get
|
|
{
|
|
return _EmployeeID;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<ID>("EmployeeID", _EmployeeID, value);
|
|
_EmployeeID = value;
|
|
}
|
|
}
|
|
#endregion
|
|
#region jvType : JVType
|
|
|
|
private JVType _jvType;
|
|
public JVType JVType
|
|
{
|
|
get
|
|
{
|
|
if (JVTypeID.Integer > 0)
|
|
{
|
|
_jvType = new JVType();
|
|
_jvType = JVType.Get(JVTypeID);
|
|
}
|
|
return _jvType;
|
|
}
|
|
set
|
|
{
|
|
_jvType = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region MonthDate
|
|
private DateTime _monthDate;
|
|
public DateTime MonthDate
|
|
{
|
|
get
|
|
{
|
|
return _monthDate;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<DateTime>("monthDate", _monthDate, value);
|
|
_monthDate = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region SequenceNo
|
|
private int _sequenceNo;
|
|
public int SequenceNo
|
|
{
|
|
get
|
|
{
|
|
return _sequenceNo;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<int>("sequenceNo", _sequenceNo, value);
|
|
_sequenceNo = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region ShowCC
|
|
private bool _showCC;
|
|
public bool ShowCC
|
|
{
|
|
get
|
|
{
|
|
return _showCC;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<bool>("showCC", _showCC, value);
|
|
_showCC = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region BookToCC
|
|
private bool _bookToCC;
|
|
public bool BookToCC
|
|
{
|
|
get
|
|
{
|
|
return _bookToCC;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<bool>("BookToCC", _bookToCC, value);
|
|
_bookToCC = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region BookToPC
|
|
private bool _bookToPC;
|
|
public bool BookToPC
|
|
{
|
|
get
|
|
{
|
|
return _bookToPC;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<bool>("BookToPC", _bookToPC, value);
|
|
_bookToPC = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Side
|
|
private int _side;
|
|
public int Side
|
|
{
|
|
get
|
|
{
|
|
return _side;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<int>("side", _side, value);
|
|
_side = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region SideCode
|
|
private string _sideCode;
|
|
public string SideCode
|
|
{
|
|
get
|
|
{
|
|
return _sideCode;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<string>("sideCode", _sideCode, value);
|
|
_sideCode = value;
|
|
}
|
|
}
|
|
#endregion
|
|
#region GroupCode
|
|
private string _GroupCode="";
|
|
public string GroupCode
|
|
{
|
|
get
|
|
{
|
|
return _GroupCode;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<string>("GroupCode", _GroupCode, value);
|
|
_GroupCode = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region payrollTypeID : ID
|
|
|
|
private ID _payrollTypeID;
|
|
public ID PayrollTypeID
|
|
{
|
|
get { return _payrollTypeID; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<ID>("payrollTypeID", _payrollTypeID, value);
|
|
_payrollTypeID = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EMPLOYEETYPE : EnumJVEmpType
|
|
|
|
private EnumJVEmpType _EmpType;
|
|
public EnumJVEmpType EMPLOYEETYPE
|
|
{
|
|
get { return _EmpType; }
|
|
set
|
|
{
|
|
_EmpType = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Property JVSetupDetails : ObjectsTemplate<JVSetupDetail>
|
|
|
|
private ObjectsTemplate<JVSetupDetail> _jvSetupDetails;
|
|
public ObjectsTemplate<JVSetupDetail> JVSetupDetails
|
|
{
|
|
get
|
|
{
|
|
if (_jvSetupDetails == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
|
|
{
|
|
_jvSetupDetails = JVSetupDetail.GetByJVSetup(this.ID);
|
|
}
|
|
if (_jvSetupDetails == null)
|
|
{
|
|
_jvSetupDetails = new ObjectsTemplate<JVSetupDetail>();
|
|
}
|
|
return _jvSetupDetails;
|
|
}
|
|
set
|
|
{
|
|
_jvSetupDetails = value;
|
|
}
|
|
}
|
|
|
|
#endregion Property JVSetupDetails : ObjectsTemplate<JVSetupDetail>
|
|
|
|
#region JVSetupCC : ObjectsTemplate<JVSetupCC>
|
|
private ObjectsTemplate<JVSetupCC> _jvSetupCCs;
|
|
public ObjectsTemplate<JVSetupCC> JVSetupCC
|
|
{
|
|
get
|
|
{
|
|
if (_jvSetupCCs == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
|
|
{
|
|
_jvSetupCCs = Payroll.BO.JVSetupCC.GetByJVSetup(this.ID);
|
|
}
|
|
//if (_jvSetupDetails == null)
|
|
//{
|
|
// _jvSetupCCs = new ObjectsTemplate<JVSetupCC>();
|
|
//}
|
|
return _jvSetupCCs;
|
|
}
|
|
set
|
|
{
|
|
_jvSetupCCs = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region Functions
|
|
|
|
public double GetAmount(SalaryMonthly salary, ObjectsTemplate<JVSetupDetail> jvsetupdetails)
|
|
{
|
|
double nAmount = 0;
|
|
foreach (JVSetupDetail oItem in jvsetupdetails)
|
|
{
|
|
switch (oItem.JVItemType)
|
|
{
|
|
case enumPayrollComponentType.Ordinary_Hour:
|
|
nAmount = nAmount + salary.GetGrossAmount(EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary);
|
|
break;
|
|
case enumPayrollComponentType.Allowance:
|
|
nAmount = nAmount + salary.GetGrossAmount(EnumSalaryItemCode.Allowance, oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.Deduction:
|
|
nAmount = nAmount + salary.GetDeductAmount(EnumSalaryItemCode.Deduction, oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.Over_Time:
|
|
nAmount = nAmount + salary.GetGrossAmount(EnumSalaryItemCode.Over_Time_Amount, oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.Bonus:
|
|
nAmount = nAmount + salary.GetGrossAmount(EnumSalaryItemCode.Bonus, oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.Loan:
|
|
nAmount = nAmount + salary.GetAmount(EnumSalaryGroup.Deductions, EnumSalaryItemCode.Loan_Monthly_Installment, oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.LoanInterest:
|
|
nAmount = nAmount + salary.GetAmount(EnumSalaryGroup.Deductions, EnumSalaryItemCode.Loan_Monthly_Interest, oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.PF:
|
|
nAmount = nAmount + salary.GetDeductAmount(EnumSalaryItemCode.PF_Contribution, (int)EnumSalaryItemCode.PF_Contribution);
|
|
break;
|
|
case enumPayrollComponentType.CPF:
|
|
nAmount = nAmount + salary.GetDeductAmount(EnumSalaryItemCode.PF_Contribution, (int)EnumSalaryItemCode.PF_Contribution) * 2;
|
|
break;
|
|
case enumPayrollComponentType.Gratuity:
|
|
//nAmount = nAmount + salary.GetAmount(EnumSalaryGroup.Deductions, EnumSalaryItemCode.OPI, oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.IncomeTax:
|
|
bool isOtherItem = ConfigurationManager.GetBoolValue("incometax", "taxissalaryotheritem", EnumConfigurationType.Logic);
|
|
if (isOtherItem == false)
|
|
nAmount = nAmount + salary.GetAmount(EnumSalaryGroup.Deductions, EnumSalaryItemCode.Inc_Tax_Deduction, (int)EnumSalaryItemCode.Inc_Tax_Deduction);
|
|
else
|
|
nAmount = nAmount + salary.GetAmount(EnumSalaryGroup.OtherItem, EnumSalaryItemCode.Inc_Tax_Deduction, (int)EnumSalaryItemCode.Inc_Tax_Deduction);
|
|
|
|
break;
|
|
case enumPayrollComponentType.Net_pay:
|
|
if (salary.BranchID != null && oItem.ItemID == salary.BranchID)
|
|
nAmount = nAmount + salary.GetAmount(EnumSalaryGroup.OtherItem, EnumSalaryItemCode.Net_Payable, (int)EnumSalaryItemCode.Net_Payable);
|
|
break;
|
|
//case enumPayrollComponentType.OPI:
|
|
// nAmount = nAmount + salary.GetAmount(EnumSalaryGroup.OtherItem, EnumSalaryItemCode.OPI, oItem.ItemID.Integer);
|
|
// break;
|
|
case enumPayrollComponentType.Final_settlement:
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
return nAmount;
|
|
}
|
|
|
|
|
|
public double GetAmount(FSTran ofsTran, ObjectsTemplate<JVSetupDetail> jvsetupdetails)
|
|
{
|
|
|
|
double nAmount = 0;
|
|
foreach (JVSetupDetail oItem in jvsetupdetails)
|
|
{
|
|
switch (oItem.JVItemType)
|
|
{
|
|
case enumPayrollComponentType.Ordinary_Hour:
|
|
nAmount = nAmount + ofsTran.GetAmount(EnumFSItemCode.FractionateSalary, (int)EnumSalaryItemCode.Basic_Salary);
|
|
nAmount = nAmount + ofsTran.GetAmount(EnumFSItemCode.Gross, (int)EnumSalaryItemCode.Basic_Salary);
|
|
break;
|
|
case enumPayrollComponentType.Allowance:
|
|
nAmount = nAmount + ofsTran.GetAmount(EnumFSItemCode.FractionateSalary, oItem.ItemID.Integer);
|
|
nAmount = nAmount + ofsTran.GetAmount(EnumFSItemCode.Gross, oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.Deduction:
|
|
nAmount = nAmount + ofsTran.GetAmount(EnumFSItemCode.FractionateSalary, oItem.ItemID.Integer);
|
|
nAmount = nAmount + ofsTran.GetAmount(EnumFSItemCode.Gross, oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.Over_Time:
|
|
nAmount = nAmount + ofsTran.GetAmount(EnumFSItemCode.OT, oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.Bonus:
|
|
nAmount = nAmount + ofsTran.GetAmount(EnumFSItemCode.Bonus, oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.Loan:
|
|
nAmount = nAmount + ofsTran.GetAmount(EnumFSItemCode.Loan, oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.PF:
|
|
nAmount = nAmount + ofsTran.GetAmount(EnumFSItemCode.PF, (int)EnumFSItemCode.PF);
|
|
break;
|
|
case enumPayrollComponentType.CPF:
|
|
nAmount = nAmount + ofsTran.GetAmount(EnumFSItemCode.CPF, (int)EnumFSItemCode.CPF);
|
|
break;
|
|
case enumPayrollComponentType.Gratuity:
|
|
nAmount = nAmount + ofsTran.GetAmount(EnumFSItemCode.Gratuity, (int)EnumFSItemCode.Gratuity);
|
|
break;
|
|
case enumPayrollComponentType.IncomeTax:
|
|
nAmount = nAmount + ofsTran.TaxAmount;
|
|
break;
|
|
//case enumPayrollComponentType.Net_pay:
|
|
// if (salary.BranchID != null && oItem.ItemID == salary.BranchID)
|
|
// nAmount = nAmount + salary.GetAmount(EnumSalaryGroup.OtherItem, EnumSalaryItemCode.Net_Payable, (int)EnumSalaryItemCode.Net_Payable);
|
|
// break;
|
|
case enumPayrollComponentType.Final_settlement:
|
|
case enumPayrollComponentType.OPI:
|
|
nAmount = nAmount + ofsTran.GetAmount(EnumFSItemCode.Other, oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.Earn_Leave:
|
|
nAmount = nAmount + ofsTran.GetAmount(EnumFSItemCode.Leave, (int)EnumFSItemCode.Leave);
|
|
break;
|
|
//case enumPayrollComponentType.Final_settlement:
|
|
// break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
return nAmount;
|
|
}
|
|
public double GetAmount(SalaryMonthly salary)
|
|
{
|
|
double nAmount = 0;
|
|
foreach (JVSetupDetail oItem in this.JVSetupDetails)
|
|
{
|
|
switch (oItem.JVItemType)
|
|
{
|
|
case enumPayrollComponentType.Ordinary_Hour:
|
|
nAmount = nAmount + salary.GetGrossAmount(EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary);
|
|
break;
|
|
case enumPayrollComponentType.Allowance:
|
|
nAmount = nAmount + salary.GetAmount(EnumSalaryGroup.Gross,EnumSalaryItemCode.Allowance,oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.Deduction:
|
|
nAmount = nAmount + salary.GetDeductAmount(EnumSalaryItemCode.Deduction, oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.Over_Time:
|
|
nAmount = nAmount + salary.GetAmount(EnumSalaryGroup.Gross,EnumSalaryItemCode.Over_Time_Amount, oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.Bonus:
|
|
nAmount = nAmount + salary.GetGrossAmount(EnumSalaryItemCode.Bonus, oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.Loan:
|
|
nAmount = nAmount + salary.GetAmount(EnumSalaryGroup.Deductions, EnumSalaryItemCode.Loan_Monthly_Installment, oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.LoanInterest:
|
|
nAmount = nAmount + salary.GetAmount(EnumSalaryGroup.Deductions, EnumSalaryItemCode.Loan_Monthly_Interest, oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.PF:
|
|
nAmount = nAmount + salary.GetAmount(EnumSalaryGroup.Deductions, EnumSalaryItemCode.PF_Contribution, (int)EnumSalaryItemCode.PF_Contribution);
|
|
break;
|
|
case enumPayrollComponentType.Gratuity:
|
|
//nAmount = nAmount + salary.GetAmount(EnumSalaryGroup.Deductions, EnumSalaryItemCode., oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.IncomeTax:
|
|
nAmount = nAmount + salary.GetAmount(EnumSalaryGroup.Deductions, EnumSalaryItemCode.Inc_Tax_Deduction, (int)EnumSalaryItemCode.Inc_Tax_Deduction);
|
|
break;
|
|
case enumPayrollComponentType.Net_pay:
|
|
if (salary.BranchID !=null && oItem.ItemID == salary.BranchID)
|
|
nAmount = nAmount + salary.GetAmount(EnumSalaryGroup.OtherItem, EnumSalaryItemCode.Net_Payable, (int) EnumSalaryItemCode.Net_Payable);
|
|
break;
|
|
case enumPayrollComponentType.Net_pay_Cash:
|
|
if (salary.AccountNo=="")
|
|
nAmount = nAmount + salary.GetAmount(EnumSalaryGroup.OtherItem, EnumSalaryItemCode.Net_Payable, (int)EnumSalaryItemCode.Net_Payable);
|
|
break;
|
|
case enumPayrollComponentType.OPI:
|
|
nAmount = nAmount + salary.GetAmount(EnumSalaryGroup.OtherItem, EnumSalaryItemCode.OPI, oItem.ItemID.Integer);
|
|
break;
|
|
case enumPayrollComponentType.Final_settlement:
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
return nAmount;
|
|
}
|
|
|
|
public JVSetup Get(ID nJVSetupID)
|
|
{
|
|
JVSetup oJVSetup = null;
|
|
#region Cache Header
|
|
oJVSetup = (JVSetup)_cache["Get", nJVSetupID];
|
|
if (oJVSetup != null)
|
|
return oJVSetup;
|
|
#endregion
|
|
oJVSetup = JVSetup.Service.Get(nJVSetupID);
|
|
#region Cache Footer
|
|
_cache.Add(oJVSetup, "Get", nJVSetupID);
|
|
#endregion
|
|
return oJVSetup;
|
|
}
|
|
public static ObjectsTemplate<JVSetup> Get()
|
|
{
|
|
#region Cache Header
|
|
ObjectsTemplate<JVSetup> jvsetups = _cache["Get"] as ObjectsTemplate<JVSetup>;
|
|
if (jvsetups != null)
|
|
return jvsetups;
|
|
#endregion
|
|
try
|
|
{
|
|
jvsetups = Service.Get();
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
#region Cache Footer
|
|
_cache.Add(jvsetups, "Get");
|
|
#endregion
|
|
return jvsetups;
|
|
}
|
|
|
|
public static ObjectsTemplate<JVSetup> GetByJVType(ID jvSetupID)
|
|
{
|
|
#region Cache Header
|
|
ObjectsTemplate<JVSetup> jvsetups = _cache["GetByJVType", jvSetupID] as ObjectsTemplate<JVSetup>;
|
|
if (jvsetups != null)
|
|
return jvsetups;
|
|
#endregion
|
|
try
|
|
{
|
|
jvsetups = Service.GetByJVType(jvSetupID);
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
#region Cache Footer
|
|
_cache.Add(jvsetups, "GetByJVType", jvSetupID);
|
|
#endregion
|
|
return jvsetups;
|
|
}
|
|
public static ObjectsTemplate<JVSetup> GetByJVTypeAndEffectDate(ID jvSetupID, DateTime dEffectDate)
|
|
{
|
|
#region Cache Header
|
|
ObjectsTemplate<JVSetup> jvsetups = _cache["GetByJVTypeAndEffectDate", jvSetupID, dEffectDate] as ObjectsTemplate<JVSetup>;
|
|
if (jvsetups != null)
|
|
return jvsetups;
|
|
#endregion
|
|
try
|
|
{
|
|
jvsetups = Service.GetByJVTypeAndEffectDate(jvSetupID, dEffectDate);
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
#region Cache Footer
|
|
_cache.Add(jvsetups, "GetByJVTypeAndEffectDate", jvSetupID, dEffectDate);
|
|
#endregion
|
|
return jvsetups;
|
|
}
|
|
public static ObjectsTemplate<JVSetup> GetByMonthDate(DateTime dtMonthDate)
|
|
{
|
|
#region Cache Header
|
|
ObjectsTemplate<JVSetup> jvsetups = _cache["GetByMonthDate", dtMonthDate] as ObjectsTemplate<JVSetup>;
|
|
if (jvsetups != null)
|
|
return jvsetups;
|
|
#endregion
|
|
try
|
|
{
|
|
jvsetups = Service.GetByMonthDate(dtMonthDate);
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
#region Cache Footer
|
|
_cache.Add(jvsetups, "GetByMonthDate", dtMonthDate);
|
|
#endregion
|
|
return jvsetups;
|
|
}
|
|
public static ObjectsTemplate<JVSetupDetail> GetChildByParentID(ID JVSetupID)
|
|
{
|
|
#region Cache Header
|
|
ObjectsTemplate<JVSetupDetail> jvsetupdetails = _cache["GetChildByParentID", JVSetupID] as ObjectsTemplate<JVSetupDetail>;
|
|
if (jvsetupdetails != null)
|
|
return jvsetupdetails;
|
|
#endregion
|
|
try
|
|
{
|
|
jvsetupdetails = Service.GetChildByParentID(JVSetupID);
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
#region Cache Footer
|
|
_cache.Add(jvsetupdetails, "GetChildByParentID", JVSetupID);
|
|
#endregion
|
|
return jvsetupdetails;
|
|
}
|
|
public static ObjectsTemplate<JVSetup> GetByJVTypeAndMonth(ID jvTypeID, DateTime dDate)
|
|
{
|
|
#region Cache Header
|
|
ObjectsTemplate<JVSetup> jvsetups = _cache["GetByJVTypeAndMonth", jvTypeID, dDate] as ObjectsTemplate<JVSetup>;
|
|
if (jvsetups != null)
|
|
return jvsetups;
|
|
#endregion
|
|
try
|
|
{
|
|
jvsetups = Service.GetByJVTypeAndMonth(jvTypeID, dDate);
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
#region Cache Footer
|
|
_cache.Add(jvsetups, "GetByJVTypeAndMonth", jvTypeID, dDate);
|
|
#endregion
|
|
return jvsetups;
|
|
}
|
|
public int GetSequenceNo()
|
|
{
|
|
int nSeq = 0;
|
|
nSeq = JVSetup.Service.GetSequenceNo();
|
|
return nSeq;
|
|
}
|
|
public DateTime GetMaxDate(DateTime dGivenDate)
|
|
{
|
|
DateTime dMaxDate = DateTime.Now;
|
|
dMaxDate = JVSetup.Service.GetMaxDate(dGivenDate);
|
|
return dMaxDate;
|
|
}
|
|
public ID Save()
|
|
{
|
|
this.SetAuditTrailProperties();
|
|
return JVSetup.Service.Save(this);
|
|
}
|
|
public void UpdateSequence(ObjectsTemplate<JVSetup> jvSetups)
|
|
{
|
|
JVSetup.Service.UpdateSequence(jvSetups);
|
|
}
|
|
public void Delete()
|
|
{
|
|
JVSetup.Service.Delete(this.ID);
|
|
}
|
|
#endregion
|
|
|
|
#region Service Factory
|
|
internal static IJVSetupService Service
|
|
{
|
|
get
|
|
{
|
|
return Services.Factory.CreateService<IJVSetupService>(typeof(IJVSetupService));
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
#endregion
|
|
|
|
#region IJVSetup Service
|
|
public interface IJVSetupService
|
|
{
|
|
JVSetup Get(ID id);
|
|
ObjectsTemplate<JVSetup> Get();
|
|
ObjectsTemplate<JVSetup> GetByJVType(ID jvSetupID);
|
|
ObjectsTemplate<JVSetup> GetByJVTypeAndEffectDate(ID jvSetupID, DateTime dEffectDate);
|
|
int GetSequenceNo();
|
|
DateTime GetMaxDate(DateTime dGivenDate);
|
|
ObjectsTemplate<JVSetup> GetByMonthDate(DateTime dtMonthDate);
|
|
ObjectsTemplate<JVSetupDetail> GetChildByParentID(ID JVSetupID);
|
|
ObjectsTemplate<JVSetup> GetByJVTypeAndMonth(ID jvTypeID, DateTime lastDate);
|
|
ID Save(JVSetup oJVSetup);
|
|
void UpdateSequence(ObjectsTemplate<JVSetup> oJVSetups);
|
|
void Delete(ID id);
|
|
}
|
|
#endregion
|
|
}
|