EchoTex_Payroll/HRM.DA/DA/Common/MiscellaneousDA.cs

184 lines
6.7 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00
using HRM.BO;
using Ease.Core.DataAccess;
using HRM.BO;
using System;
using System.Data;
using System.Data.SqlClient;
namespace HRM.DA
{
#region MiscellaneousDA
internal class MiscellaneousDA
{
#region Constructor
private MiscellaneousDA()
{
}
#endregion
#region Get Function
internal static DataSet GetEmpExpenseAmount(TransactionContext tc, string sQuary)
{
DataSet oEmpExpenseAmount = new DataSet();
try
{
oEmpExpenseAmount = tc.ExecuteDataSet(sQuary);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return oEmpExpenseAmount;
}
internal static DataSet GetADEmpLoseData(TransactionContext tc, string sQuary)
{
DataSet oADEmpLoseData = new DataSet();
try
{
oADEmpLoseData = tc.ExecuteDataSet(sQuary);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return oADEmpLoseData;
}
internal static DataSet GetReckittTaxCard(TransactionContext tc, int EmpID, EnumIncomeTaxDataFrom ITData,
int TaxParamID)
{
DataSet oRootDT = new DataSet();
DataSet oTaxCardData = new DataSet();
try
{
if (EnumIncomeTaxDataFrom.ProcessTempData == ITData)
{
oTaxCardData =
tc.ExecuteDataSet(
"select * from INCOMETAXTEMP where EMPLOYEEID=%n and SIDE In(6) order by POSITION,SIDE",
EmpID);
oTaxCardData.Tables[0].TableName = "GrossItem";
oRootDT.Tables.Add(oTaxCardData.Tables[0].Copy());
oTaxCardData =
tc.ExecuteDataSet(
"select * from INCOMETAXTEMP where EMPLOYEEID=%n and SIDE In(8) order by POSITION,SIDE",
EmpID);
oTaxCardData.Tables[0].TableName = "PF";
oRootDT.Tables.Add(oTaxCardData.Tables[0].Copy());
oTaxCardData =
tc.ExecuteDataSet(
"select * from INCOMETAXTEMP where EMPLOYEEID=%n and SIDE In(10) AND ITEMCODE=-216 order by POSITION,SIDE",
EmpID);
oTaxCardData.Tables[0].TableName = "TS";
oRootDT.Tables.Add(oTaxCardData.Tables[0].Copy());
oTaxCardData =
tc.ExecuteDataSet(
"select * from INCOMETAXTEMP where EMPLOYEEID=%n and SIDE In(10) AND ITEMCODE=-212 order by POSITION,SIDE",
EmpID);
oTaxCardData.Tables[0].TableName = "TD";
oRootDT.Tables.Add(oTaxCardData.Tables[0].Copy());
}
else
{
oTaxCardData =
tc.ExecuteDataSet(
"select * from INCOMETAXYEARLY where EMPLOYEEID=%n and SIDE In(6) and TAXPARAMID=%n order by POSITION,SIDE",
EmpID, TaxParamID);
oTaxCardData.Tables[0].TableName = "GrossItem";
oRootDT.Tables.Add(oTaxCardData.Tables[0].Copy());
oTaxCardData =
tc.ExecuteDataSet(
"select * from INCOMETAXYEARLY where EMPLOYEEID=%n and SIDE In(8) and TAXPARAMID=%n order by POSITION,SIDE",
EmpID, TaxParamID);
oTaxCardData.Tables[0].TableName = "PF";
oRootDT.Tables.Add(oTaxCardData.Tables[0].Copy());
oTaxCardData =
tc.ExecuteDataSet(
"select * from INCOMETAXYEARLY where EMPLOYEEID=%n and SIDE In(10) and TAXPARAMID=%n AND ITEMCODE=-216 order by POSITION,SIDE",
EmpID, TaxParamID);
oTaxCardData.Tables[0].TableName = "TS";
oRootDT.Tables.Add(oTaxCardData.Tables[0].Copy());
oTaxCardData =
tc.ExecuteDataSet(
"select * from INCOMETAXYEARLY where EMPLOYEEID=%n and SIDE In(10) and TAXPARAMID=%n AND ITEMCODE=-212 order by POSITION,SIDE",
EmpID, TaxParamID);
oTaxCardData.Tables[0].TableName = "TD";
oRootDT.Tables.Add(oTaxCardData.Tables[0].Copy());
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return oRootDT;
}
//internal static bool ImportMonthlyExpenseData(TransactionContext tc, string nMonth, string nYear)
//{
// SqlParameter[] param = new SqlParameter[2];
// try
// {
// param[0] = new SqlParameter();
// param[0].ParameterName = "month";
// param[0].SqlDbType = SqlDbType.VarChar;
// param[0].Direction = ParameterDirection.Input;
// param[0].Value = nMonth;
// param[1] = new SqlParameter();
// param[1].ParameterName = "year";
// param[1].SqlDbType = SqlDbType.VarChar;
// param[1].Direction = ParameterDirection.Input;
// param[1].Value = nYear;
// tc.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Upload_MonthlyEmployeeExpense", param);
// return true;
// }
// catch(Exception exp)
// {
// return false;
// }
//}
internal static void updateLocation(TransactionContext tc, int emloyeeID, int locationid)
{
tc.ExecuteNonQuery("Update employee set locationID=%n where employeeid=%n", locationid, emloyeeID);
tc.ExecuteNonQuery("Update EMPLOYEEPOSTING set locationID=%n where employeeid=%n", locationid, emloyeeID);
}
internal static void Delete(TransactionContext tc, string sQuary)
{
tc.ExecuteNonQuery(sQuary);
}
#endregion
internal static DataSet GetWrongSalary(TransactionContext tc, string Ssql)
{
DataSet EmpWrongData = new DataSet();
EmpWrongData = tc.ExecuteDataSet(Ssql);
return EmpWrongData;
}
internal static void UpdateBasicSalary(TransactionContext tc, string Ssql)
{
tc.ExecuteNonQuery(Ssql);
}
}
#endregion
}