1510 lines
49 KiB
C#
1510 lines
49 KiB
C#
|
|
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 Microsoft.Data.SqlClient;
|
|||
|
|
|
|||
|
|
namespace HRM.DA
|
|||
|
|
{
|
|||
|
|
[Serializable]
|
|||
|
|
public class MembersTransactionDetailsService : ServiceTemplate, IMembersTransactionDetailsService
|
|||
|
|
{
|
|||
|
|
#region Private Function And Declaration
|
|||
|
|
|
|||
|
|
public MembersTransactionDetailsService()
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void MapObject(MembersTransactionDetail oMembersTransactionDetails, DataReader dr)
|
|||
|
|
{
|
|||
|
|
this.SetObjectID(oMembersTransactionDetails, dr.GetInt32("TranID").Value);
|
|||
|
|
oMembersTransactionDetails.FundTypeID = dr.GetInt32("FundTypeID").Value;
|
|||
|
|
oMembersTransactionDetails.ActivityID = dr.GetInt32("ActivityID", 0);
|
|||
|
|
oMembersTransactionDetails.TranTypeID =(EnumMemberTranType) 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");
|
|||
|
|
oMembersTransactionDetails.fundCategory =(EnumFundCategory) dr.GetInt32("fundCategory");
|
|||
|
|
|
|||
|
|
this.SetObjectState(oMembersTransactionDetails, ObjectState.Saved);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected override T CreateObject<T>(DataReader dr)
|
|||
|
|
{
|
|||
|
|
MembersTransactionDetail item = new MembersTransactionDetail();
|
|||
|
|
MapObject(item, dr);
|
|||
|
|
return item as T;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private MembersTransactionDetail CreateObject(DataReader dr)
|
|||
|
|
{
|
|||
|
|
MembersTransactionDetail oMembersTransactionDetails = new MembersTransactionDetail();
|
|||
|
|
MapObject(oMembersTransactionDetails, dr);
|
|||
|
|
return oMembersTransactionDetails;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private List<MembersTransactionDetail> CreateObjects(IDataReader dr)
|
|||
|
|
{
|
|||
|
|
List<MembersTransactionDetail> oMembersTransactionDetailss = new List<MembersTransactionDetail>();
|
|||
|
|
DataReader oreader = new DataReader(dr);
|
|||
|
|
while (dr.Read())
|
|||
|
|
{
|
|||
|
|
MembersTransactionDetail 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 MembersTransactionDetail Get(int id)
|
|||
|
|
{
|
|||
|
|
MembersTransactionDetail oMembersTransactionDetails = new MembersTransactionDetail();
|
|||
|
|
|
|||
|
|
#region Cache Header
|
|||
|
|
|
|||
|
|
oMembersTransactionDetails = new MembersTransactionDetail();
|
|||
|
|
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<MembersTransactionDetail>(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<MembersTransactionDetail> GetbyFundType(int fundtypeid)
|
|||
|
|
{
|
|||
|
|
List<MembersTransactionDetail> MembersTransactionDetailss = new List<MembersTransactionDetail>();
|
|||
|
|
|
|||
|
|
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin(true);
|
|||
|
|
IDataReader dr = MembersTransactionDetailsDA.GetbyFundType(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<MembersTransactionDetail> GetbyFundType(int fundtypeid,
|
|||
|
|
DateTime fromDate, DateTime toDate)
|
|||
|
|
{
|
|||
|
|
List<MembersTransactionDetail> MembersTransactionDetailss = new List<MembersTransactionDetail>();
|
|||
|
|
|
|||
|
|
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin(true);
|
|||
|
|
IDataReader dr = MembersTransactionDetailsDA.GetbyFundType(tc, fundtypeid, fromDate, toDate);
|
|||
|
|
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<MembersTransactionDetail> GetMemberContribution(int memberID, DateTime beforeConOfDate,
|
|||
|
|
int fundtypeid)
|
|||
|
|
{
|
|||
|
|
List<MembersTransactionDetail> MembersTransactionDetailss = new List<MembersTransactionDetail>();
|
|||
|
|
|
|||
|
|
#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<MembersTransactionDetail> GetMemberContribution(int memberID, string searchCondition,
|
|||
|
|
int fundtypeid)
|
|||
|
|
{
|
|||
|
|
List<MembersTransactionDetail> MembersTransactionDetailss = new List<MembersTransactionDetail>();
|
|||
|
|
|
|||
|
|
#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<MembersTransactionDetail> GetSettledInterest(DateTime Trandate, string tranType, int memberID)
|
|||
|
|
{
|
|||
|
|
List<MembersTransactionDetail> MembersTransactionDetailss = new List<MembersTransactionDetail>();
|
|||
|
|
|
|||
|
|
#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, int fundTypeID)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
MembersTransactionDetailsDA.DeleteYearEndInterestTran(tc, yearEndDate, fundTypeID);
|
|||
|
|
}
|
|||
|
|
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 SaveWithdrawal(List<MembersTransactionDetail> _odetails)
|
|||
|
|
{
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin(true);
|
|||
|
|
foreach (MembersTransactionDetail item in _odetails)
|
|||
|
|
{
|
|||
|
|
if (item.IsNew)
|
|||
|
|
{
|
|||
|
|
int id = tc.GenerateID("FM_MembersTransactionDetails", "TranID");
|
|||
|
|
base.SetObjectID(item, id);
|
|||
|
|
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
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
public int Save(MembersTransactionDetail MembersTransactionDetails)
|
|||
|
|
{
|
|||
|
|
MembersTransactionDetail oMembersTransactionDetails = new MembersTransactionDetail();
|
|||
|
|
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, MembersTransactionDetail MembersTransactionDetails)
|
|||
|
|
{
|
|||
|
|
MembersTransactionDetail oMembersTransactionDetails = new MembersTransactionDetail();
|
|||
|
|
oMembersTransactionDetails = MembersTransactionDetails;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (oMembersTransactionDetails.IsNew)
|
|||
|
|
{
|
|||
|
|
int id = tc.GenerateID("FM_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 bool IsExist(int FundTypeID)
|
|||
|
|
{
|
|||
|
|
bool exists = false;
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin(true);
|
|||
|
|
exists = MembersTransactionDetailsDA.IsExist(tc, FundTypeID);
|
|||
|
|
tc.End();
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return exists;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
public void Save(List<MembersTransactionDetail> items)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin(true);
|
|||
|
|
|
|||
|
|
this.SaveBulk(tc, items);
|
|||
|
|
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 SaveBulk(TransactionContext tc, List<MembersTransactionDetail> items)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (items.Count > 0)
|
|||
|
|
{
|
|||
|
|
int tranID = tc.GenerateID("FM_MEMBERSTRANSACTIONDETAILS", "TRANID");
|
|||
|
|
DataTable membersTransactionDetailTable = new DataTable("FM_MEMBERSTRANSACTIONDETAILS");
|
|||
|
|
membersTransactionDetailTable.Columns.Add(new DataColumn("TRANID", typeof(int)));
|
|||
|
|
membersTransactionDetailTable.Columns.Add(new DataColumn("MEMBERID", typeof(int)));
|
|||
|
|
membersTransactionDetailTable.Columns.Add(new DataColumn("TRANTYPEID", typeof(int)));
|
|||
|
|
membersTransactionDetailTable.Columns.Add(new DataColumn("TRANDATE", typeof(DateTime)));
|
|||
|
|
membersTransactionDetailTable.Columns.Add(new DataColumn("FUNDTYPEID", typeof(int)));
|
|||
|
|
membersTransactionDetailTable.Columns.Add(new DataColumn("AMOUNT", typeof(double)));
|
|||
|
|
membersTransactionDetailTable.Columns.Add(new DataColumn("EFFECT", typeof(int)));
|
|||
|
|
membersTransactionDetailTable.Columns.Add(new DataColumn("ACTIVITYID", typeof(int)));
|
|||
|
|
membersTransactionDetailTable.Columns.Add(new DataColumn("VOUCHERNO", typeof(string)));
|
|||
|
|
membersTransactionDetailTable.Columns.Add(new DataColumn("CREATEDBY", typeof(int)));
|
|||
|
|
membersTransactionDetailTable.Columns.Add(new DataColumn("CREATEDDATE", typeof(DateTime)));
|
|||
|
|
membersTransactionDetailTable.Columns.Add(new DataColumn("MODIFIEDBY", typeof(int)));
|
|||
|
|
membersTransactionDetailTable.Columns.Add(new DataColumn("MODIFIEDDATE", typeof(DateTime)));
|
|||
|
|
membersTransactionDetailTable.Columns.Add(new DataColumn("FUNDCATEGORY", typeof(int)));
|
|||
|
|
|
|||
|
|
|
|||
|
|
foreach (MembersTransactionDetail item in items)
|
|||
|
|
{
|
|||
|
|
tranID = tranID + 1;
|
|||
|
|
item.ID = tranID;
|
|||
|
|
membersTransactionDetailTable.Rows.Add(
|
|||
|
|
tranID,
|
|||
|
|
item.MemberID,
|
|||
|
|
item.TranTypeID,
|
|||
|
|
item.TranDate,
|
|||
|
|
item.FundTypeID,
|
|||
|
|
item.Amount,
|
|||
|
|
item.Effect,
|
|||
|
|
null,
|
|||
|
|
null,
|
|||
|
|
item.CreatedBy,
|
|||
|
|
item.CreatedDate,
|
|||
|
|
item.ModifiedBy,
|
|||
|
|
item.ModifiedDate,
|
|||
|
|
item.fundCategory
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
using (SqlBulkCopy bulkCopy = new SqlBulkCopy((SqlConnection)tc.Connection, SqlBulkCopyOptions.Default, (SqlTransaction)tc.Transaction))
|
|||
|
|
{
|
|||
|
|
bulkCopy.BulkCopyTimeout = 6000; // in seconds
|
|||
|
|
bulkCopy.ColumnMappings.Add("TRANID", "TRANID");
|
|||
|
|
bulkCopy.ColumnMappings.Add("MEMBERID", "MEMBERID");
|
|||
|
|
bulkCopy.ColumnMappings.Add("TRANTYPEID", "TRANTYPEID");
|
|||
|
|
bulkCopy.ColumnMappings.Add("TRANDATE", "TRANDATE");
|
|||
|
|
bulkCopy.ColumnMappings.Add("FUNDTYPEID", "FUNDTYPEID");
|
|||
|
|
bulkCopy.ColumnMappings.Add("AMOUNT", "AMOUNT");
|
|||
|
|
bulkCopy.ColumnMappings.Add("EFFECT", "EFFECT");
|
|||
|
|
bulkCopy.ColumnMappings.Add("ACTIVITYID", "ACTIVITYID");
|
|||
|
|
bulkCopy.ColumnMappings.Add("VOUCHERNO", "VOUCHERNO");
|
|||
|
|
bulkCopy.ColumnMappings.Add("CREATEDBY", "CREATEDBY");
|
|||
|
|
bulkCopy.ColumnMappings.Add("CREATEDDATE", "CREATEDDATE");
|
|||
|
|
bulkCopy.ColumnMappings.Add("MODIFIEDBY", "MODIFIEDBY");
|
|||
|
|
bulkCopy.ColumnMappings.Add("MODIFIEDDATE", "MODIFIEDDATE");
|
|||
|
|
bulkCopy.ColumnMappings.Add("FUNDCATEGORY", "FUNDCATEGORY");
|
|||
|
|
|
|||
|
|
bulkCopy.DestinationTableName = "FM_MEMBERSTRANSACTIONDETAILS";
|
|||
|
|
|
|||
|
|
bulkCopy.WriteToServer(membersTransactionDetailTable);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
ExceptionLog.Write(e);
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
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, int fundTypeID)
|
|||
|
|
{
|
|||
|
|
DataSet oTranAmount = new DataSet();
|
|||
|
|
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
oTranAmount = MembersTransactionDetailsDA.GetTranAmount(tc, EmpID, dtYearEnd, fundTypeID);
|
|||
|
|
|
|||
|
|
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 GetVoluntaryTranAmount(int EmpID, DateTime dtYearEnd, int fundTypeID)
|
|||
|
|
{
|
|||
|
|
DataSet oTranAmount = new DataSet();
|
|||
|
|
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
oTranAmount = MembersTransactionDetailsDA.GetVolantaryTranAmount(tc, EmpID, dtYearEnd, fundTypeID);
|
|||
|
|
|
|||
|
|
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, int fundTypeID)
|
|||
|
|
{
|
|||
|
|
DataSet oTranAmount = new DataSet();
|
|||
|
|
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
oTranAmount =
|
|||
|
|
MembersTransactionDetailsDA.GetTranAmountForCalculate(tc, memberID, dtYearEnd, dtMonthEnd, fundTypeID);
|
|||
|
|
|
|||
|
|
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 GetTranAmountWithVoluntary(int memberID, DateTime dtYearEnd, DateTime dtMonthEnd, int fundTypeID)
|
|||
|
|
{
|
|||
|
|
DataSet oTranAmount = new DataSet();
|
|||
|
|
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
oTranAmount =
|
|||
|
|
MembersTransactionDetailsDA.GetTranAmountWithVoluntary(tc, memberID, dtYearEnd, dtMonthEnd, fundTypeID);
|
|||
|
|
|
|||
|
|
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(int 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, int fundTypeID)
|
|||
|
|
{
|
|||
|
|
DataSet oMembersYearlyBalance = new DataSet();
|
|||
|
|
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
oMembersYearlyBalance = MembersTransactionDetailsDA.GetMembersYearlyBalance(tc, FromDate, ToDate, fundTypeID);
|
|||
|
|
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 DataSet GetMembersVolYearlyBalance(DateTime FromDate, DateTime ToDate, int fundTypeID)
|
|||
|
|
{
|
|||
|
|
DataSet oMembersYearlyBalance = new DataSet();
|
|||
|
|
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
oMembersYearlyBalance = MembersTransactionDetailsDA.GetMembersVolYearlyBalance(tc, FromDate, ToDate, fundTypeID);
|
|||
|
|
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, int fundTypeID)
|
|||
|
|
{
|
|||
|
|
DataTable dTbl = new DataTable("MembersTransactionDetails");
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin(true);
|
|||
|
|
|
|||
|
|
IDataReader ir = MembersTransactionDetailsDA.GetMembersEPFCPF(tc, EmpID, dateTime, 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 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 DataTable GetOpeningBalanceAllMember(int fundtypeid, DateTime trandate)
|
|||
|
|
{
|
|||
|
|
DataTable openingBalanceset;
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin(true);
|
|||
|
|
openingBalanceset = MembersTransactionDetailsDA.GetOpeningBalanceAllMember(tc, fundtypeid, trandate);
|
|||
|
|
tc.End();
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
throw new ServiceException("Failed to Check by code" + e.Message, e);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return openingBalanceset;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
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<MembersTransactionDetail> memberTransactionDetails)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
//ConfigHelper epfConfigHelper = new ConfigHelper();
|
|||
|
|
//epfConfigHelper = ConfigHelper.GetConfig(Convert.ToString(27));
|
|||
|
|
//ConfigHelper cpfConfigHelper = new ConfigHelper();
|
|||
|
|
//cpfConfigHelper = ConfigHelper.GetConfig(Convert.ToString(28));
|
|||
|
|
|
|||
|
|
foreach (MembersTransactionDetail item in memberTransactionDetails)
|
|||
|
|
{
|
|||
|
|
int id = tc.GenerateID("FM_MembersTransactionDetails", "TranID");
|
|||
|
|
base.SetObjectID(item, (id));
|
|||
|
|
item.CreatedBy = item.FundTypeID;
|
|||
|
|
item.CreatedDate = DateTime.Now.Date;
|
|||
|
|
MembersTransactionDetailsDA.Insert(tc, item);
|
|||
|
|
//ConfigHelper.UploadTranType(tc, ((item.FundTypeID == 1) ? Convert.ToString(cpfConfigHelper.TranTypeID) :
|
|||
|
|
// Convert.ToString(cpfConfigHelper.TranTypeID)), item.FundTypeID, 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
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
internal void DeleteMemberTran(TransactionContext tc, List<MembersTransactionDetail> _details)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
foreach (MembersTransactionDetail 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<MembersTransactionDetail> Get()
|
|||
|
|
{
|
|||
|
|
throw new NotImplementedException();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public List<MembersTransactionDetail> GetMemberContribution(int memberID, DateTime beforeConOfDate)
|
|||
|
|
{
|
|||
|
|
throw new NotImplementedException();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public List<MembersTransactionDetail> GetMemberContribution(int memberID, string searchCondition)
|
|||
|
|
{
|
|||
|
|
List<MembersTransactionDetail> MembersTransactionDetailss = new List<MembersTransactionDetail>();
|
|||
|
|
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<MembersTransactionDetail> GetMemberContribution(int memberID, string searchCondition, string FMConn)
|
|||
|
|
{
|
|||
|
|
List<MembersTransactionDetail> MembersTransactionDetailss = new List<MembersTransactionDetail>();
|
|||
|
|
|
|||
|
|
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 DataSet GetMemberContributionDataTable(int memberID, string searchCondition, int fundTypeID)
|
|||
|
|
{
|
|||
|
|
DataSet dr = new DataSet();
|
|||
|
|
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin(true);
|
|||
|
|
dr = MembersTransactionDetailsDA.GetMemberContributionDataSet(tc, memberID, searchCondition, fundTypeID);
|
|||
|
|
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 dr;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public DataSet GetGFProvissionMember(DateTime month)
|
|||
|
|
{
|
|||
|
|
throw new NotImplementedException();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void UploadOpeningTran(List<MembersTransactionDetail> memberTrans, List<MemberBalaneMonthly> membersMonthlyBalances)
|
|||
|
|
{
|
|||
|
|
throw new NotImplementedException();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void UploadOpeningTranForGF(List<MembersTransactionDetail> 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();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void Save(List<MembersTransactionDetail> memberTrans, DateTime date)
|
|||
|
|
{
|
|||
|
|
throw new NotImplementedException();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public double GetDashboardMemberAuditedOwnBalance(int MemberID)
|
|||
|
|
{
|
|||
|
|
double auditedOwnBalance = 0;
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
auditedOwnBalance = MembersTransactionDetailsDA.GetDashboardMemberAuditedOwnBalance(tc, MemberID);
|
|||
|
|
tc.End();
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
ExceptionLog.Write(e);
|
|||
|
|
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return auditedOwnBalance;
|
|||
|
|
}
|
|||
|
|
public double GetDashboardMemberAuditedCompanyBalance(int MemberID)
|
|||
|
|
{
|
|||
|
|
double auditedOwnBalance = 0;
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
auditedOwnBalance = MembersTransactionDetailsDA.GetDashboardMemberAuditedCompanyBalance(tc, MemberID);
|
|||
|
|
tc.End();
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
ExceptionLog.Write(e);
|
|||
|
|
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return auditedOwnBalance;
|
|||
|
|
}
|
|||
|
|
public double GetDashboardMemberUnAuditedOwnBalance(int MemberID)
|
|||
|
|
{
|
|||
|
|
double auditedOwnBalance = 0;
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
auditedOwnBalance = MembersTransactionDetailsDA.GetDashboardMemberUnAuditedOwnBalance(tc, MemberID);
|
|||
|
|
tc.End();
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
ExceptionLog.Write(e);
|
|||
|
|
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return auditedOwnBalance;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public DateTime? GetMemberLastAuditDate(int MemberID)
|
|||
|
|
{
|
|||
|
|
DateTime? yearEndDate = null;
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
yearEndDate = MembersTransactionDetailsDA.GetMemberLastAuditDate(tc, MemberID);
|
|||
|
|
tc.End();
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
ExceptionLog.Write(e);
|
|||
|
|
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return yearEndDate;
|
|||
|
|
}
|
|||
|
|
public double GetDashboardMemberUnAuditedCompanyBalance(int MemberID)
|
|||
|
|
{
|
|||
|
|
double auditedOwnBalance = 0;
|
|||
|
|
TransactionContext tc = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
tc = TransactionContext.Begin();
|
|||
|
|
auditedOwnBalance = MembersTransactionDetailsDA.GetDashboardMemberUnAuditedCompanyBalance(tc, MemberID);
|
|||
|
|
tc.End();
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
#region Handle Exception
|
|||
|
|
|
|||
|
|
if (tc != null)
|
|||
|
|
tc.HandleError();
|
|||
|
|
ExceptionLog.Write(e);
|
|||
|
|
|
|||
|
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return auditedOwnBalance;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|