142 lines
5.9 KiB
C#
142 lines
5.9 KiB
C#
using HRM.BO;
|
|
using Ease.Core.DataAccess;
|
|
using System;
|
|
using System.Data;
|
|
|
|
|
|
namespace HRM.DA
|
|
{
|
|
internal class FndMngmentWFDA
|
|
{
|
|
#region Get
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int id)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM FndMngmentWF where FndMngmentWFID=%n", id);
|
|
}
|
|
|
|
public static IDataReader Get(TransactionContext tc, EnumStatus status)
|
|
{
|
|
string sSql = string.Empty;
|
|
|
|
if (status == EnumStatus.Regardless)
|
|
{
|
|
sSql = SQLParser.MakeSQL("SELECT * FROM FndMngmentWF");
|
|
}
|
|
else
|
|
{
|
|
sSql = SQLParser.MakeSQL("SELECT * FROM FndMngmentWF WHERE Status=%n", (int)status);
|
|
}
|
|
|
|
return tc.ExecuteReader(sSql);
|
|
}
|
|
|
|
internal static IDataReader GetFndMngmntEmps(TransactionContext tc, int FndManagementID)
|
|
{
|
|
string sSql = string.Empty;
|
|
|
|
sSql = SQLParser.MakeSQL(@"SELECT fdemp.*, ISNULL(d.Name,'') DesigName from
|
|
(SELECT fnE.*,e.EmployeeNo,e.[Name] EmployeeName,e.DesignationID
|
|
FROM FndMngmentEmp fnE,Employee e
|
|
WHERE fnE.EmployeeID = e.EmployeeID and FndMngmentWFID=%n) fdemp
|
|
LEFT JOIN Designation d
|
|
ON fdemp.DesignationID = d.DesignationID", FndManagementID);
|
|
|
|
return tc.ExecuteReader(sSql);
|
|
}
|
|
|
|
|
|
public static IDataReader GetFndMngmntEmpRmrks(TransactionContext tc, int FndMngmentEmpID)
|
|
{
|
|
string sSql = string.Empty;
|
|
|
|
sSql = SQLParser.MakeSQL("SELECT * FROM FndMngmentEmpRemarks WHERE FndMngmentEmpID=%n", FndMngmentEmpID);
|
|
|
|
return tc.ExecuteReader(sSql);
|
|
}
|
|
|
|
internal static IDataReader GetAllFndMngmentEmpRemarks(TransactionContext tc, int FndMngmentWFID)
|
|
{
|
|
string sSql = string.Empty;
|
|
|
|
sSql = SQLParser.MakeSQL("SELECT * FROM FndMngmentEmpRemarks WHERE FndMngmentWFID=%n", FndMngmentWFID);
|
|
|
|
return tc.ExecuteReader(sSql);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete
|
|
|
|
public static void Delete(TransactionContext tc, int id)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM FndMngmentWF WHERE FndMngmentWFID=%n", id);
|
|
}
|
|
|
|
public static void DeleteFndMngmentEmps(TransactionContext tc, int id)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM FndMngmentEmp WHERE FndMngmentWFID=%n", id);
|
|
}
|
|
|
|
public static void DeleteFndMngmentEmpRemarkses(TransactionContext tc, int id)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM FndMngmentEmpRemarks WHERE FndMngmentWFID=%n", id);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Insert
|
|
|
|
public static void Insert(TransactionContext tc, FndMngmentWF item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(
|
|
@"INSERT INTO FndMngmentWF(FndMngmentWFID, PurchaseType,PurchaseAmount,Description, EmployeeID, PFAmount, CFAmount, PFInterest,CFInterest,Gratuity,Status,CreatedBy,CreationDate)
|
|
VALUES(%n,%s,%n,%s,%n,%n,%n,%n,%n,%n,%n,%n,%d)",
|
|
item.ID, item.PurchaseType, DataReader.GetNullValue(item.PurchaseAmount),
|
|
DataReader.GetNullValue(item.Description), DataReader.GetNullValue(item.EmployeeID),
|
|
DataReader.GetNullValue(item.PFAmount), DataReader.GetNullValue(item.CFAmount),
|
|
DataReader.GetNullValue(item.PFInterest), DataReader.GetNullValue(item.CFInterest),
|
|
DataReader.GetNullValue(item.Gratuity), (int)item.Status, item.CreatedBy, item.CreatedDate);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
public static void InsertFndMngmentEmp(TransactionContext tc, FndMngmentEmp item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(
|
|
@"INSERT INTO FndMngmentEmp(FndMngmentEmpID, FndMngmentWFID,EmployeeID,EmailSent, WebSent, SendDate)
|
|
VALUES(%n,%n,%n,%b,%b,%d)",
|
|
item.ID, item.FndMngmentWFID, item.EmployeeID, item.EmailSent, item.WebSent, item.SentDate);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
public static void InsertFndMngmentEmpRemarks(TransactionContext tc, FndMngmentEmpRemarks item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(
|
|
@"INSERT INTO FndMngmentEmpRemarks(FndMngmentEmpRemarksID,FndMngmentEmpID, FndMngmentWFID,Remarks,RemarksDateTime, IsHR)
|
|
VALUES(%n,%n,%n,%s,%D,%b)",
|
|
item.ID, DataReader.GetNullValue(item.FndMngmentEmpID), item.FndMngmentWFID, item.Remarks,
|
|
item.RemarksDateTime, item.IsHR);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update
|
|
|
|
internal static void Update(TransactionContext tc, FndMngmentWF item)
|
|
{
|
|
string sql =
|
|
SQLParser.MakeSQL(
|
|
@"UPDATE FndMngmentWF SET PurchaseType=%s,PurchaseAmount=%n,Description=%s, EmployeeID=%n, PFAmount=%n, CFAmount=%n, PFInterest=%n,CFInterest=%n,Gratuity=%n,Status=%n,ModifiedBy=%n,ModifiedDate=%d
|
|
WHERE FndMngmentWFID=%n", item.PurchaseType, DataReader.GetNullValue(item.PurchaseAmount),
|
|
DataReader.GetNullValue(item.Description), DataReader.GetNullValue(item.EmployeeID),
|
|
DataReader.GetNullValue(item.PFAmount), DataReader.GetNullValue(item.CFAmount),
|
|
DataReader.GetNullValue(item.PFInterest), DataReader.GetNullValue(item.CFInterest),
|
|
DataReader.GetNullValue(item.Gratuity), (int)item.Status, DataReader.GetNullValue(item.ModifiedBy),
|
|
DataReader.GetNullValue(item.ModifiedDate), item.ID);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |