CEL_Payroll/Payroll.BO/CarFuel/CarFuelPayment.cs
2024-09-17 14:30:13 +06:00

256 lines
6.8 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;
using System.Data;
namespace Payroll.BO
{
#region CarFuelPayment
[Serializable]
public class CarFuelPayment : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(CarFuelPayment));
#endregion
#region Constructor
public CarFuelPayment()
{
_CarFuelItemID = null;
_employeeID = null;
_paymentDate = DateTime.Today;
_amount = 0;
_changedAmount = 0;
_changeTaxAmount = 0;
_taxAmount = 0;
_remarks = string.Empty;
}
#endregion
#region Properties
#region CarFuelItemID : ID
private ID _CarFuelItemID;
public ID CarFuelItemID
{
get
{
return _CarFuelItemID;
}
set
{
base.OnPropertyChange<ID>("CarFuelitemid", _CarFuelItemID, value);
_CarFuelItemID = value;
}
}
#endregion
#region EmployeeID : ID
private ID _employeeID;
public ID EmployeeID
{
get
{
return _employeeID;
}
set
{
base.OnPropertyChange<ID>("employeeid", _employeeID, value);
_employeeID = value;
}
}
#endregion
#region PaymentDate : DateTime
private DateTime _paymentDate;
public DateTime PaymentDate
{
get
{
return _paymentDate;
}
set
{
base.OnPropertyChange<DateTime>("paymentdate", _paymentDate, value);
_paymentDate = value;
}
}
#endregion
#region Amount : double
private double _amount;
public double Amount
{
get
{
return _amount;
}
set
{
base.OnPropertyChange<double>("amount", _amount, value);
_amount = value;
}
}
#endregion
#region ChangedAmount : double
private double _changedAmount;
public double ChangedAmount
{
get
{
return _changedAmount;
}
set
{
base.OnPropertyChange<double>("ChangedAmount", _changedAmount, value);
_changedAmount = value;
}
}
#endregion
#region ChangedAmount : double
private double _changeTaxAmount;
public double ChangeTaxAmount
{
get
{
return _changeTaxAmount;
}
set
{
base.OnPropertyChange<double>("ChangeTaxAmount", _changeTaxAmount, value);
_changeTaxAmount = value;
}
}
#endregion
#region TaxAmount : double
private double _taxAmount;
public double TaxAmount
{
get
{
return _taxAmount;
}
set
{
base.OnPropertyChange<double>("taxamount", _taxAmount, value);
_taxAmount = 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 Service Factory ICarFuelPaymentService : ICarFuelPaymentService
internal static ICarFuelPaymentService Service
{
get
{
return Services.Factory.CreateService<ICarFuelPaymentService>(typeof(ICarFuelPaymentService));
}
}
#endregion
#endregion
#region Functions
public static CarFuelPayment Get(ID nCarFuelPaymentID)
{
CarFuelPayment oCarFuelPayment = null;
#region Cache Header
oCarFuelPayment = (CarFuelPayment)_cache["Get", nCarFuelPaymentID];
if (oCarFuelPayment != null)
return oCarFuelPayment;
#endregion
oCarFuelPayment = CarFuelPayment.Service.Get(nCarFuelPaymentID);
#region Cache Footer
_cache.Add(oCarFuelPayment, "Get", nCarFuelPaymentID);
#endregion
return oCarFuelPayment;
}
public string GetNextCode()
{
return CarFuelPayment.Service.GetNextCode();
}
public static ObjectsTemplate<CarFuelPayment> Get()
{
#region Cache Header
ObjectsTemplate<CarFuelPayment> oCarFuelPayments = _cache["Get"] as ObjectsTemplate<CarFuelPayment>;
if (oCarFuelPayments != null)
return oCarFuelPayments;
#endregion
try
{
oCarFuelPayments = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(oCarFuelPayments, "Get");
#endregion
return oCarFuelPayments;
}
public static DataSet GetDataSetOfPaymentEmployees(ID nCarFuelItemID, EnumCarFuelType nCarFuelType)
{
DataSet dsEmployees = null;
dsEmployees = CarFuelPayment.Service.GetDataSetOfPaymentEmployees(nCarFuelItemID, nCarFuelType);
return dsEmployees;
}
public ID Save()
{
this.SetAuditTrailProperties();
return CarFuelPayment.Service.Save(this);
}
public void Save(ObjectsTemplate<CarFuelPayment> CarFuelPaymets)
{
this.SetAuditTrailProperties();
CarFuelPayment.Service.Save(CarFuelPaymets);
}
public void Delete(ID id)
{
CarFuelPayment.Service.Delete(id);
}
#endregion
}
#endregion
#region ICarFuelPayment Service
public interface ICarFuelPaymentService
{
CarFuelPayment Get(ID id);
ObjectsTemplate<CarFuelPayment> Get();
DataSet GetDataSetOfPaymentEmployees(ID nCarFuelItemID, EnumCarFuelType nCarFuelType);
string GetNextCode();
ID Save(CarFuelPayment item);
void Save(ObjectsTemplate<CarFuelPayment> CarFuelPaymets);
void Delete(ID id);
}
#endregion
}