EchoTex_Payroll/HRM.BO/Claim/ClaimPaymentNew.cs
2024-10-14 10:01:49 +06:00

309 lines
11 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HRM.BO;
namespace Payroll.BO
{
[Serializable]
public class ClaimPaymentNew : BasicBaseObject, IworkflowInterface
{
private EnumFinancialApproveType _type;
private DateTime _month;
#region Constructor
public ClaimPaymentNew()
{
PaymentIssueDate = DateTime.MinValue;
Name = string.Empty;
Remarks = string.Empty;
Amount = 0;
WFStatus = enumwfStatus.Not_yet_Initiated;
}
#endregion
#region Properties
public DateTime PaymentIssueDate { get; set;}
public string Name { get; set; }
public double Amount { get; set; }
public enumwfStatus WFStatus { get; set; }
public string Remarks { get; set; }
public EnumFinancialApproveType Type { get; set; }
public DateTime Month { get; set;}
public int ItemID { get; set; }
public List<ClaimPaymentDetail> ClaimPaymentDetails { get; set; }
#endregion
#region Functions
//private ObjectsTemplate<ClaimPaymentDetail> _ClaimPaymentDetails;
//public ObjectsTemplate<ClaimPaymentDetail> ClaimPaymentDetails
//{
// get
// {
// if (this.ID != null && _ClaimPaymentDetails == null)
// {
// _ClaimPaymentDetails = ClaimPaymentNew.Service.GetClaimPaymentDetails(this.ID);
// }
// return _ClaimPaymentDetails;
// }
// set
// {
// _ClaimPaymentDetails = value;
// }
//}
//public static void InsertChild(Ease.CoreV35.DataAccess.TransactionContext tc, ClaimPaymentDetail item)
//{
// tc.ExecuteNonQuery("INSERT INTO ClaimPaymentDetail(ClaimPaymentDetailID, ClaimID, ClaimPaymentNewID)" +
// " VALUES(%n, %n, %n)", item.ID.Integer, Convert.ToInt32(item.ClaimID.ToString()), item.ClaimPaymentID.Integer);
//}
//public static ObjectsTemplate<ClaimPaymentNew> Get()
//{
// #region Cache Header
// ObjectsTemplate<ClaimPaymentNew> oClaimPaymentNews = _cache["Get"] as ObjectsTemplate<ClaimPaymentNew>;
// if (oClaimPaymentNews != null)
// return oClaimPaymentNews;
// #endregion
// try
// {
// oClaimPaymentNews = Service.Get();
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(oClaimPaymentNews, "Get");
// #endregion
// return oClaimPaymentNews;
//}
//public static ClaimPaymentNew Get(ID nID)
//{
// ClaimPaymentNew oClaimPaymentNew = null;
// #region Cache Header
// oClaimPaymentNew = (ClaimPaymentNew)_cache["Get", nID];
// if (oClaimPaymentNew != null)
// return oClaimPaymentNew;
// #endregion
// oClaimPaymentNew = ClaimPaymentNew.Service.Get(nID);
// #region Cache Footer
// _cache.Add(oClaimPaymentNew, "Get", nID);
// #endregion
// return oClaimPaymentNew;
//}
//public static ObjectsTemplate<ClaimPaymentNew> Get(EnumStatus status)
//{
// #region Cache Header
// ObjectsTemplate<ClaimPaymentNew> oClaimPaymentNews = _cache["Get", status] as ObjectsTemplate<ClaimPaymentNew>;
// if (oClaimPaymentNews != null)
// return oClaimPaymentNews;
// #endregion
// try
// {
// oClaimPaymentNews = Service.Get(status, SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(oClaimPaymentNews, "Get", status);
// #endregion
// return oClaimPaymentNews;
//}
//public void Save(ObjectsTemplate<ClaimPaymentNew> oClaimPaymentNews)
//{
// oClaimPaymentNews.ForEach(o => o.SetAuditTrailProperties());
// ClaimPaymentNew.Service.Save(oClaimPaymentNews);
//}
//public ID Save()
//{
// this.SetAuditTrailProperties();
// return ClaimPaymentNew.Service.Save(this);
//}
//public void Delete(ID id)
//{
// ClaimPaymentNew.Service.Delete(ID);
//}
#endregion
//#region Service Factory IClaimPaymentService : IClaimPaymentService
//internal static IClaimPaymentNewService Service
//{
// get { return Services.Factory.CreateService<IClaimPaymentNewService>(typeof(IClaimPaymentNewService)); }
//}
//#endregion
#region IworkflowInterface Members
/// <summary>
/// this property is used for work flow, which return leave description
/// </summary>
public string ObjectDescription
{
get
{
string str = "";
str = this.Name + " " + "- Claim JV of the month " + Convert.ToDateTime(this.PaymentIssueDate).ToString("dd MMMM yyyy") + " has been initiated";//" for " + PayrollType.Get(SystemInformation.CurrentSysInfo.PayrollTypeID).Name;
return str;
}
}
/// <summary>
/// this property is used for work flow, it's a constant value
/// </summary>
public int SetupID
{
get
{
int payrollTypeId = 0;// SystemInformation.CurrentSysInfo.PayrollTypeID.Integer;
if (payrollTypeId == 1)
return 16;
else
return 16;
}
}
/// <summary>
/// this property is used for work flow, which return leave entry id
/// </summary>
public int ObjectID
{
get { return this.ID; }
}
//public List<PendingJobDetail> GetDetails()
//{
// // DataTable dt = Service.GetPendingJobDetail(this.ID);
// List<PendingJobDetail> opJobsDetail = new List<PendingJobDetail>();
// //if (dt.Rows.Count > 0)
// //{
// // opJobsDetail.Add(new PendingJobDetail() { Type = "Applier:", Value = dt.Rows[0]["Applier"].ToString() });
// // opJobsDetail.Add(new PendingJobDetail() { Type = "Leave Type:", Value = dt.Rows[0]["Leave"].ToString() });
// // opJobsDetail.Add(new PendingJobDetail() { Type = "From Date:", Value = dt.Rows[0]["FromDate"].ToString() });
// // opJobsDetail.Add(new PendingJobDetail() { Type = "To Date:", Value = dt.Rows[0]["ToDate"].ToString() });
// // opJobsDetail.Add(new PendingJobDetail() { Type = "Total Days:", Value = dt.Rows[0]["TotalDays"].ToString() });
// // opJobsDetail.Add(new PendingJobDetail() { Type = "Remarks:", Value = dt.Rows[0]["Remarks"].ToString() });
// //}
// return opJobsDetail;
//}
//public string WFDesciption()
//{
// string sDescription;
// sDescription = this.ObjectDescription;
// //sDescription = " " + this.Employee.Name + ", " + this.Employee.Designation.Name
// // + " has applied for " + this.Leave.Description + " From " + this.AppliedFromDate.ToString("dd MMM yyyy")
// // + " To " + this.AppliedToDate.ToString("dd MMM yyyy")
// // + " Total " + this.ApprovedTotalDays.ToString()
// // + " Reason " + this.Remarks;
// return sDescription;
//}
//public int GetStatusbyWf(enumwfStatus wfstatus)
//{
// EnumLeaveStatus lvstatus;
// switch (wfstatus)
// {
// case enumwfStatus.Exception:
// case enumwfStatus.Received:
// case enumwfStatus.Passed:
// case enumwfStatus.Revert:
// lvstatus = EnumLeaveStatus.OnApproval;
// break;
// case enumwfStatus.Decline:
// lvstatus = EnumLeaveStatus.Declined;
// break;
// case enumwfStatus.Approve:
// lvstatus = EnumLeaveStatus.Approved;
// break;
// case enumwfStatus.End:
// lvstatus = EnumLeaveStatus.Approved;
// break;
// default:
// lvstatus = EnumLeaveStatus.OnApproval;
// break;
// }
// return (int)lvstatus;
//}
#endregion
//public static ClaimPaymentNew GetByClaimIDs(string _claimIds)
//{
// ClaimPaymentNew oClaimPaymentNew = null;
// #region Cache Header
// oClaimPaymentNew = (ClaimPaymentNew)_cache["Get", _claimIds];
// if (oClaimPaymentNew != null)
// return oClaimPaymentNew;
// #endregion
// oClaimPaymentNew = ClaimPaymentNew.Service.GetByClaimIDs(_claimIds);
// #region Cache Footer
// _cache.Add(oClaimPaymentNew, "Get", _claimIds);
// #endregion
// return oClaimPaymentNew;
//}
//public static ObjectsTemplate<ClaimPaymentNew> Get(DateTime fromDate, DateTime todate)
//{
// #region Cache Header
// ObjectsTemplate<ClaimPaymentNew> oClaimPaymentNews = _cache["Get", fromDate, todate] as ObjectsTemplate<ClaimPaymentNew>;
// if (oClaimPaymentNews != null)
// return oClaimPaymentNews;
// #endregion
// try
// {
// oClaimPaymentNews = Service.Get(fromDate, todate, SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(oClaimPaymentNews, "Get", fromDate, todate);
// #endregion
// return oClaimPaymentNews;
//}
}
#region ClaimPaymentNewService
public interface IClaimPaymentNewService
{
void Save(List<ClaimPaymentNew> oClaimPayments);
ClaimPaymentNew Get(int id);
List<ClaimPaymentNew> Get(EnumStatus status, int iD);
int Save(ClaimPaymentNew item);
void Delete(int id);
List<ClaimPaymentDetail> GetClaimPaymentDetails(int iD);
List<ClaimPaymentNew> Get();
ClaimPaymentNew GetByClaimIDs(string _claimIds);
List<ClaimPaymentNew> Get(DateTime fromDate, DateTime todate, int payrollTypeID);
}
#endregion
}