EchoTex_Payroll/HRM.DA/Service/Common/MiscellaneousService.cs

228 lines
6.4 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00
using System;
using Ease.Core.Model;
using Ease.Core.DataAccess;
using Ease.Core.Utility;
using System.Collections.Generic;
using HRM.BO;
using System.Data;
namespace HRM.DA
{
#region Miscellaneous Service
public class MiscellaneousService : ServiceTemplate
{
public MiscellaneousService()
{
}
private void MapObject(Miscellaneous oMiscellaneous, DataReader oReader)
{
//base.SetObjectID(oMiscellaneous, oReader.GetID(""));
this.SetObjectState(oMiscellaneous, Ease.Core.ObjectState.Saved);
}
protected override T CreateObject<T>(DataReader oReader)
{
Miscellaneous oMiscellaneous = new Miscellaneous();
MapObject(oMiscellaneous, oReader);
return oMiscellaneous as T;
}
protected Miscellaneous CreateObject(DataReader oReader)
{
Miscellaneous oMiscellaneous = new Miscellaneous();
MapObject(oMiscellaneous, oReader);
return oMiscellaneous;
}
#region Service implementation
public DataSet GetEmpExpenseAmount(string sQuary)
{
DataSet oEmpExpenseAmount = new DataSet();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
oEmpExpenseAmount = MiscellaneousDA.GetEmpExpenseAmount(tc, sQuary);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return oEmpExpenseAmount;
}
public DataSet GetADEmpLoseData(string sQuary)
{
DataSet oADEmpLoseData = new DataSet();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
oADEmpLoseData = MiscellaneousDA.GetADEmpLoseData(tc, sQuary);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return oADEmpLoseData;
}
public DataSet GetWrongSalary(string Ssql)
{
DataSet EmpWrongData = new DataSet();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
EmpWrongData = MiscellaneousDA.GetWrongSalary(tc, Ssql);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return EmpWrongData;
}
public DataSet GetReckittTaxCard(int EmpID, EnumIncomeTaxDataFrom ITData, int TaxParamID)
{
DataSet oTaxCardData = new DataSet();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
oTaxCardData = MiscellaneousDA.GetReckittTaxCard(tc, EmpID, ITData, TaxParamID);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return oTaxCardData;
}
//public bool ImportMonthlyExpenseData(string nMonth, string nYear, int payrolltypeid)
//{
// TransactionContext tc = null;
// try
// {
// tc = TransactionContext.Begin();
// MiscellaneousDA.ImportMonthlyExpenseData(tc, nMonth, nYear,payrolltypeid);
// tc.End();
// return true;
// }
// catch (Exception exp)
// {
// return false;
// }
//}
public int GetNextID(string tableName, string ColumnName, string whereClause)
{
TransactionContext tc = null;
int id = 0;
try
{
tc = TransactionContext.Begin(true);
if (whereClause == "")
id = tc.GenerateID(tableName, ColumnName);
else id = tc.GenerateID(tableName, ColumnName, whereClause);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return id;
}
public void Delete(string sQuary)
{
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
MiscellaneousDA.Delete(tc, sQuary);
tc.End();
}
catch (Exception exp)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(exp);
throw new ServiceException(exp.Message, exp);
#endregion
}
}
public void UpdateBasicSalary(string Ssql)
{
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
MiscellaneousDA.UpdateBasicSalary(tc, Ssql);
tc.End();
}
catch (Exception exp)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(exp);
throw new ServiceException(exp.Message, exp);
#endregion
}
}
#endregion
}
#endregion
}