233 lines
8.6 KiB
C#
233 lines
8.6 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using Ease.CoreV35.DataAccess;
|
|||
|
using Ease.CoreV35.Model;
|
|||
|
using Payroll.BO;
|
|||
|
|
|||
|
namespace Payroll.Service
|
|||
|
{
|
|||
|
internal class DAMasterDA
|
|||
|
{
|
|||
|
#region Get
|
|||
|
public static IDataReader Get(TransactionContext tc, ID iD)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM DAMaster Where DAMasterID=%n",iD.Integer);
|
|||
|
|
|||
|
}
|
|||
|
public static IDataReader Get(TransactionContext tc, string code)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM DAMaster Where DAMCODE=%s", code);
|
|||
|
}
|
|||
|
public static IDataReader GetDAs(TransactionContext tc,string sql)
|
|||
|
{
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
#region Childs Get
|
|||
|
public static IDataReader GetDAEmployees(TransactionContext tc, ID id)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("Select * from DAEmployee where DAID=%n", id.Integer);
|
|||
|
}
|
|||
|
|
|||
|
public static IDataReader GetDAComplains(TransactionContext tc, ID id)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("Select * from DAComplain where DAID=%n", id.Integer);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
public static IDataReader GetDAEmpExplanations(TransactionContext tc, ID id)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("Select * from DAEmpExplanation where DAID=%n", id.Integer);
|
|||
|
}
|
|||
|
|
|||
|
public static IDataReader GetDAPunishments(TransactionContext tc, ID id)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("Select * from DAPunishment where DAID=%n", id.Integer);
|
|||
|
}
|
|||
|
|
|||
|
public static IDataReader GetDAComEmps(TransactionContext tc, ID id)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("select * from DAComEmp where DAID=%n", id.Integer);
|
|||
|
}
|
|||
|
|
|||
|
public static IDataReader GetDAPEmployees(TransactionContext tc, ID id)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("select * from DAPEmployee where PID=%n", id.Integer);
|
|||
|
}
|
|||
|
|
|||
|
public static IDataReader GetDAPRIEmps(TransactionContext tc, ID id)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("select * from DAPRIEmp where DAID=%n", id.Integer);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Insert
|
|||
|
public static void Insert(TransactionContext tc, DAMaster item)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL("INSERT INTO DAMaster(DAMasterID,DACNote,DACOMFileName,DAMCode,DAMDate,DAMFileName,DAMNote,DAPRIFileName,DCDate,DPRIDate,DACSheetFileName,DACSheetNote,DCSheetDate)" +
|
|||
|
" VALUES(%n, %s, %s, %s, %d, %s, %s, %s, %d, %d,%s,%s,%d)",
|
|||
|
item.ID.Integer, item.DACNote, item.DACOMFileName,
|
|||
|
item.DAMCode, item.DAMDate,
|
|||
|
item.DAMFileName, item.DAMNote, item.DAPRIFileName,
|
|||
|
item.DCDate, item.DPRIDate,item.DACSheetFileName,item.DACSheetNote,item.DCSheetDate);
|
|||
|
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
#region Insert Child
|
|||
|
public static void InsertDAEmployee(TransactionContext tc, DAEmployee item)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL
|
|||
|
(@"Insert into DAEmployee(DAEMPID,DAID,EmployeeID) VALUES(%n,%n,%n)",
|
|||
|
item.ID.Integer, item.DAID.Integer, item.EmployeeID.Integer);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
public static void InsertDAComplain(TransactionContext tc, DAComplain item)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL
|
|||
|
(@"Insert into DAComplain(DACompID,DAID,ComplainID) VALUES(%n,%n,%n)",
|
|||
|
item.ID.Integer, item.DAID.Integer, item.ComplainID.Integer);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public static void InsertDAEmpExplanation(TransactionContext tc, DAEmpExplanation item)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL
|
|||
|
(@"Insert into DAEmpExplanation(DAExpID,DAID,DAEXNote,DAEXDate
|
|||
|
,EmployeeID,FileName) VALUES(%n,%n,%s,%d,%n,%s)",
|
|||
|
item.ID.Integer, item.DAID.Integer, item.DAEXNote,
|
|||
|
item.DAEXDate, item.EmployeeID.Integer, item.FileName);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
public static void InsertDAPunishment(TransactionContext tc, DAPunishment item)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL
|
|||
|
(@"Insert into DAPunishment(DAPID,DAID,DAPDate,DAPFromDate
|
|||
|
,DAPToDate,DAPNote,EmployeeID,DAPFileName) VALUES(%n,%n,%d,%d,%d,%s,%n,%s)",
|
|||
|
item.ID.Integer, item.DAID.Integer, item.DAPDate,
|
|||
|
item.DAPFromDate, item.DAPToDate, item.DAPNote,
|
|||
|
item.EmployeeID.Integer,item.DAPFileName);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
public static void InsertDAComEmp(TransactionContext tc, DAComEmp item)
|
|||
|
{
|
|||
|
|
|||
|
string sql = SQLParser.MakeSQL
|
|||
|
(@"Insert into DAComEmp(DACEID,DAID,EMPLOYEEID)
|
|||
|
VALUES(%n,%n,%n)",
|
|||
|
item.ID.Integer, item.DAID.Integer, item.EmployeeID.Integer);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
public static void InsertDAPEmployee(TransactionContext tc, DAPEmployee item)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL
|
|||
|
(@"Insert into DAPEmployee(DAPEID,DAID,EmpID,PID
|
|||
|
,PunishmentID) VALUES(%n,%n,%n,%n,%n)",
|
|||
|
item.ID.Integer, item.DAID.Integer, item.EmpID.Integer,
|
|||
|
item.PID.Integer, item.PunishmentID.Integer);
|
|||
|
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
public static void InsertDAPRIEmp(TransactionContext tc, DAPRIEmp item)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL
|
|||
|
(@"Insert into DAPRIEmp(DAPRIID,DAID,EmployeeID)
|
|||
|
VALUES(%n,%n,%n)",
|
|||
|
item.ID.Integer, item.DAID.Integer, item.EmployeeID.Integer);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Update
|
|||
|
public static void Update(TransactionContext tc, DAMaster item)
|
|||
|
{
|
|||
|
string sql =
|
|||
|
SQLParser.MakeSQL(
|
|||
|
"Update DAMaster SET DACNote=%s,DACOMFileName=%s,DAMCode=%s,DAMDate=%d,DAMFileName=%s,DAMNote=%s,DAPRIFileName=%s,DCDate=%d,DPRIDate=%d,DACSheetFileName=%s,DACSheetNote=%s,DCSheetDate=%d " +
|
|||
|
"Where DAMAsterID=%n",
|
|||
|
item.DACNote, item.DACOMFileName,
|
|||
|
item.DAMCode, item.DAMDate,
|
|||
|
item.DAMFileName, item.DAMNote, item.DAPRIFileName,
|
|||
|
item.DCDate, item.DPRIDate,item.DACSheetFileName,item.DACSheetNote,item.DCSheetDate, item.ID.Integer);
|
|||
|
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Delete
|
|||
|
public static void Delete(TransactionContext tc, ID id)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("Delete From DAMaster Where DAMasterID=%n",id.Integer);
|
|||
|
}
|
|||
|
|
|||
|
#region Child Delete
|
|||
|
public static void DeleteDAEmployees(TransactionContext tc, ID id)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("Delete from DAEmployee where DAID=%n", id.Integer);
|
|||
|
}
|
|||
|
|
|||
|
public static void DeleteDAComplains(TransactionContext tc, ID id)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("Delete from DAComplain where DAID=%n", id.Integer);
|
|||
|
}
|
|||
|
|
|||
|
public static void DeleteDAEmpExplanations(TransactionContext tc, ID id)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("Delete from DAEmpExplanation where DAID=%n", id.Integer);
|
|||
|
}
|
|||
|
|
|||
|
public static void DeleteDAPunishments(TransactionContext tc, ID id)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("Delete from DAPunishment where DAID=%n", id.Integer);
|
|||
|
}
|
|||
|
|
|||
|
public static void DeleteDAComEmps(TransactionContext tc, ID id)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("Delete from DAComEmp where DAID=%n", id.Integer);
|
|||
|
}
|
|||
|
|
|||
|
public static void DeleteDAPEmployees(TransactionContext tc, ID id)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("Delete from DAPEmployee where DAID=%n", id.Integer);
|
|||
|
}
|
|||
|
|
|||
|
public static void DeleteDAPRIEmps(TransactionContext tc, ID id)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("Delete from DAPRIEmp where DAID=%n", id.Integer);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Check
|
|||
|
|
|||
|
public static bool CheckDAMasterDuplicateCode(TransactionContext tc, string damCode)
|
|||
|
{
|
|||
|
if (((int)tc.ExecuteScalar("Select Count(*) from DAMaster where DAMCODE=%s", damCode))==0)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
return true;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|
|||
|
}
|