153 lines
7.4 KiB
C#
153 lines
7.4 KiB
C#
using HRM.BO;
|
|
using HRM.BO;
|
|
using Ease.Core.DataAccess;
|
|
using System;
|
|
using System.Data;
|
|
|
|
|
|
namespace HRM.DA.Fund
|
|
{
|
|
#region class MembersBalanceSummaryDA
|
|
|
|
internal class MembersBalanceSummaryDA
|
|
{
|
|
#region Constructor
|
|
|
|
public MembersBalanceSummaryDA()
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Insert function
|
|
|
|
internal static void Insert(TransactionContext tc, MembersBalanceSummary oItem)
|
|
{
|
|
string sql = string.Empty;
|
|
sql = SQLParser.MakeSQL(@"INSERT INTO MemberBalanceSummary(MembersID,FundTypeID,EmpCode,MembershipDate,
|
|
MembershipNo,ProjectID,OpeningContribution,Contribution,Total,OpeningActualInterest,
|
|
ContributionActualInterest,TotalInterest,OpeningBalance,ContributionWithInterest,TotalBalance,
|
|
CurrentYearTotalContribution,CURRENTYEARTOTALBENIFITPROVSN,CURRENTYEARTOTALBALANCEPROVSN,
|
|
MostRecentYearActualInterest,CreatedBy,CreatedDate)
|
|
VALUES(%n,%n,%s,%d,%s,%n,%n,%n,%n,%n,%n,%n,%n,%n,%n,%n,%n,%n,%n,%n,%D)",
|
|
oItem.MembersID, oItem.FundTypeID, oItem.EmpCode,
|
|
DataReader.GetNullValue(oItem.MembershipDate), oItem.MembershipNo, oItem.ID,
|
|
oItem.OpeningContribution, oItem.Contribution, oItem.Total, oItem.OpeningActualInterest,
|
|
oItem.ContributionActualInterest, oItem.TotalInterest, oItem.OpeningBalance,
|
|
oItem.ContributionWithInterest, oItem.TotalBalance, oItem.CurrentYearTotalContribution,
|
|
oItem.CurrentYearTotalBenifitProvisioned, oItem.CurrentYearTotalBalanceProvisioned,
|
|
oItem.MostRecentYearActualInterest, oItem.CreatedBy, oItem.CreatedDate);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update function
|
|
|
|
internal static void Update(TransactionContext tc, MembersBalanceSummary oItem)
|
|
{
|
|
string sql = string.Empty;
|
|
sql = SQLParser.MakeSQL(
|
|
"UPDATE MemberBalanceSummary SET MembersID = %n, FundTypeID = %n, EmpCode = %s, MembershipDate = %d, MembershipNo = %s,ProjectID = %n,OpeningContribution= %n, Contribution = %n, Total = %n, OpeningActualInterest = %n,ContributionActualInterest = %n, TotalInterest = %n, OpeningBalance = %n, ContributionWithInterest = %n, TotalBalance = %n, CurrentYearTotalContribution = %n, CurrentYearTotalBenifitProvisioned = %n, CurrentYearTotalBalanceProvisioned = %n, MostRecentYearActualInterest = %n, ModifiedBy = %n, ModifiedDate = %D" +
|
|
" WHERE MembersID=%n AND FundTypeID=%n", oItem.MembersID, oItem.FundTypeID, oItem.EmpCode,
|
|
DataReader.GetNullValue(oItem.MembershipDate), oItem.MembershipNo, oItem.ID, oItem.OpeningContribution,
|
|
oItem.Contribution, oItem.Total, oItem.OpeningActualInterest, oItem.ContributionActualInterest,
|
|
oItem.TotalInterest, oItem.OpeningBalance, oItem.ContributionWithInterest, oItem.TotalBalance,
|
|
oItem.CurrentYearTotalContribution, oItem.CurrentYearTotalBenifitProvisioned,
|
|
oItem.CurrentYearTotalBalanceProvisioned, oItem.MostRecentYearActualInterest, oItem.ModifiedBy,
|
|
oItem.ModifiedDate, oItem.MembersID, oItem.FundTypeID);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region int Generation function
|
|
|
|
internal static int GetNewID(TransactionContext tc)
|
|
{
|
|
return tc.GenerateID("MemberBalanceSummary", "MembersID");
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get Function
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int fundtypeid)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM MemberBalanceSummary Where ProjectID=%n", fundtypeid);
|
|
}
|
|
|
|
internal static IDataReader GetBothFund(TransactionContext tc, int membersID, int fundtypeid)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM MemberBalanceSummary WHERE MembersID=%n AND ProjectID=%n", membersID,
|
|
fundtypeid);
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int MembersID, int fundtypeid)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM MemberBalanceSummary WHERE MembersID=%n AND ProjectID=%n", MembersID,
|
|
fundtypeid);
|
|
}
|
|
|
|
internal static IDataReader GetByID(TransactionContext tc, int memberID, int fundID, int fundtypeid)
|
|
{
|
|
string sql = string.Empty;
|
|
sql = SQLParser.MakeSQL(
|
|
"SELECT * FROM MemberBalanceSummary WHERE MembersID=%n AND FundTypeID = %n AND fundtypeid=%n", memberID,
|
|
fundID, fundtypeid);
|
|
return tc.ExecuteReader(sql);
|
|
}
|
|
|
|
internal static DataSet GetFunds(TransactionContext tc, int MembersID, int fundtypeid)
|
|
{
|
|
string sSQL = SQLParser.MakeSQL("SELECT * FROM MemberBalanceSummary WHERE MembersID=%n AND ProjectID=%n",
|
|
MembersID, fundtypeid);
|
|
//string sSQL = SQLParser.MakeSQL("SELECT * FROM MembersTransactionDetails WHERE MembersID=%n AND ProjectID=%n", MembersID, User.CurrentUser.ID);
|
|
DataSet ds = tc.ExecuteDataSet(sSQL);
|
|
return ds;
|
|
}
|
|
|
|
internal static DataTable GetTable(TransactionContext tc)
|
|
{
|
|
string sql = string.Empty;
|
|
|
|
sql = SQLParser.MakeSQL(
|
|
"SELECT Own.EmpCode AS EmpNo, MemberDetail.Name, Own.OpeningBalance AS OwnOpeningBalance,"
|
|
+ " Company.OpeningBalance AS CompanyOpeningBalance, Own.Contribution AS OwnContribution,"
|
|
+ " Company.Contribution AS CompanyContribution ,Own.OpeningBalance + Own.Contribution AS OwnSubTotal, "
|
|
+ " Company.OpeningBalance + Company.Contribution AS CompanySubTotal,"
|
|
+ " Own.MostRecentYearActualInterest AS OwnActualInterest, "
|
|
+ " Company.MostRecentYearActualInterest AS CompanyActualInterest ,"
|
|
+ " Own.OpeningBalance + Own.Contribution + Own.MostRecentYearActualInterest AS OwnTotal,"
|
|
+ " Company.OpeningBalance + Company.Contribution + Company.MostRecentYearActualInterest AS CompanyTotal ,"
|
|
+ " Own.OpeningBalance + Own.Contribution + Own.MostRecentYearActualInterest + Company.OpeningBalance + Company.Contribution + Company.MostRecentYearActualInterest"
|
|
+ " AS GrandTotal, Own.MembersID"
|
|
+ " FROM MemberBalanceSummary AS Own, MemberBalanceSummary AS Company, MemberDetail "
|
|
+ " WHERE Own.FundTypeID = 1 AND Company.FundTypeID = 2 AND Own.MembersID = Company.MembersID "
|
|
+ " AND Own.MembersID = MemberDetail.MemberID AND MemberDetail.Status = 1");
|
|
DataSet ds = tc.ExecuteDataSet(sql);
|
|
return ds.Tables[0];
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete function
|
|
|
|
internal static void Delete(TransactionContext tc, int MembersID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM [MemberBalanceSummary] WHERE MembersID=%n", MembersID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
internal static bool IsExistInSummery(TransactionContext tc, int fundId, int memberID, int fundtypeid)
|
|
{
|
|
object ob = tc.ExecuteScalar(
|
|
"SELECT COUNT(*) FROM MemberBalanceSummary WHERE MembersID = %n AND FundTypeID = %n AND ProjectID=%n",
|
|
memberID, fundId, fundtypeid);
|
|
return Convert.ToInt32(ob) > 0;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
} |