EchoTex_Payroll/HRM.DA/Service/Fund/MemberInfo/MembersTransactionDetailsService.cs

2340 lines
98 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00
using System;
using System.Data;
using Ease.Core.Model;
using Ease.Core.DataAccess;
using Ease.Core;
using System.Collections.Generic;
using Ease.Core.Utility;
using HRM.BO;
using HRM.DA;
namespace HRM.DA.Fund
{
[Serializable]
public class MembersTransactionDetailsService : ServiceTemplate, IMembersTransactionDetailsService
{
#region Private Function And Declaration
public MembersTransactionDetailsService()
{
}
private void MapObject(MembersTransactionDetails oMembersTransactionDetails, DataReader dr)
{
this.SetObjectID(oMembersTransactionDetails, dr.GetInt32("TranID").Value);
oMembersTransactionDetails.ProjectID = dr.GetInt32("ProjectID").Value;
oMembersTransactionDetails.ActivityID = dr.GetInt32("ActivityID", 0);
oMembersTransactionDetails.TranTypeID = dr.GetInt32("TranTypeID").Value;
oMembersTransactionDetails.MemberID = dr.GetInt32("MemberID").Value;
oMembersTransactionDetails.TranDate = dr.GetDateTime("TranDate").Value;
oMembersTransactionDetails.Amount = dr.GetDouble("Amount").Value;
oMembersTransactionDetails.Effect = (EnumTranEffect)dr.GetInt16("Effect").Value;
oMembersTransactionDetails.VoucherNo = dr.GetString("VoucherNo");
oMembersTransactionDetails.FundTypeID = dr.GetInt32("FundTypeID").Value;
oMembersTransactionDetails.CreatedBy = dr.GetInt32("CreatedBy").Value;
oMembersTransactionDetails.CreatedDate = dr.GetDateTime("CreatedDate").Value;
oMembersTransactionDetails.ModifiedBy = dr.GetInt32("ModifiedBy", 0);
oMembersTransactionDetails.ModifiedDate = dr.GetDateTime("ModifiedDate");
this.SetObjectState(oMembersTransactionDetails, ObjectState.Saved);
}
protected override T CreateObject<T>(DataReader dr)
{
MembersTransactionDetails item = new MembersTransactionDetails();
MapObject(item, dr);
return item as T;
}
private MembersTransactionDetails CreateObject(DataReader dr)
{
MembersTransactionDetails oMembersTransactionDetails = new MembersTransactionDetails();
MapObject(oMembersTransactionDetails, dr);
return oMembersTransactionDetails;
}
private List<MembersTransactionDetails> CreateObjects(IDataReader dr)
{
List<MembersTransactionDetails> oMembersTransactionDetailss = new List<MembersTransactionDetails>();
DataReader oreader = new DataReader(dr);
while (dr.Read())
{
MembersTransactionDetails Item = CreateObject(oreader);
oMembersTransactionDetailss.Add(Item);
}
return oMembersTransactionDetailss;
}
#endregion
#region IFASService Members
//public void SaveUserRecords(TransactionContext tc, List<HelperForSubsidiaryUpload> subsidiarysUpload)
//{
// //UserRecordService userRecordService = new UserRecordService();
// //foreach (HelperForSubsidiaryUpload subUpload in subsidiarysUpload)
// //{
// // if (subUpload.UserRcds.Count > 0)
// // {
// // foreach (UserRecord userRecord in subUpload.UserRcds)
// // {
// // _uploadedUserRecordID = userRecordService.Insert(tc, userRecord);
// // }
// // }
// //}
//}
//public void SaveVoucher(TransactionContext tc, EaseFAS.BO.GLTrans glTrans, int systemTranIDinInt)
//{
// EaseFAS.Service.GLTranService glTranService = new EaseFAS.Service.GLTranService();
// if (glTrans != null)
// {
// //if ((int)EnumLoanActivity.LoanIssue == systemTranIDinInt)
// //{
// // //if (glTrans.Count == 1)
// // //{
// // foreach (EaseFAS.BO.GLTran glTran in glTrans)
// // {
// // foreach (EaseFAS.BO.GLTranDetail glTranDetail in glTran.GlTranDetails)
// // {
// // //if (glTranDetail.Transide == EaseFAS.Global.EnumTranSide.Debit)
// // //{
// // foreach (EaseFAS.BO.GLTranUserRecord glTUR in glTranDetail.GlTranUserRecords)
// // {
// // if (glTUR.UserRecord1ID.IsUnassigned)
// // glTUR.UserRecord1ID = _uploadedUserRecordID;
// // break;
// // }
// // //}
// // }
// // }
// // //}
// //}
// Ease.Core.DataAccess.TransactionContext coretc = Ease.Core.DataAccess.TransactionContext.SetConnection(tc.Connection, tc.Transaction);
// glTranService.Insert(coretc, glTrans);
// }
//}
#endregion
public MembersTransactionDetails Get(int id)
{
MembersTransactionDetails oMembersTransactionDetails = new MembersTransactionDetails();
#region Cache Header
oMembersTransactionDetails = new MembersTransactionDetails();
if (oMembersTransactionDetails != null)
return oMembersTransactionDetails;
#endregion
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
IDataReader oreader = MembersTransactionDetailsDA.Get(tc, id);
DataReader dr = new DataReader(oreader);
if (oreader.Read())
{
oMembersTransactionDetails = CreateObject<MembersTransactionDetails>(dr);
}
oreader.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException("Failed to Get MembersTransactionDetails", e);
#endregion
}
#region Cache Footer
#endregion
return oMembersTransactionDetails;
}
public List<MembersTransactionDetails> GetbyFundType(int fundtypeid)
{
List<MembersTransactionDetails> MembersTransactionDetailss = new List<MembersTransactionDetails>();
#region Cache Header
if (MembersTransactionDetailss != null)
return MembersTransactionDetailss;
#endregion
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
IDataReader dr = MembersTransactionDetailsDA.Get(tc, fundtypeid);
MembersTransactionDetailss = CreateObjects(dr);
dr.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException("Failed to Get MembersTransactionDetails ", e);
#endregion
}
#region Cache Footer
#endregion
return MembersTransactionDetailss;
}
public List<MembersTransactionDetails> Get(EnumMemberTranType type)
{
List<MembersTransactionDetails> MembersTransactionDetailss = new List<MembersTransactionDetails>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
IDataReader dr = MembersTransactionDetailsDA.Get(tc, (int)type);
MembersTransactionDetailss = CreateObjects(dr);
dr.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException("Failed to Get MembersTransactionDetails ", e);
#endregion
}
return MembersTransactionDetailss;
}
public List<MembersTransactionDetails> GetMemberContribution(int memberID, DateTime beforeConOfDate,
int fundtypeid)
{
List<MembersTransactionDetails> MembersTransactionDetailss = new List<MembersTransactionDetails>();
#region Cache Header
if (MembersTransactionDetailss != null)
return MembersTransactionDetailss;
#endregion
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
IDataReader dr =
MembersTransactionDetailsDA.GetMemberContribution(tc, memberID, beforeConOfDate, fundtypeid);
MembersTransactionDetailss = CreateObjects(dr);
dr.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException("Failed to Get MembersTransactionDetails ", e);
#endregion
}
#region Cache Footer
#endregion
return MembersTransactionDetailss;
}
public List<MembersTransactionDetails> GetMemberContribution(int memberID, string searchCondition,
int fundtypeid)
{
List<MembersTransactionDetails> MembersTransactionDetailss = new List<MembersTransactionDetails>();
#region Cache Header
if (MembersTransactionDetailss != null)
return MembersTransactionDetailss;
#endregion
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
IDataReader dr =
MembersTransactionDetailsDA.GetMemberContribution(tc, memberID, searchCondition, fundtypeid);
MembersTransactionDetailss = CreateObjects(dr);
dr.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException("Failed to Get MembersTransactionDetails ", e);
#endregion
}
#region Cache Footer
#endregion
return MembersTransactionDetailss;
}
public List<MembersTransactionDetails> GetSettledInterest(DateTime Trandate, string tranType, int memberID)
{
List<MembersTransactionDetails> MembersTransactionDetailss = new List<MembersTransactionDetails>();
#region Cache Header
if (MembersTransactionDetailss != null)
return MembersTransactionDetailss;
#endregion
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
IDataReader dr = MembersTransactionDetailsDA.GetSettledInterest(tc, Trandate, tranType, memberID);
MembersTransactionDetailss = CreateObjects(dr);
dr.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException("Failed to Get MembersTransactionDetails ", e);
#endregion
}
#region Cache Footer
#endregion
return MembersTransactionDetailss;
}
public void Delete(int id)
{
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
MembersTransactionDetailsDA.Delete(tc, id);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException("Failed to Delete MembersTransactionDetails", e);
#endregion
}
}
public void DeleteYearEndInterestTran(TransactionContext tc, DateTime yearEndDate)
{
try
{
MembersTransactionDetailsDA.DeleteYearEndInterestTran(tc, yearEndDate);
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException("Failed to Delete Year End Voucher", e);
#endregion
}
}
public void Save(List<MembersTransactionDetails> memberTrans, DateTime date)
{
DateTime month = Global.DateFunctions.LastDateOfMonth(date).Date;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
foreach (MembersTransactionDetails item in memberTrans)
{
//if (item.TranTypeID == (7) || item.TranTypeID == (8))
if (item.TranTypeID == ((int)EnumMemberTranType.Monthly_Actual_Company_Provident_Fund_Interest) ||
item.TranTypeID == ((int)EnumMemberTranType.Monthly_Actual_Employee_Provident_Fund_Interest))
{
//if (IsExistMonth(tc, month, item.FundTypeID, item.TranTypeID))
//{
// tc.End();
// throw new Exception("Member Transaction already saved for this month");
//}
if (item.IsNew)
{
DateTime prevMonth = Global.DateFunctions.DateAdd("m", -1, item.TranDate).Date;
prevMonth = Global.DateFunctions.LastDateOfMonth(prevMonth).Date;
int id = tc.GenerateID("MembersTransactionDetails", "TranID");
base.SetObjectID(item, (id));
MembersTransactionDetailsDA.Insert(tc, item);
//ConfigHelper.UploadTranType(tc, Convert.ToString(item.TranTypeID), User.CurrentUser.ProjectID, item.ID, item.Amount);
}
}
}
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
}
//public void Insert( TransactionContext tc ,List<MembersTransactionDetails> memberTrans)
//{
// try
// {
// ConfigHelper epfConfigHelper = new ConfigHelper();
// epfConfigHelper = ConfigHelper.GetConfig(Convert.ToString(1));
// ConfigHelper cpfConfigHelper = new ConfigHelper();
// cpfConfigHelper = ConfigHelper.GetConfig(Convert.ToString(2));
// foreach (MembersTransactionDetails item in memberTrans)
// {
// int id = tc.GenerateID("MembersTransactionDetails", "TranID");
// base.SetObjectID(item, (id));
// MembersTransactionDetailsDA.Insert(tc, item);
// //this.InsertMonthlyBalance(tc, item.TranDate, item.FundTypeID, item.Member, Convert.ToDouble(item.Amount),
// //item.TranDate);
// ConfigHelper.UploadTranType(tc, ((item.FundTypeID ==1)? Convert.ToString(cpfConfigHelper.TranTypeID):
// Convert.ToString(cpfConfigHelper.TranTypeID)), User.CurrentUser.ProjectID, item.Member.ID , item.Amount);
// }
// }
// catch (Exception e)
// {
// #region Handle Exception
// if (tc != null)
// tc.HandleError();
// ExceptionLog.Write(e);
// throw new ServiceException(e.Message, e);
// #endregion
// }
//}
//public void Insert(TransactionContext tc, List<MembersTransactionDetails> memberTrans, DateTime date)
//{
// DateTime month = Global.DateFunctions.PayrollLastDateOfMonth(date).Date;
// try
// {
// foreach (MembersTransactionDetails item in memberTrans)
// {
// //if (item.TranTypeID == (7) || item.TranTypeID == (8))
// if (item.TranTypeID == ((int)EnumMemberTranType.Monthly_Actual_CPF_Interest) || item.TranTypeID == ((int)EnumMemberTranType.Monthly_Actual_EPF_Interest))
// {
// if (IsExistMonth(tc, month, item.FundTypeID, item.TranTypeID))
// {
// tc.End();
// throw new Exception("Member Transaction already saved for this month");
// }
// if (item.IsNew)
// {
// DateTime prevMonth = Global.DateFunctions.DateAdd("m", -1, item.TranDate).Date;
// prevMonth = Global.DateFunctions.PayrollLastDateOfMonth(prevMonth).Date;
// int id = tc.GenerateID("MembersTransactionDetails", "TranID");
// base.SetObjectID(item, (id));
// MembersTransactionDetailsDA.Insert(tc, item);
// ConfigHelper.UploadTranType(tc, Convert.ToString(item.TranTypeID), User.CurrentUser.ProjectID, item.MemberID, item.Amount);
// }
// }
// }
// }
// catch (Exception e)
// {
// #region Handle Exception
// if (tc != null)
// tc.HandleError();
// ExceptionLog.Write(e);
// throw new ServiceException(e.Message, e);
// #endregion
// }
//}
public int Save(MembersTransactionDetails MembersTransactionDetails)
{
MembersTransactionDetails oMembersTransactionDetails = new MembersTransactionDetails();
oMembersTransactionDetails = MembersTransactionDetails;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
if (oMembersTransactionDetails.IsNew)
{
int id = tc.GenerateID("MembersTransactionDetails", "TranID");
base.SetObjectID(oMembersTransactionDetails, (id));
MembersTransactionDetailsDA.Insert(tc, oMembersTransactionDetails);
}
else
{
MembersTransactionDetailsDA.Update(tc, oMembersTransactionDetails);
}
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return oMembersTransactionDetails.ID;
}
public int Save(TransactionContext tc, MembersTransactionDetails MembersTransactionDetails)
{
MembersTransactionDetails oMembersTransactionDetails = new MembersTransactionDetails();
oMembersTransactionDetails = MembersTransactionDetails;
try
{
if (oMembersTransactionDetails.IsNew)
{
int id = tc.GenerateID("MembersTransactionDetails", "TranID");
base.SetObjectID(oMembersTransactionDetails, (id));
MembersTransactionDetailsDA.Insert(tc, oMembersTransactionDetails);
}
else
{
MembersTransactionDetailsDA.Update(tc, oMembersTransactionDetails);
}
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return oMembersTransactionDetails.ID;
}
//public void Insert(DataTable dataTable, string type, DateTime date, MemberHandler memberHandler)
//{
// TransactionContext tc = null;
// try
// {
// tc = TransactionContext.Begin(true);
// DateTime month = Global.DateFunctions.PayrollLastDateOfMonth(date).Date;
// DateTime prevMonth = Global.DateFunctions.DateAdd("m", -1, month).Date;
// prevMonth = Global.DateFunctions.PayrollLastDateOfMonth(prevMonth).Date;
// if (type == "EPF_CPF")
// {
// MemberService memSvc = new MemberService();
// ConfigHelper epfConfigHelper = new ConfigHelper();
// epfConfigHelper = ConfigHelper.GetConfig(Convert.ToString(1));
// ConfigHelper cpfConfigHelper = new ConfigHelper();
// cpfConfigHelper = ConfigHelper.GetConfig(Convert.ToString(2));
// if (IsExistMonth(tc, month, epfConfigHelper.FundTypeID, epfConfigHelper.TranTypeID))
// {
// tc.End();
// throw new Exception("Member Transaction already saved for this month");
// }
// if (epfConfigHelper != null && cpfConfigHelper != null)
// {
// foreach (DataRow row in dataTable.Rows)
// {
// if (!row.IsNull("EmployeeNo") && !row.IsNull("Name") && !row.IsNull("Tran Date") && !row.IsNull("CPF Amount") && !row.IsNull("EPF Amount"))
// {
// //double amountEPF = Math.Round(Convert.ToDouble(row["EPF Amount"]), 0, MidpointRounding.AwayFromZero);
// //double amountCPF = Math.Round(Convert.ToDouble(row["CPF Amount"]), 0, MidpointRounding.AwayFromZero);
// double amountEPF = Convert.ToDouble(row["EPF Amount"]);
// double amountCPF = Convert.ToDouble(row["CPF Amount"]);
// Member member = memSvc.Get(tc, row["EmployeeNo"].ToString());
// this.InsertTranDetails(tc, Convert.ToDateTime(row["Tran Date"]), amountEPF, member.ID, epfConfigHelper);
// this.InsertTranDetails(tc, Convert.ToDateTime(row["Tran Date"]), amountCPF, member.ID, cpfConfigHelper);
// this.InsertMonthlyBalance(tc, Convert.ToDateTime(row["Tran Date"]), (cpfConfigHelper.FundTypeID), member, amountCPF, prevMonth);
// this.InsertMonthlyBalance(tc, Convert.ToDateTime(row["Tran Date"]), (epfConfigHelper.FundTypeID), member, amountEPF, prevMonth);
// ConfigHelper.UploadTranType(tc, Convert.ToString(cpfConfigHelper.TranTypeID), User.CurrentUser.ProjectID, member.ID, amountCPF);
// ConfigHelper.UploadTranType(tc, Convert.ToString(epfConfigHelper.TranTypeID), User.CurrentUser.ProjectID, member.ID, amountEPF);
// //this.InsertBalanceSummery(tc, cpfConfigHelper.TranTypeID, (cpfConfigHelper.FundTypeID), member, Convert.ToDouble(row["CPF"]));
// //this.InsertBalanceSummery(tc, epfConfigHelper.TranTypeID, (epfConfigHelper.FundTypeID), member, Convert.ToDouble(row["EPF"]));
// }
// }
// SaveVoucher(tc, memberHandler.ForVoucher_glTrans, 1); // '1' is used only for method param.
// }
// }
// if (type == "GF_Actuary_Monthly")
// {
// MemberService memSvc = new MemberService();
// double rate = 0;
// ESBDefinitionService defSvc = new ESBDefinitionService();
// ESBDefinition esbDef = new ESBDefinition();
// esbDef = defSvc.Get(tc, (1));
// rate = esbDef.Trading;
// ConfigHelper GFConfigHelper = new ConfigHelper();
// GFConfigHelper = ConfigHelper.GetConfig(Convert.ToString(22));
// if (IsExistMonth(tc, month, GFConfigHelper.FundTypeID, GFConfigHelper.TranTypeID))
// {
// tc.End();
// throw new Exception("Member Transaction already saved for this month");
// }
// if (GFConfigHelper != null)
// {
// foreach (DataRow row in dataTable.Rows)
// {
// Member member = memSvc.Get(tc, row["EmployeeNo"].ToString());
// double amount = 0;
// amount = Convert.ToDouble(row["EarnedBasic"]) * rate;
// this.InsertTranDetails(tc, Convert.ToDateTime(row["MonthYearDate"]), amount, member.ID, GFConfigHelper);
// this.InsertMonthlyBalance(tc, Convert.ToDateTime(row["MonthYearDate"]), (GFConfigHelper.FundTypeID), member, amount, prevMonth);
// ConfigHelper.UploadTranType(tc, Convert.ToString(GFConfigHelper.TranTypeID), User.CurrentUser.ProjectID, member.ID, amount);
// //this.InsertBalanceSummery(tc, GFConfigHelper.TranTypeID, (GFConfigHelper.FundTypeID), member, amount);
// }
// }
// }
// if (type == "GF_Actual")
// {
// MemberService memSvc = new MemberService();
// double rate = 0;
// ESBDefinitionService defSvc = new ESBDefinitionService();
// ESBDefinition esbDef = new ESBDefinition();
// esbDef = defSvc.Get(tc, (1));
// //DataRow calculatedDateRow = ds.Tables["Date"].Rows[0];
// DateTime calculatedDate = date;
// ConfigHelper GFActualConfigHelper = new ConfigHelper();
// GFActualConfigHelper = ConfigHelper.GetConfig(Convert.ToString(23));
// if (IsExistMonth(tc, month, GFActualConfigHelper.FundTypeID, GFActualConfigHelper.TranTypeID))
// {
// tc.End();
// throw new Exception("Member Transaction already saved for this month");
// }
// if (GFActualConfigHelper != null)
// {
// foreach (DataRow row in dataTable.Rows)
// {
// Member member = memSvc.Get(tc, row["EmployeeNo"].ToString());
// double amount = 0;
// amount = esbDef.CalculateActualGFAmount(esbDef, Convert.ToDateTime(row["JoiningDate"]), calculatedDate, Convert.ToDouble(row["EarnedBasic"]));
// this.InsertTranDetails(tc, Convert.ToDateTime(row["MonthYearDate"]), amount, member.ID, GFActualConfigHelper);
// this.InsertMonthlyBalance(tc, Convert.ToDateTime(row["MonthYearDate"]), (GFActualConfigHelper.FundTypeID), member, amount, prevMonth);
// ConfigHelper.UploadTranType(tc, Convert.ToString(GFActualConfigHelper.TranTypeID), User.CurrentUser.ProjectID, member.ID, amount);
// //this.InsertBalanceSummery(tc, GFActualConfigHelper.TranTypeID, (GFActualConfigHelper.FundTypeID), member, amount);
// }
// }
// }
// if (type == "Withdrawal")
// {
// MemberService memSvc = new MemberService();
// ConfigHelper epfConfigHelper = new ConfigHelper();
// epfConfigHelper = ConfigHelper.GetConfig(Convert.ToString(22));
// ConfigHelper cpfConfigHelper = new ConfigHelper();
// cpfConfigHelper = ConfigHelper.GetConfig(Convert.ToString(23));
// if (epfConfigHelper != null && cpfConfigHelper != null)
// {
// foreach (DataRow row in dataTable.Rows)
// {
// Member member = memSvc.Get(tc, row["EmployeeNo"].ToString());
// if (row["TranType"].ToString() == Convert.ToString(EnumFundType.PF_EPF))
// {
// double amountEPF = Math.Round(Convert.ToDouble(row["TranAmount"].ToString()), 0, MidpointRounding.AwayFromZero);
// this.InsertTranDetails(tc, Convert.ToDateTime(row["TranDate"].ToString()), amountEPF, member.ID, epfConfigHelper);
// this.InsertMonthlyBalance(tc, Convert.ToDateTime(row["TranDate"].ToString()), (epfConfigHelper.FundTypeID), member, amountEPF, prevMonth);
// ConfigHelper.UploadTranType(tc, Convert.ToString(epfConfigHelper.TranTypeID), User.CurrentUser.ProjectID, member.ID, amountEPF);
// }
// else if (row["TranType"].ToString() == Convert.ToString(EnumFundType.PF_CPF))
// {
// double amountCPF = Math.Round(Convert.ToDouble(row["TranAmount"].ToString()), 0, MidpointRounding.AwayFromZero);
// this.InsertTranDetails(tc, Convert.ToDateTime(row["TranDate"].ToString()), amountCPF, member.ID, cpfConfigHelper);
// this.InsertMonthlyBalance(tc, Convert.ToDateTime(row["TranDate"].ToString()), (cpfConfigHelper.FundTypeID), member, amountCPF, prevMonth);
// ConfigHelper.UploadTranType(tc, Convert.ToString(cpfConfigHelper.TranTypeID), User.CurrentUser.ProjectID, member.ID, amountCPF);
// }
// }
// SaveVoucher(tc, memberHandler.ForVoucher_glTrans, 1); // '1' is used only for method param.
// }
// }
// tc.End();
// }
// catch (Exception e)
// {
// #region Handle Exception
// if (tc != null)
// tc.HandleError();
// ExceptionLog.Write(e);
// throw new ServiceException(e.Message, e);
// #endregion
// }
//}
//public void Insert(DataSet ds, string type, DateTime date, MemberHandler memberHandler)
//{
// TransactionContext tc = null;
// try
// {
// string mMonth = "";
// string yYear = "";
// string strDateStarted = "";
// DateTime tranDate = DateTime.MinValue;
// tc = TransactionContext.Begin(true);
// DateTime month = Global.DateFunctions.PayrollLastDateOfMonth(date).Date;
// DateTime prevMonth = Global.DateFunctions.DateAdd("m", -1, month).Date;
// prevMonth = Global.DateFunctions.PayrollLastDateOfMonth(prevMonth).Date;
// if (type == "EPF_CPF")
// {
// MemberService memSvc = new MemberService();
// ConfigHelper epfConfigHelper = new ConfigHelper();
// epfConfigHelper = ConfigHelper.GetConfig(Convert.ToString(1));
// ConfigHelper cpfConfigHelper = new ConfigHelper();
// cpfConfigHelper = ConfigHelper.GetConfig(Convert.ToString(2));
// if (IsExistMonth(tc, month, epfConfigHelper.FundTypeID, epfConfigHelper.TranTypeID))
// {
// tc.End();
// throw new Exception("Member Transaction already saved for this month");
// }
// if (epfConfigHelper != null && cpfConfigHelper != null)
// {
// foreach (DataRow row in ds.Tables["MembersTransactions"].Rows)
// {
// #region New Code
// double amountEPF = Convert.ToDouble(row["EPF Amount"]);
// double amountCPF = Convert.ToDouble(row["CPF Amount"]);
// Member member = memSvc.Get(tc, row["EmployeeNo"].ToString());
// if (member != null)
// {
// yYear = row["Year"].ToString();
// mMonth = row["Month"].ToString();
// mMonth = DateTimeFormatInfo.CurrentInfo.GetAbbreviatedMonthName(Convert.ToInt32(mMonth));
// strDateStarted = mMonth + " " + yYear;
// tranDate = DateTime.MinValue;
// DateTime.TryParseExact(strDateStarted, new string[] { "MMM yyyy" }, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out tranDate);
// tranDate = PayrollGlobalFunctions.PayrollLastDateOfMonth(tranDate);
// this.InsertTranDetails(tc, tranDate, amountEPF, member.ID, epfConfigHelper);
// this.InsertTranDetails(tc, tranDate, amountCPF, member.ID, cpfConfigHelper);
// this.InsertMonthlyBalance(tc, tranDate, (cpfConfigHelper.FundTypeID), member, amountCPF, prevMonth);
// this.InsertMonthlyBalance(tc, tranDate, (epfConfigHelper.FundTypeID), member, amountEPF, prevMonth);
// ConfigHelper.UploadTranType(tc, Convert.ToString(cpfConfigHelper.TranTypeID), User.CurrentUser.ProjectID, member.ID, amountCPF);
// ConfigHelper.UploadTranType(tc, Convert.ToString(epfConfigHelper.TranTypeID), User.CurrentUser.ProjectID, member.ID, amountEPF);
// }
// #endregion
// #region Old Code
// // //double amountEPF = Math.Round(Convert.ToDouble(row["EPF"]), 0, MidpointRounding.AwayFromZero);
// // //double amountCPF = Math.Round(Convert.ToDouble(row["CPF"]), 0, MidpointRounding.AwayFromZero);
// //double amountEPF = Convert.ToDouble(row["EPF"]);
// //double amountCPF = Convert.ToDouble(row["CPF"]);
// //Member member = memSvc.Get(tc, row["EmployeeNo"].ToString());
// //if(member != null)
// //{
// // this.InsertTranDetails(tc, Convert.ToDateTime(row["TranDate"]), amountEPF, member.ID, epfConfigHelper);
// // this.InsertTranDetails(tc, Convert.ToDateTime(row["TranDate"]), amountCPF, member.ID, cpfConfigHelper);
// // this.InsertMonthlyBalance(tc, Convert.ToDateTime(row["TranDate"]), (cpfConfigHelper.FundTypeID), member, amountCPF, prevMonth);
// // this.InsertMonthlyBalance(tc, Convert.ToDateTime(row["TranDate"]), (epfConfigHelper.FundTypeID), member, amountEPF, prevMonth);
// // ConfigHelper.UploadTranType(tc, Convert.ToString(cpfConfigHelper.TranTypeID), User.CurrentUser.ProjectID, member.ID, amountCPF);
// // ConfigHelper.UploadTranType(tc, Convert.ToString(epfConfigHelper.TranTypeID), User.CurrentUser.ProjectID, member.ID, amountEPF);
// //}
// // //this.InsertBalanceSummery(tc, cpfConfigHelper.TranTypeID, (cpfConfigHelper.FundTypeID), member, Convert.ToDouble(row["CPF"]));
// // //this.InsertBalanceSummery(tc, epfConfigHelper.TranTypeID, (epfConfigHelper.FundTypeID), member, Convert.ToDouble(row["EPF"]));
// #endregion
// }
// SaveVoucher(tc, memberHandler.ForVoucher_glTrans, 1); // '1' is used only for method param.
// }
// }
// if (type == "LTA_EPF_CPF")
// {
// MemberService memSvc = new MemberService();
// if (IsExistMonth(tc, month, 1, 31))
// {
// tc.End();
// throw new Exception("Member LTA amount already saved for this month");
// }
// foreach (DataRow row in ds.Tables["UPLOADLTAAMOUNT"].Rows)
// {
// //double amountEPF = Math.Round(Convert.ToDouble(row["EPF"]), 0, MidpointRounding.AwayFromZero);
// //double amountCPF = Math.Round(Convert.ToDouble(row["CPF"]), 0, MidpointRounding.AwayFromZero);
// double amountEPF = Convert.ToDouble(row["LTA Amount EPF"]);
// double amountCPF = Convert.ToDouble(row["LTA Amount CPF"]);
// Member member = memSvc.Get(tc, row["Employee Code"].ToString());
// if (member != null)
// {
// MembersTransactionDetails detailTranEPF = new MembersTransactionDetails();
// detailTranEPF.TranTypeID = (31);
// detailTranEPF.TranDate = Convert.ToDateTime(row["Tran Date"]);
// detailTranEPF.Amount = amountEPF;
// detailTranEPF.Effect = EnumTranEffect.Increase;
// detailTranEPF.FundTypeID = (1);
// detailTranEPF.MemberID = member.ID;
// detailTranEPF.CreatedBy = User.CurrentUser.ID;
// detailTranEPF.CreatedDate = DateTime.Today; //DateTime.Now.Date;
// int detailIdEPF = tc.GenerateID("MembersTransactionDetails", "TranID");
// base.SetObjectID(detailTranEPF, (detailIdEPF));
// MembersTransactionDetailsDA.Insert(tc, detailTranEPF);
// MembersTransactionDetails detailTranCPF = new MembersTransactionDetails();
// detailTranCPF.TranTypeID = (32);
// detailTranCPF.TranDate = Convert.ToDateTime(row["Tran Date"]);
// detailTranCPF.Amount = amountCPF;
// detailTranCPF.Effect = EnumTranEffect.Increase;
// detailTranCPF.FundTypeID = (2);
// detailTranCPF.MemberID = member.ID;
// detailTranCPF.CreatedBy = User.CurrentUser.ID;
// detailTranCPF.CreatedDate = DateTime.Today; //DateTime.Now.Date;
// int detailIdCPF = tc.GenerateID("MembersTransactionDetails", "TranID");
// base.SetObjectID(detailTranCPF, (detailIdCPF));
// MembersTransactionDetailsDA.Insert(tc, detailTranCPF);
// this.InsertMonthlyBalance(tc, Convert.ToDateTime(row["Tran Date"]), (1), member, amountCPF, prevMonth);
// this.InsertMonthlyBalance(tc, Convert.ToDateTime(row["Tran Date"]), (2), member, amountEPF, prevMonth);
// }
// }
// SaveVoucher(tc, memberHandler.ForVoucher_glTrans, 1); // '1' is used only for method param.
// }
// if (type == "GF_Actuary_Monthly")
// {
// MemberService memSvc = new MemberService();
// double rate = 0;
// ESBDefinitionService defSvc = new ESBDefinitionService();
// ESBDefinition esbDef = new ESBDefinition();
// esbDef = defSvc.Get(tc, (1));
// rate = esbDef.Trading;
// ConfigHelper GFConfigHelper = new ConfigHelper();
// GFConfigHelper = ConfigHelper.GetConfig(Convert.ToString(22));
// if (IsExistMonth(tc, month, GFConfigHelper.FundTypeID, GFConfigHelper.TranTypeID))
// {
// tc.End();
// throw new Exception("Member Transaction already saved for this month");
// }
// if (GFConfigHelper != null)
// {
// foreach (DataRow row in ds.Tables[0].Rows)
// {
// Member member = memSvc.Get(tc, row["EmployeeNo"].ToString());
// double amount = 0;
// amount = Convert.ToDouble(row["EarnedBasic"]) * rate;
// this.InsertTranDetails(tc, Convert.ToDateTime(row["MonthYearDate"]), amount, member.ID, GFConfigHelper);
// this.InsertMonthlyBalance(tc, Convert.ToDateTime(row["MonthYearDate"]), (GFConfigHelper.FundTypeID), member, amount, prevMonth);
// ConfigHelper.UploadTranType(tc, Convert.ToString(GFConfigHelper.TranTypeID), User.CurrentUser.ProjectID, member.ID, amount);
// //this.InsertBalanceSummery(tc, GFConfigHelper.TranTypeID, (GFConfigHelper.FundTypeID), member, amount);
// }
// }
// }
// if (type == "GF_Actual")
// {
// MemberService memSvc = new MemberService();
// double rate = 0;
// ESBDefinitionService defSvc = new ESBDefinitionService();
// ESBDefinition esbDef = new ESBDefinition();
// esbDef = defSvc.Get(tc, (1));
// //DataRow calculatedDateRow = ds.Tables["Date"].Rows[0];
// DateTime calculatedDate = date;
// ConfigHelper GFActualConfigHelper = new ConfigHelper();
// GFActualConfigHelper = ConfigHelper.GetConfig(Convert.ToString(23));
// if (IsExistMonth(tc, month, GFActualConfigHelper.FundTypeID, GFActualConfigHelper.TranTypeID))
// {
// tc.End();
// throw new Exception("Member Transaction already saved for this month");
// }
// if (GFActualConfigHelper != null)
// {
// foreach (DataRow row in ds.Tables[0].Rows)
// {
// Member member = memSvc.Get(tc, row["EmployeeNo"].ToString());
// double amount = 0;
// amount = esbDef.CalculateActualGFAmount(esbDef, Convert.ToDateTime(row["JoiningDate"]), calculatedDate, Convert.ToDouble(row["EarnedBasic"]));
// this.InsertTranDetails(tc, Convert.ToDateTime(row["MonthYearDate"]), amount, member.ID, GFActualConfigHelper);
// this.InsertMonthlyBalance(tc, Convert.ToDateTime(row["MonthYearDate"]), (GFActualConfigHelper.FundTypeID), member, amount, prevMonth);
// ConfigHelper.UploadTranType(tc, Convert.ToString(GFActualConfigHelper.TranTypeID), User.CurrentUser.ProjectID, member.ID, amount);
// //this.InsertBalanceSummery(tc, GFActualConfigHelper.TranTypeID, (GFActualConfigHelper.FundTypeID), member, amount);
// }
// }
// }
// tc.End();
// }
// catch (Exception e)
// {
// #region Handle Exception
// if (tc != null)
// tc.HandleError();
// ExceptionLog.Write(e);
// throw new ServiceException(e.Message, e);
// #endregion
// }
//}
//public void SaveYearlyPFPostEntry(EaseFAS.BO.GLTrans oGLTrans)
//{
// TransactionContext tc = null;
// try
// {
// tc = TransactionContext.Begin(true);
// MemberService memSvc = new MemberService();
// ConfigHelper epfConfigHelper = new ConfigHelper();
// epfConfigHelper = ConfigHelper.GetConfig(Convert.ToString(1));
// ConfigHelper cpfConfigHelper = new ConfigHelper();
// cpfConfigHelper = ConfigHelper.GetConfig(Convert.ToString(2));
// foreach (EaseFAS.BO.GLTran otran in oGLTrans)
// {
// foreach (EaseFAS.BO.GLTranDetail oTrandetail in otran.GlTranDetails)
// {
// if (oTrandetail.GlTranUserRecords != null && oTrandetail.GlTranUserRecords.Count > 0)
// {
// foreach (EaseFAS.BO.GLTranUserRecord item in oTrandetail.GlTranUserRecords)
// {
// Member member =(Member) item.Member;
// if ((EnumProjectProcess)otran.GLTranType == EnumProjectProcess.MonthlyContributionEPF)
// {
// this.InsertTranDetails(tc, otran.VoucherDate, Convert.ToDouble(item.Amount), member.ID, epfConfigHelper);
// this.InsertMonthlyBalance(tc, otran.VoucherDate, (epfConfigHelper.FundTypeID), member, Convert.ToDouble(item.Amount),
// otran.VoucherDate);
// //ConfigHelper.UploadTranType(tc, Convert.ToString(epfConfigHelper.TranTypeID), User.CurrentUser.ProjectID, member.ID, Convert.ToDouble(item.Amount));
// }
// else
// {
// this.InsertTranDetails(tc, otran.VoucherDate, Convert.ToDouble(item.Amount), member.ID, cpfConfigHelper);
// this.InsertMonthlyBalance(tc, otran.VoucherDate, (cpfConfigHelper.FundTypeID), member, Convert.ToDouble(item.Amount),
// otran.VoucherDate);
// //ConfigHelper.UploadTranType(tc, Convert.ToString(cpfConfigHelper.TranTypeID), User.CurrentUser.ProjectID, member.ID, Convert.ToDouble(item.Amount));
// }
// }
// }
// }
// }
// SaveVoucher(tc, oGLTrans, 1); // '1' is used only for method param.
// tc.End();
// }
// catch (Exception e)
// {
// #region Handle Exception
// if (tc != null)
// tc.HandleError();
// ExceptionLog.Write(e);
// throw new ServiceException(e.Message, e);
// #endregion
// }
//}
//public void Insert(DataGridView dgvContributionInfo, string type, DateTime date, MemberHandler memberHandler)
//{
// TransactionContext tc = null;
// try
// {
// tc = TransactionContext.Begin(true);
// DateTime month = Global.DateFunctions.PayrollLastDateOfMonth(date).Date;
// DateTime prevMonth = Global.DateFunctions.DateAdd("m", -1, month).Date;
// prevMonth = Global.DateFunctions.PayrollLastDateOfMonth(prevMonth).Date;
// if (type == "EPF_CPF")
// {
// MemberService memSvc = new MemberService();
// ConfigHelper epfConfigHelper = new ConfigHelper();
// epfConfigHelper = ConfigHelper.GetConfig(Convert.ToString(1));
// ConfigHelper cpfConfigHelper = new ConfigHelper();
// cpfConfigHelper = ConfigHelper.GetConfig(Convert.ToString(2));
// //if (IsExistMonth(tc, month, epfConfigHelper.FundTypeID, epfConfigHelper.TranTypeID))
// //{
// // tc.End();
// // throw new Exception("Member Transaction already saved for this month");
// //}
// if (epfConfigHelper != null && cpfConfigHelper != null)
// {
// foreach (DataGridViewRow row in dgvContributionInfo.Rows)
// {
// Member member = memSvc.Get(tc, row.Cells["clnEmployeeCode"].Value.ToString());
// if (row.Cells["clnTranType"].Value.ToString() == Convert.ToString(EnumFundType.PF_EPF))
// {
// //double amountEPF = Math.Round(Convert.ToDouble(row.Cells["clnTranAmount"].Value), 0, MidpointRounding.AwayFromZero);
// double amountEPF = Convert.ToDouble(row.Cells["clnTranAmount"].Value);
// this.InsertTranDetails(tc, Convert.ToDateTime(row.Cells["clnTranDate"].Value), amountEPF, member.ID, epfConfigHelper);
// this.InsertMonthlyBalance(tc, Convert.ToDateTime(row.Cells["clnTranDate"].Value), (epfConfigHelper.FundTypeID), member, amountEPF, prevMonth);
// ConfigHelper.UploadTranType(tc, Convert.ToString(epfConfigHelper.TranTypeID), User.CurrentUser.ProjectID, member.ID, amountEPF);
// }
// else if (row.Cells["clnTranType"].Value.ToString() == Convert.ToString(EnumFundType.PF_CPF))
// {
// //double amountCPF = Math.Round(Convert.ToDouble(row.Cells["clnTranAmount"].Value), 0, MidpointRounding.AwayFromZero);
// double amountCPF = Convert.ToDouble(row.Cells["clnTranAmount"].Value);
// this.InsertTranDetails(tc, Convert.ToDateTime(row.Cells["clnTranDate"].Value), amountCPF, member.ID, cpfConfigHelper);
// this.InsertMonthlyBalance(tc, Convert.ToDateTime(row.Cells["clnTranDate"].Value), (cpfConfigHelper.FundTypeID), member, amountCPF, prevMonth);
// ConfigHelper.UploadTranType(tc, Convert.ToString(cpfConfigHelper.TranTypeID), User.CurrentUser.ProjectID, member.ID, amountCPF);
// }
// }
// SaveVoucher(tc, memberHandler.ForVoucher_glTrans, 1); // '1' is used only for method param.
// }
// }
// //if (type == "GF_Actuary_Monthly")
// //{
// // MemberService memSvc = new MemberService();
// // double rate = 0;
// // ESBDefinitionService defSvc = new ESBDefinitionService();
// // ESBDefinition esbDef = new ESBDefinition();
// // esbDef = defSvc.Get(tc, (1));
// // rate = esbDef.Trading;
// // ConfigHelper GFConfigHelper = new ConfigHelper();
// // GFConfigHelper = ConfigHelper.GetConfig(Convert.ToString(22));
// // if (IsExistMonth(tc, month, GFConfigHelper.FundTypeID, GFConfigHelper.TranTypeID))
// // {
// // tc.End();
// // throw new Exception("Member Transaction already saved for this month");
// // }
// // if (GFConfigHelper != null)
// // {
// // foreach (DataGridViewRow row in dgvContributionInfo.Rows)
// // {
// // Member member = memSvc.Get(tc, row["EmployeeNo"].ToString());
// // double amount = 0;
// // amount = Convert.ToDouble(row["EarnedBasic"]) * rate;
// // this.InsertTranDetails(tc, Convert.ToDateTime(row["MonthYearDate"]), amount, member.ID, GFConfigHelper);
// // this.InsertMonthlyBalance(tc, Convert.ToDateTime(row["MonthYearDate"]), (GFConfigHelper.FundTypeID), member, amount, prevMonth);
// // ConfigHelper.UploadTranType(tc, Convert.ToString(GFConfigHelper.TranTypeID), User.CurrentUser.ProjectID, member.ID, amount);
// // //this.InsertBalanceSummery(tc, GFConfigHelper.TranTypeID, (GFConfigHelper.FundTypeID), member, amount);
// // }
// // }
// //}
// //if (type == "GF_Actual")
// //{
// // MemberService memSvc = new MemberService();
// // double rate = 0;
// // ESBDefinitionService defSvc = new ESBDefinitionService();
// // ESBDefinition esbDef = new ESBDefinition();
// // esbDef = defSvc.Get(tc, (1));
// // //DataRow calculatedDateRow = ds.Tables["Date"].Rows[0];
// // DateTime calculatedDate = date;
// // ConfigHelper GFActualConfigHelper = new ConfigHelper();
// // GFActualConfigHelper = ConfigHelper.GetConfig(Convert.ToString(23));
// // if (IsExistMonth(tc, month, GFActualConfigHelper.FundTypeID, GFActualConfigHelper.TranTypeID))
// // {
// // tc.End();
// // throw new Exception("Member Transaction already saved for this month");
// // }
// // if (GFActualConfigHelper != null)
// // {
// // foreach (DataGridViewRow row in dgvContributionInfo.Rows)
// // {
// // Member member = memSvc.Get(tc, row["EmployeeNo"].ToString());
// // double amount = 0;
// // amount = esbDef.CalculateActualGFAmount(esbDef, Convert.ToDateTime(row["JoiningDate"]), calculatedDate, Convert.ToDouble(row["EarnedBasic"]));
// // this.InsertTranDetails(tc, Convert.ToDateTime(row["MonthYearDate"]), amount, member.ID, GFActualConfigHelper);
// // this.InsertMonthlyBalance(tc, Convert.ToDateTime(row["MonthYearDate"]), (GFActualConfigHelper.FundTypeID), member, amount, prevMonth);
// // ConfigHelper.UploadTranType(tc, Convert.ToString(GFActualConfigHelper.TranTypeID), User.CurrentUser.ProjectID, member.ID, amount);
// // //this.InsertBalanceSummery(tc, GFActualConfigHelper.TranTypeID, (GFActualConfigHelper.FundTypeID), member, amount);
// // }
// // }
// //}
// tc.End();
// }
// catch (Exception e)
// {
// #region Handle Exception
// if (tc != null)
// tc.HandleError();
// ExceptionLog.Write(e);
// throw new ServiceException(e.Message, e);
// #endregion
// }
//}
//#endregion
//#region Upload related function
//internal void InsertTranDetails(TransactionContext tc, DateTime tranDate, double amount, ID memberID, ConfigHelper configHelper)
//{
// MembersTransactionDetails detailTran = new MembersTransactionDetails();
// try
// {
// detailTran.TranTypeID = (configHelper.TranTypeID);
// detailTran.TranDate = tranDate;
// detailTran.Amount = amount;
// detailTran.Effect = configHelper.Effect;
// detailTran.FundTypeID = (configHelper.FundTypeID);
// detailTran.MemberID = memberID;
// detailTran.CreatedBy = User.CurrentUser.ID;
// detailTran.CreatedDate = DateTime.Today; //DateTime.Now.Date;
// int detailId = tc.GenerateID("MembersTransactionDetails", "TranID");
// base.SetObjectID(detailTran, (detailId));
// MembersTransactionDetailsDA.Insert(tc, detailTran);
// }
// catch (Exception e)
// {
// throw new Exception(e.Message);
// }
// //return amount;
//}
//internal double GetOpeningBalance(TransactionContext tc, DateTime prevMonth, ID memberID, ID fundID)
//{
// double openingBalance = 0;
// try
// {
// openingBalance = MemberBalaneMonthlyDA.GetOpeningBalance(tc, prevMonth, memberID, fundID);
// }
// catch (Exception e)
// {
// throw e;
// }
// return openingBalance;
//}
//internal void InsertMonthlyBalance(TransactionContext tc, DateTime tranDate, ID fundID, Member member, double amount, DateTime prevMonth)
//{
// try
// {
// double openingBalance = GetOpeningBalance(tc, prevMonth, member.ID, fundID);
// MemberBalaneMonthly monthlyBalance = new MemberBalaneMonthly();
// monthlyBalance.MembersID = member.ID;
// monthlyBalance.MonthDate = tranDate;
// monthlyBalance.FundTypeID = fundID;
// monthlyBalance.EmpCode = member.EmpCode;
// if (member.MembershipDate.HasValue)
// {
// monthlyBalance.MembershipDate = member.MembershipDate.Value;
// }
// monthlyBalance.MembershipNo = member.MembershipNo;
// monthlyBalance.CMOpeningContributionBalance = openingBalance;
// //monthlyBalance.CMClosingContributionBalance = amount;
// monthlyBalance.CMClosingContributionBalance = monthlyBalance.CMOpeningContributionBalance + amount;
// //monthlyBalance.CMOpeningActualBalance = monthlyBalance.CMOpeningContributionBalance + monthlyBalance.CMActualOpeningInterest;
// //monthlyBalance.CMClosingActualBalance = monthlyBalance.CMClosingContributionBalance + monthlyBalance.CMActualClosingInterest;
// //monthlyBalance.CMOpeningProvisionalBalance = monthlyBalance.CMOpeningContributionBalance + monthlyBalance.CMOpeningProvisionalInterest;
// //monthlyBalance.CMClosingProvisionalBalance = monthlyBalance.CMClosingContributionBalance + monthlyBalance.CMClosingProvisionalInterest;
// monthlyBalance.CreatedBy = User.CurrentUser.ID;
// monthlyBalance.CreatedDate = DateTime.Now.Date;
// int monthlyCPFId = tc.GenerateID("MemberBalaneMonthly", "RecordID");
// base.SetObjectID(monthlyBalance, (monthlyCPFId));
// MemberBalaneMonthlyDA.Insert(tc, monthlyBalance);
// }
// catch (Exception e)
// {
// throw new Exception(e.Message);
// }
//}
////internal void InsertBalanceSummery(TransactionContext tc,int tranTypeID, ID fundID, Member member, double amount)
////{
//// try
//// {
//// MembersBalanceSummary summery = new MembersBalanceSummary();
//// summery.MembersID = member.ID;
//// summery.FundTypeID = fundID;
//// summery.EmpCode = member.EmpCode;
//// if (member.MembershipDate.HasValue)
//// {
//// summery.MembershipDate = member.MembershipDate.Value;
//// }
//// summery.MembershipNo = member.MembershipNo;
//// summery.Contribution = summery.Contribution + amount;
//// summery.Total = summery.Total + amount;
//// summery.TotalBalance = summery.TotalBalance + amount;
//// //int summeryId = tc.GenerateID(tc, "MemberBalanceSummary", "summeryId");
//// base.SetObjectID(summery, ID.FromComplex(summery.MembersID, summery.FundTypeID));
//// if (!IsExistInSummery(tc, fundID, member.ID))
//// {
//// summery.CreatedBy = User.CurrentUser.ID;
//// summery.CreatedDate = DateTime.Now.Date;
//// MembersBalanceSummaryDA.Insert(tc, summery);
//// }
//// else
//// {
//// ConfigHelper.UploadTranType(tc, Convert.ToString(tranTypeID), User.CurrentUser.ProjectID, member.ID, amount);
//// //this.UpdateMemberBalance(tc, member.ID, fundID, amount);
//// }
//// }
//// catch (Exception e)
//// {
//// throw e;
//// }
////}
//internal void UpdateMemberBalance(TransactionContext tc, ID memberID, ID fundID, double amount)
//{
// try
// {
// MembersBalanceSummaryService svc = new MembersBalanceSummaryService();
// MembersBalanceSummary summery = svc.GetByID(tc, memberID, fundID);
// summery.Contribution = summery.Contribution + amount;
// summery.Total = summery.Total + amount;
// summery.TotalBalance = summery.TotalBalance + amount;
// summery.ModifiedBy = User.CurrentUser.ID;
// summery.ModifiedDate = DateTime.Now.Date;
// MembersBalanceSummaryDA.Update(tc, summery);
// }
// catch(Exception e)
// {
// throw e;
// }
//}
//internal bool IsExistInSummery(TransactionContext tc, ID fundID, ID memberID)
//{
// bool isExist = false;
// try
// {
// isExist = MembersBalanceSummaryDA.IsExistInSummery(tc, fundID, memberID);
// }
// catch (Exception e)
// {
// throw e;
// }
// return isExist;
//}
//internal bool IsExistMonth(TransactionContext tc, DateTime month, int fundID, int tranTypeID)
//{
// bool exists = false;
// try
// {
// exists = MembersTransactionDetailsDA.ISExistMonth(tc, month, fundID, tranTypeID);
// }
// catch (Exception e)
// {
// throw e;
// }
// return exists;
//}
//public bool IsExistMonth(DateTime month, int fundID, int tranTypeID)
//{
// bool exists = false;
// TransactionContext tc = null;
// try
// {
// tc = TransactionContext.Begin(true);
// exists = MembersTransactionDetailsDA.ISExistMonth(tc, month, fundID, tranTypeID);
// tc.End();
// }
// catch (Exception e)
// {
// throw e;
// }
// return exists;
//}
//public bool IsExistMemberContribution(int memberID, DateTime month, int fundID, int tranTypeID)
//{
// bool exists = false;
// TransactionContext tc = null;
// try
// {
// tc = TransactionContext.Begin(true);
// exists = MembersTransactionDetailsDA.IsExistMemberContribution(tc, memberID, month, fundID, tranTypeID);
// tc.End();
// }
// catch (Exception e)
// {
// throw e;
// }
// return exists;
//}
//public DataSet GetTransactionMembers(DateTime uploadMonth)
//{
// //DataTable dt = new DataTable();
// DataSet ds = new DataSet();
// TransactionContext tc = null;
// try
// {
// ConnectionContext cc = new ConnectionContext("serviceHandler1");
// tc = TransactionContext.Begin(true, cc);
// ds = MembersTransactionDetailsDA.GetTransactionMembers(tc, uploadMonth);
// //ds.Tables.Add(dt);
// tc.End();
// }
// catch (Exception e)
// {
// #region Handle Exception
// if (tc != null)
// tc.HandleError();
// ExceptionLog.Write(e);
// throw new ServiceException(e.Message, e);
// #endregion
// }
// return ds;
//}
//public DataSet GetTransactionIAMembers()
//{
// //DataTable dt = new DataTable();
// DataSet ds = new DataSet();
// TransactionContext tc = null;
// try
// {
// ConnectionContext cc = new ConnectionContext("serviceHandler1");
// tc = TransactionContext.Begin(true, cc);
// ds = MembersTransactionDetailsDA.GetTransactionIAMembers(tc);
// //ds.Tables.Add(dt);
// tc.End();
// }
// catch (Exception e)
// {
// #region Handle Exception
// if (tc != null)
// tc.HandleError();
// ExceptionLog.Write(e);
// throw new ServiceException(e.Message, e);
// #endregion
// }
// return ds;
//}
//public DataSet GetTransactionMembers(string queryString)
//{
// //DataTable dt = new DataTable();
// DataSet ds = new DataSet();
// TransactionContext tc = null;
// try
// {
// ConnectionContext cc = new ConnectionContext("serviceHandler1");
// tc = TransactionContext.Begin(true, cc);
// ds = MembersTransactionDetailsDA.GetTransactionMembers(tc, queryString);
// //ds.Tables.Add(dt);
// tc.End();
// }
// catch (Exception e)
// {
// #region Handle Exception
// if (tc != null)
// tc.HandleError();
// ExceptionLog.Write(e);
// throw new ServiceException(e.Message, e);
// #endregion
// }
// return ds;
//}
//#region For Opening Balance(Feb 2007)
//internal bool ISExist(TransactionContext tc, string tableName)
//{
// bool exists = false;
// try
// {
// exists = MembersTransactionDetailsDA.ISExist(tc, tableName);
// }
// catch (Exception e)
// {
// throw e;
// }
// return exists;
//}
//public void UploadOpeningTranForGF( List<MembersTransactionDetails> memberTrans, List<MemberBalaneMonthly> membersMonthlyBalances)
//{
// TransactionContext tc = null;
// try
// {
// tc = TransactionContext.Begin(true);
// foreach (MembersTransactionDetails detailTran in memberTrans)
// {
// if (detailTran.IsNew)
// {
// detailTran.CreatedBy = User.CurrentUser.ID;
// detailTran.CreatedDate = DateTime.Now.Date;
// //int id = tc.GenerateID("MembersTransactionDetails", "MembersTransactionDetailsID");
// int id = tc.GenerateID("MembersTransactionDetails", "TranID");
// base.SetObjectID(detailTran, (id));
// MembersTransactionDetailsDA.Insert(tc, detailTran);
// ConfigHelper.UploadTranType(tc, Convert.ToString(detailTran.TranTypeID), User.CurrentUser.ProjectID, detailTran.MemberID, detailTran.Amount);
// }
// }
// foreach (MemberBalaneMonthly item in membersMonthlyBalances)
// {
// item.CreatedBy = User.CurrentUser.ID;
// item.CreatedDate = DateTime.Now.Date;
// int monthlyId = tc.GenerateID("MemberBalaneMonthly", "RecordID");
// base.SetObjectID(item, (monthlyId));
// MemberBalaneMonthlyDA.Insert(tc, item);
// }
// tc.End();
// }
// catch (Exception e)
// {
// #region Handle Exception
// if (tc != null)
// tc.HandleError();
// ExceptionLog.Write(e);
// throw new ServiceException(e.Message, e);
// #endregion
// }
//}
//public void UploadOpeningTranForGF(TransactionContext tc, List<MembersTransactionDetails> memberTrans, List<MemberBalaneMonthly> membersMonthlyBalances)
//{
// try
// {
// foreach (MembersTransactionDetails detailTran in memberTrans)
// {
// if (detailTran.IsNew)
// {
// detailTran.CreatedBy = User.CurrentUser.ID;
// detailTran.CreatedDate = DateTime.Now.Date;
// int id = tc.GenerateID("MembersTransactionDetails", "TranID");
// base.SetObjectID(detailTran, (id));
// MembersTransactionDetailsDA.Insert(tc, detailTran);
// ConfigHelper.UploadTranType(tc, Convert.ToString(detailTran.TranTypeID), User.CurrentUser.ProjectID, detailTran.MemberID, detailTran.Amount);
// }
// }
// foreach (MemberBalaneMonthly item in membersMonthlyBalances)
// {
// item.CreatedBy = User.CurrentUser.ID;
// item.CreatedDate = DateTime.Now.Date;
// int monthlyId = tc.GenerateID("MemberBalaneMonthly", "RecordID");
// base.SetObjectID(item, (monthlyId));
// MemberBalaneMonthlyDA.Insert(tc, item);
// }
// }
// catch (Exception e)
// {
// #region Handle Exception
// if (tc != null)
// tc.HandleError();
// ExceptionLog.Write(e);
// throw new ServiceException(e.Message, e);
// #endregion
// }
//}
//public void UploadOpeningTran(List<MembersTransactionDetails> memberTrans, List<MemberBalaneMonthly> membersMonthlyBalances)
//{
// TransactionContext tc = null;
// try
// {
// tc = TransactionContext.Begin(true);
// if (!ISExist(tc, "MembersTransactionDetails") && !ISExist(tc, "MemberBalaneMonthly"))
// {
// foreach (MembersTransactionDetails detailTran in memberTrans)
// {
// if (detailTran.IsNew)
// {
// detailTran.CreatedBy = User.CurrentUser.ID;
// detailTran.CreatedDate = DateTime.Now.Date;
// //int id = tc.GenerateID("MembersTransactionDetails", "MembersTransactionDetailsID");
// int id = tc.GenerateID("MembersTransactionDetails", "TranID");
// base.SetObjectID(detailTran, (id));
// MembersTransactionDetailsDA.Insert(tc, detailTran);
// ConfigHelper.UploadTranType(tc, Convert.ToString(detailTran.TranTypeID), User.CurrentUser.ProjectID, detailTran.MemberID, detailTran.Amount);
// }
// }
// foreach (MemberBalaneMonthly item in membersMonthlyBalances)
// {
// item.CreatedBy = User.CurrentUser.ID;
// item.CreatedDate = DateTime.Now.Date;
// int monthlyId = tc.GenerateID("MemberBalaneMonthly", "RecordID");
// base.SetObjectID(item, (monthlyId));
// MemberBalaneMonthlyDA.Insert(tc, item);
// }
// }
// tc.End();
// }
// catch (Exception e)
// {
// #region Handle Exception
// if (tc != null)
// tc.HandleError();
// ExceptionLog.Write(e);
// throw new ServiceException(e.Message, e);
// #endregion
// }
//}
//#endregion
//#region Calculate GF accuary provission
//public DataSet GetGFProvissionMember(DateTime month)
//{
// DataSet ds = new DataSet();
// TransactionContext tc = null;
// try
// {
// ConnectionContext cc = new ConnectionContext("serviceHandler1");
// tc = TransactionContext.Begin(true, cc);
// ds = MembersTransactionDetailsDA.GetGFProvissionMember(tc, month);
// tc.End();
// }
// catch (Exception e)
// {
// #region Handle Exception
// if (tc != null)
// tc.HandleError();
// ExceptionLog.Write(e);
// throw new ServiceException(e.Message, e);
// #endregion
// }
// return ds;
//}
////public DataTable SaveGFProvission(DateTime month)
////{
//// DataTable dt = new DataTable();
//// DataSet ds = new DataSet();
//// TransactionContext tc = null;
//// double amount = 0;
//// try
//// {
//// tc = TransactionContext.Begin();
//// // system Tran Type table ID
//// ConfigHelper GFConfigHelper = ConfigHelper.GetConfig(Convert.ToString(22));
//// double rate = 0;
//// ESBDefinitionService defSvc = new ESBDefinitionService();
//// rate = defSvc.Get(tc);
//// int check = 1;
//// int index = 0;
//// if (GFConfigHelper != null)
//// {
//// foreach (DataRow row in ds.Tables[0].Rows)
//// {
//// MemberService memSvc = new MemberService();
//// Member member = memSvc.Get(tc, row["EmployeeNo"].ToString());
//// amount = this.InsertTranDetails(tc, Convert.ToDateTime(row["MonthYearDate"]), Convert.ToDouble(row["ThisMonthBasic"]), member.ID, GFConfigHelper, rate, check);
//// amount = amount + amount;
//// this.InsertMonthlyBalance(tc, Convert.ToDateTime(row["MonthYearDate"]), (GFConfigHelper.FundTypeID), member, Convert.ToDouble(row["ThisMonthBasic"]));
//// this.InsertBalanceSummery(tc, (GFConfigHelper.FundTypeID), member, Convert.ToDouble(row["ThisMonthBasic"]));
//// index++;
//// }
//// dt.Columns.Add("EmpNo");
//// dt.Columns.Add("TotalAmount");
//// dt.Rows.Add(index, amount);
//// }
//// tc.End();
//// }
//// catch (Exception e)
//// {
//// #region Handle Exception
//// if (tc != null)
//// tc.HandleError();
//// ExceptionLog.Write(e);
//// throw new ServiceException(e.Message, e);
//// #endregion
//// }
//// return dt;
////}
//#endregion
//#endregion
public bool IsExist(int projectID)
{
bool exists = false;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
exists = MembersTransactionDetailsDA.IsExist(tc, projectID);
tc.End();
}
catch (Exception e)
{
throw new ServiceException(e.Message, e);
}
return exists;
}
public DataTable GetTable(int fundtypeid)
{
DataTable dTbl = new DataTable("MembersTransactionDetails");
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
IDataReader ir = MembersTransactionDetailsDA.Get(tc, fundtypeid);
dTbl.Load(ir);
ir.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return dTbl;
}
public DataSet GetTranAmount(int EmpID, DateTime dtYearEnd)
{
DataSet oTranAmount = new DataSet();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
oTranAmount = MembersTransactionDetailsDA.GetTranAmount(tc, EmpID, dtYearEnd);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return oTranAmount;
}
public DataSet GetTranAmountForCalculate(int memberID, DateTime dtYearEnd)
{
DataSet oTranAmount = new DataSet();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
oTranAmount = MembersTransactionDetailsDA.GetTranAmountForCalculate(tc, memberID, dtYearEnd);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return oTranAmount;
}
public DataSet GetTranAmountForCalculate(int memberID, DateTime dtYearEnd, DateTime dtMonthEnd)
{
DataSet oTranAmount = new DataSet();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
oTranAmount =
MembersTransactionDetailsDA.GetTranAmountForCalculate(tc, memberID, dtYearEnd, dtMonthEnd);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return oTranAmount;
}
public DataSet GetTranAmount(string memberID, DateTime dtFirst, DateTime dtLast)
{
DataSet oTranAmount = new DataSet();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
oTranAmount = MembersTransactionDetailsDA.GetTranAmount(tc, memberID, dtFirst, dtLast);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return oTranAmount;
}
public DataSet GetOpeningBalance(string memberID, int fundType, DateTime FromDate)
{
DataSet oOpeningBalance = new DataSet();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
oOpeningBalance = MembersTransactionDetailsDA.GetOpeningBalance(tc, memberID, fundType, FromDate);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return oOpeningBalance;
}
public DataSet GetMembersYearlyBalance(DateTime FromDate, DateTime ToDate)
{
DataSet oMembersYearlyBalance = new DataSet();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
oMembersYearlyBalance = MembersTransactionDetailsDA.GetMembersYearlyBalance(tc, FromDate, ToDate);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return oMembersYearlyBalance;
}
public DataTable GetMembersAccount(string smemberId, DateTime fromMonth, DateTime toMonth,
EnumMemberDvdntDuration divDuration)
{
DataTable dTbl = new DataTable("MembersTransactionDetails");
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
IDataReader ir =
MembersTransactionDetailsDA.GetMembersAccount(tc, smemberId, fromMonth, toMonth, divDuration);
dTbl.Load(ir);
ir.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return dTbl;
}
public DataTable GetMembersAccountBeforeAfterAudit(string smemberId, DateTime Fromdate, DateTime Todate,
EnumMemberDvdntDuration divDuration)
{
DataTable dTbl = new DataTable("MembersTransactionDetails");
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
IDataReader ir =
MembersTransactionDetailsDA.GetMembersAccountBeforeAfterAudit(tc, smemberId, Fromdate, Todate,
divDuration);
dTbl.Load(ir);
ir.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return dTbl;
}
public DataTable GetMembersEPFCPF(int EmpID, DateTime dateTime)
{
DataTable dTbl = new DataTable("MembersTransactionDetails");
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
IDataReader ir = MembersTransactionDetailsDA.GetMembersEPFCPF(tc, EmpID, dateTime);
dTbl.Load(ir);
ir.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return dTbl;
}
public double GetOpeningBalance(int memberID, int fundType, DateTime FromDate)
{
double openingBalance = 0;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
openingBalance = MembersTransactionDetailsDA.GetOpeningBalance(tc, memberID, fundType, FromDate);
tc.End();
}
catch (Exception e)
{
throw new ServiceException("Failed to Check by code" + e.Message, e);
}
return openingBalance;
}
public double GetOpeningBalance(int memberID, int fundType, DateTime FromDate, string FMConn)
{
double openingBalance = 0;
try
{
openingBalance = MembersTransactionDetailsDA.GetOpeningBalance(memberID, fundType, FromDate, FMConn);
}
catch (Exception e)
{
throw new ServiceException("Failed to Check by code" + e.Message, e);
}
return openingBalance;
}
public double GetCurBalance(int memberID, DateTime balanceMonth)
{
double openingBalance = 0;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
openingBalance = MembersTransactionDetailsDA.GetCurBalance(tc, memberID, balanceMonth);
tc.End();
}
catch (Exception e)
{
throw new ServiceException("Failed to Check by code" + e.Message, e);
}
return openingBalance;
}
public double GetOpeningBalance(int memberID, DateTime balanceMonth)
{
double openingBalance = 0;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
openingBalance = MembersTransactionDetailsDA.GetOpeningBalance(tc, memberID, balanceMonth);
tc.End();
}
catch (Exception e)
{
throw new ServiceException("Failed to Check by code" + e.Message, e);
}
return openingBalance;
}
public double GetSettledInterest(int memberID)
{
double openingBalance = 0;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
openingBalance = MembersTransactionDetailsDA.GetSettledInterest(tc, memberID);
tc.End();
}
catch (Exception e)
{
throw new ServiceException("Failed to get settled Amount" + e.Message, e);
}
return openingBalance;
}
public DateTime GetMonth(int memberID)
{
DateTime dt = DateTime.MinValue;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
dt = MembersTransactionDetailsDA.GetMonth(tc, memberID);
tc.End();
}
catch (Exception e)
{
throw new ServiceException("Failed to get settled Amount" + e.Message, e);
}
return dt;
}
//internal void SaveFinalSettlement(TransactionContext tc, List<MembersTransactionDetails> memberTransactionDetails)
//{
// try
// {
// ConfigHelper epfConfigHelper = new ConfigHelper();
// epfConfigHelper = ConfigHelper.GetConfig(Convert.ToString(27));
// ConfigHelper cpfConfigHelper = new ConfigHelper();
// cpfConfigHelper = ConfigHelper.GetConfig(Convert.ToString(28));
// foreach (MembersTransactionDetails item in memberTransactionDetails)
// {
// int id = tc.GenerateID("MembersTransactionDetails", "TranID");
// base.SetObjectID(item, (id));
// item.CreatedBy = User.CurrentUser.ID;
// item.CreatedDate = DateTime.Now.Date;
// MembersTransactionDetailsDA.Insert(tc, item);
// //this.InsertMonthlyBalance(tc, item.TranDate, item.FundTypeID, item.Member, Convert.ToDouble(item.Amount),
// // item.TranDate);
// ConfigHelper.UploadTranType(tc, ((item.FundTypeID == 1) ? Convert.ToString(cpfConfigHelper.TranTypeID) :
// Convert.ToString(cpfConfigHelper.TranTypeID)), User.CurrentUser.ProjectID, item.Member.ID, item.Amount);
// }
// }
// catch (Exception e)
// {
// #region Handle Exception
// if (tc != null)
// tc.HandleError();
// ExceptionLog.Write(e);
// throw new ServiceException(e.Message, e);
// #endregion
// }
//}
//public void SaveWithdrawal(List<MembersTransactionDetails> _odetails, MemberHandler _memberHandler)
//{
// TransactionContext tc = null;
// try
// {
// tc = TransactionContext.Begin(true);
// foreach (MembersTransactionDetails item in _odetails)
// {
// if (item.IsNew)
// {
// int id = tc.GenerateID("MembersTransactionDetails", "TranID");
// base.SetObjectID(item, (id));
// item.CreatedBy = User.CurrentUser.ID;
// item.CreatedDate = DateTime.Now.Date;
// MembersTransactionDetailsDA.Insert(tc, item);
// }
// }
// SaveVoucher(tc, _memberHandler.ForVoucher_glTrans, 1);
// tc.End();
// }
// catch (Exception e)
// {
// #region Handle Exception
// if (tc != null)
// tc.HandleError();
// ExceptionLog.Write(e);
// throw new ServiceException(e.Message, e);
// #endregion
// }
//}
internal void DeleteMemberTran(TransactionContext tc, List<MembersTransactionDetails> _details)
{
try
{
foreach (MembersTransactionDetails item in _details)
{
MembersTransactionDetailsDA.DeleteMemberSettlement(tc, item.ID, item.MemberID);
}
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
}
public DataSet GetIndividualPFBalance(DateTime Fromdate, DateTime dtYearEnd, DateTime tillDate, string sEmpID)
{
DataSet oMembersIndividualPFBalance = new DataSet();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
oMembersIndividualPFBalance =
MembersTransactionDetailsDA.GetIndividualPFBalance(tc, Fromdate, dtYearEnd, tillDate, sEmpID);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return oMembersIndividualPFBalance;
}
public DataTable GetFunds(int memberID)
{
DataSet ds = new DataSet();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
if (memberID != null && memberID > 0)
{
ds = MembersTransactionDetailsDA.GetFunds(tc, memberID);
}
tc.End();
}
catch (Exception e)
{
throw new ServiceException("Failed to Get Funds" + e.Message, e);
}
return ds.Tables[0];
}
public DataSet GetMemberContributionByMemberId(int memberID, string Date)
{
DataSet oMembersIndividualPFBalance = new DataSet();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
oMembersIndividualPFBalance = MembersTransactionDetailsDA.GetMemberContribution2(tc, memberID, Date);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return oMembersIndividualPFBalance;
}
public DataSet GetTransactionMembers(DateTime uploadMonth)
{
throw new NotImplementedException();
}
public DataSet GetTransactionIAMembers()
{
throw new NotImplementedException();
}
public DataSet GetTransactionMembers(string queryString)
{
throw new NotImplementedException();
}
public List<MembersTransactionDetails> Get()
{
throw new NotImplementedException();
}
public List<MembersTransactionDetails> GetMemberContribution(int memberID, DateTime beforeConOfDate)
{
throw new NotImplementedException();
}
public List<MembersTransactionDetails> GetMemberContribution(int memberID, string searchCondition)
{
List<MembersTransactionDetails> MembersTransactionDetailss = new List<MembersTransactionDetails>();
//#region Cache Header
//if (MembersTransactionDetailss != null)
// return MembersTransactionDetailss;
//#endregion
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
IDataReader dr =
MembersTransactionDetailsDA.GetMemberContribution(tc, memberID, searchCondition);
MembersTransactionDetailss = CreateObjects(dr);
dr.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException("Failed to Get MembersTransactionDetails ", e);
#endregion
}
#region Cache Footer
#endregion
return MembersTransactionDetailss;
}
public List<MembersTransactionDetails> GetMemberContribution(int memberID, string searchCondition, string FMConn)
{
List<MembersTransactionDetails> MembersTransactionDetailss = new List<MembersTransactionDetails>();
try
{
IDataReader dr = MembersTransactionDetailsDA.GetMemberContribution(memberID, searchCondition, FMConn);
MembersTransactionDetailss = CreateObjects(dr);
dr.Close();
}
catch (Exception e)
{
#region Handle Exception
ExceptionLog.Write(e);
throw new ServiceException("Failed to Get MembersTransactionDetails ", e);
#endregion
}
#region Cache Footer
#endregion
return MembersTransactionDetailss;
}
public DataTable GetTable()
{
throw new NotImplementedException();
}
public DataSet GetGFProvissionMember(DateTime month)
{
throw new NotImplementedException();
}
public void UploadOpeningTran(List<MembersTransactionDetails> memberTrans, List<MemberBalaneMonthly> membersMonthlyBalances)
{
throw new NotImplementedException();
}
public void UploadOpeningTranForGF(List<MembersTransactionDetails> memberTrans, List<MemberBalaneMonthly> membersMonthlyBalances)
{
throw new NotImplementedException();
}
public bool IsExistMonth(DateTime month, int fundID, int tranTypeID)
{
throw new NotImplementedException();
}
public bool IsExistMemberContribution(int memberID, DateTime month, int fundID, int tranTypeID)
{
throw new NotImplementedException();
}
}
}