CEL_Payroll/Payroll.BO/SAPLookUp/SAPDataProcess.cs

456 lines
12 KiB
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
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 SAPDataProcess
[Serializable]
public class SAPDataProcess : AuditTrailBase
{
#region Cache Store
private static Cache _cache = new Cache(typeof(SAPDataProcess));
#endregion
#region Constructor
public SAPDataProcess()
{
_ProcessDate = DateTime.MinValue;
_ProcessStatus = EnumSAPProcessStatus.None;
_ProcessTime = string.Empty;
_ProcessBy = null;
_MailCompleted = EnumSendMail.None;
_CutOffday = 0;
_SourceFileName = string.Empty;
}
#endregion
#region Properties
#region ProcessDate : DateTime
private DateTime _ProcessDate;
public DateTime ProcessDate
{
get { return _ProcessDate; }
set
{
base.OnPropertyChange<DateTime>("ProcessDate", _ProcessDate, value);
_ProcessDate = value;
}
}
#endregion
#region ProcessStatus : EnumSAPProcessStatus
private EnumSAPProcessStatus _ProcessStatus;
public EnumSAPProcessStatus ProcessStatus
{
get { return _ProcessStatus; }
set
{
base.OnPropertyChange<short>("ProcessStatus",(short) _ProcessStatus,(short) value);
_ProcessStatus = value;
}
}
#endregion
#region ProcessTime : String
private string _ProcessTime;
public string ProcessTime
{
get { return _ProcessTime; }
set
{
base.OnPropertyChange<string>("ProcessTime", _ProcessTime, value);
_ProcessTime = value;
}
}
#endregion
#region ProcessBy : ID
private ID _ProcessBy;
public ID ProcessBy
{
get { return _ProcessBy; }
set
{
base.OnPropertyChange<ID>("ProcessBy", _ProcessBy, value);
_ProcessBy = value;
}
}
#endregion
#region CutOffday : Int
private int _CutOffday;
public int CutOffday
{
get { return _CutOffday; }
set
{
base.OnPropertyChange<int>("CuffOffday", _CutOffday, value);
_CutOffday = value;
}
}
#endregion
#region MailCompleted : bool
private EnumSendMail _MailCompleted;
public EnumSendMail MailCompleted
{
get { return _MailCompleted; }
set
{
base.OnPropertyChange<short>("MailCompleted", (short)_MailCompleted, (short)value);
_MailCompleted = value;
}
}
#endregion
#region SourceFileName : String
private string _SourceFileName;
public string SourceFileName
{
get { return _SourceFileName; }
set
{
base.OnPropertyChange<string>("SourceFileName", _SourceFileName, value);
_SourceFileName = value;
}
}
#endregion
#region SAPDataProcess Detail : SAPDataProcess Detail
private ObjectsTemplate<SAPDataProcessDetail> _details;
public ObjectsTemplate<SAPDataProcessDetail> Details
{
get
{
if (_details == null) _details = new ObjectsTemplate<SAPDataProcessDetail>();
return _details;
}
set
{
_details = value;
}
}
#endregion
#region SAPDataDumps : ObjectsTemplate<SAPDataDump>
private ObjectsTemplate<SAPDataDump> _SAPDataDumps;
public ObjectsTemplate<SAPDataDump> SAPDataDumps
{
get
{
if (_SAPDataDumps == null) _SAPDataDumps = new ObjectsTemplate<SAPDataDump>();
return _SAPDataDumps;
}
set
{
_SAPDataDumps = value;
}
}
#endregion
#region Employees : SAPEmployees
private ObjectsTemplate<Employee> _SAPEmployees;
public ObjectsTemplate<Employee> SAPEmployees
{
get
{
if (_SAPEmployees == null) _SAPEmployees = new ObjectsTemplate<Employee>();
return _SAPEmployees;
}
set
{
_SAPEmployees = value;
}
}
#endregion
#region EmpLifeCycle : SAPEmpLifeCycles
private ObjectsTemplate<EmpLifeCycle> _SAPEmpLifeCycles;
public ObjectsTemplate<EmpLifeCycle> SAPEmpLifeCycles
{
get
{
if (_SAPEmpLifeCycles == null) _SAPEmpLifeCycles = new ObjectsTemplate<EmpLifeCycle>();
return _SAPEmpLifeCycles;
}
set
{
_SAPEmpLifeCycles = value;
}
}
#endregion
#region EmpBankAccounts : EmployeeBankAccount
private ObjectsTemplate<EmployeeBankAccount> _EmpBankAccounts;
public ObjectsTemplate<EmployeeBankAccount> EmpBankAccounts
{
get
{
if (_EmpBankAccounts == null) _EmpBankAccounts = new ObjectsTemplate<EmployeeBankAccount>();
return _EmpBankAccounts;
}
set
{
_EmpBankAccounts = value;
}
}
#endregion
#region ErrorList : SAPDataProcessDetail
private ObjectsTemplate<SAPDataProcessDetail> _ErrorList;
public ObjectsTemplate<SAPDataProcessDetail> ErrorList
{
get
{
if (_ErrorList == null) _ErrorList = new ObjectsTemplate<SAPDataProcessDetail>();
return _ErrorList;
}
set
{
_ErrorList = value;
}
}
#endregion
#region SuccessList : SAPDataProcessDetail
private ObjectsTemplate<SAPDataProcessDetail> _SuccessList;
public ObjectsTemplate<SAPDataProcessDetail> SuccessList
{
get
{
if (_SuccessList == null) _SuccessList = new ObjectsTemplate<SAPDataProcessDetail>();
return _SuccessList;
}
set
{
_SuccessList = value;
}
}
#endregion
#region Service Factory ISAPDataProcessService : ISAPDataProcessService
internal static ISAPDataProcessService Service
{
get { return Services.Factory.CreateService<ISAPDataProcessService>(typeof(ISAPDataProcessService)); }
}
#endregion
#endregion
#region Functions
public static SAPDataProcess Get(ID nID)
{
SAPDataProcess oSAPDataProcess = null;
#region Cache Header
oSAPDataProcess = (SAPDataProcess)_cache["Get", nID];
if (oSAPDataProcess != null)
return oSAPDataProcess;
#endregion
oSAPDataProcess = SAPDataProcess.Service.Get(nID);
#region Cache Footer
_cache.Add(oSAPDataProcess, "Get", nID);
#endregion
return oSAPDataProcess;
}
public static SAPDataProcess Get(DateTime dSAPDate)
{
SAPDataProcess oSAPDataProcess = null;
#region Cache Header
oSAPDataProcess = (SAPDataProcess)_cache["Get", dSAPDate];
if (oSAPDataProcess != null)
return oSAPDataProcess;
#endregion
oSAPDataProcess = SAPDataProcess.Service.Get(dSAPDate);
#region Cache Footer
_cache.Add(oSAPDataProcess, "Get", dSAPDate);
#endregion
return oSAPDataProcess;
}
public static SAPDataProcessDetail GetSAPDetails(ID nID)
{
SAPDataProcessDetail oSAPDataProcessDetail = null;
#region Cache Header
oSAPDataProcessDetail = (SAPDataProcessDetail)_cache["Get", nID];
if (oSAPDataProcessDetail != null)
return oSAPDataProcessDetail;
#endregion
oSAPDataProcessDetail = SAPDataProcess.Service.GetSAPDetails(nID);
#region Cache Footer
_cache.Add(oSAPDataProcessDetail, "Get", nID);
#endregion
return oSAPDataProcessDetail;
}
public static ObjectsTemplate<SAPDataProcess> Get()
{
#region Cache Header
ObjectsTemplate<SAPDataProcess> SAPDataProcesss = _cache["Get"] as ObjectsTemplate<SAPDataProcess>;
if (SAPDataProcesss != null)
return SAPDataProcesss;
#endregion
try
{
SAPDataProcesss = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(SAPDataProcesss, "Get");
#endregion
return SAPDataProcesss;
}
public ID Save()
{
base.SetAuditTrailProperties();
return SAPDataProcess.Service.Save(this);
}
public void Delete(ID id)
{
SAPDataProcess.Service.Delete(id);
}
public void Process(bool IsSystemInfoNeeded)
{
try
{
SAPDataProcess.Service.Process(IsSystemInfoNeeded);
}
catch (Exception ex)
{
throw new ServiceException(ex.Message);
}
}
public void EffectPrevious(bool IsSystemInfoNeeded)
{
try
{
SAPDataProcess.Service.EffectPrevious(IsSystemInfoNeeded);
}
catch (Exception ex)
{
throw new ServiceException(ex.Message);
}
}
public static bool IsFileSuccessfullyRead(string filename)
{
bool bIsFileRead = false;
bIsFileRead = SAPDataProcess.Service.GetFileReadStatus(filename);
return bIsFileRead;
}
#endregion
public DataTable GetSapDataProcessDetail(ID ID)
{
DataSet ds = null;
try
{
ds = Service.GetSapDataProcessDetail(ID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds.Tables[0];
}
public DataTable GetSapProcessDifferentErrors()
{
DataSet ds = null;
try
{
ds = Service.GetSapProcessDifferentErrors();
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds.Tables[0];
}
}
#endregion
#region ISAPDataProcess Service
public interface ISAPDataProcessService
{
SAPDataProcess Get(ID id);
SAPDataProcess Get(DateTime dSAPDate);
SAPDataProcessDetail GetSAPDetails(ID id);
ObjectsTemplate<SAPDataProcess> Get();
ID Save(SAPDataProcess item);
DataSet GetSapDataProcessDetail(ID ID);
void Delete(ID id);
void Process(bool IsSystemInfoNeeded);
bool GetFileReadStatus(string filename);
DataSet GetSapProcessDifferentErrors();
void EffectPrevious(bool IsSystemInfoNeeded);
}
#endregion
}