CEL_Payroll/Payroll.Service/Recruitement/DA/InternalRecruitmentDA.cs

151 lines
6.9 KiB
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
using System;
using Payroll.BO;
using System.Data;
using System.Linq;
using Ease.CoreV35.Model;
using System.Data.SqlClient;
using Ease.CoreV35.DataAccess;
using System.Collections.Generic;
using Ease.CoreV35.DataAccess.SQL;
namespace Payroll.Service
{
#region InternalRecruitment DA
public class InternalRecruitmentDA
{
#region Constructor
public InternalRecruitmentDA() { }
#endregion
#region Get
internal static IDataReader Get(TransactionContext tc, int id)
{
string Ssql = SQLParser.MakeSQL("SELECT * FROM InternalReqruitment where PositionId=%n", id);
return tc.ExecuteReader(Ssql);
}
internal static IDataReader Get(TransactionContext tc, bool isClosed)
{
string Ssql = SQLParser.MakeSQL("select * from InternalReqruitment where IsClosed not in(%n)", isClosed);
return tc.ExecuteReader(Ssql);
}
internal static IDataReader Get(TransactionContext tc)
{
string Ssql = SQLParser.MakeSQL("select * from InternalReqruitment ");
return tc.ExecuteReader(Ssql);
}
internal static IDataReader GetNotifications(TransactionContext tc, int id)
{
string Ssql = SQLParser.MakeSQL("select * from IRNotification where PositionId=%n",id);
return tc.ExecuteReader(Ssql);
}
internal static int GetNewNotificationID(TransactionContext tc)
{
return tc.GenerateID("IRNotification", "IRNotificationID");
}
internal static IDataReader GetIREmployeess(TransactionContext tc, int id)
{
string Ssql = SQLParser.MakeSQL("select * from IREmployee where PositionId=%n", id);
return tc.ExecuteReader(Ssql);
}
internal static int GetNewIREmployeeID(TransactionContext tc)
{
return tc.GenerateID("IREmployee", "IREmployeeID");
}
internal static IDataReader Get(TransactionContext tc, int PositionId, int empId)
{
string Ssql = SQLParser.MakeSQL("select * from IREmployee where PositionId=%n and EmployeeID=%n", PositionId, empId);
return tc.ExecuteReader(Ssql);
}
internal static IDataReader Get(TransactionContext tc, ID IrempID)
{
string Ssql = SQLParser.MakeSQL("select * from IREmployee where IREmployeeID=%n ", IrempID.Integer);
return tc.ExecuteReader(Ssql);
}
#endregion
#region Insert
internal static void Insert(TransactionContext tc, InternalRecruitment oInternalRecruitment)
{
string ssql = SQLParser.MakeSQL("INSERT INTO InternalReqruitment(PositionId, PositionName, JobDescription, Education, Experience,Responsibility, " +
" OtherResponsibility, SalaryRange, Benefits, ApplicationLastDate, PublishedDate,WorkflowRequired,IsClosed,CreatedBy,CreationDate)" +
" VALUES(%n,%s,%s,%s,%s,%s,%s,%s,%s,%s,%d,%n,%n,%n,%d)", oInternalRecruitment.ID.Integer, oInternalRecruitment.PositionName,
oInternalRecruitment.JobDescription, oInternalRecruitment.Education, oInternalRecruitment.Experience, oInternalRecruitment.Responsibility,
oInternalRecruitment.OtherResponsibility, oInternalRecruitment.SalaryRange, oInternalRecruitment.Benefits, oInternalRecruitment.ApplicationLastDate,
oInternalRecruitment.PublishedDate,oInternalRecruitment.WorkflowRequired,oInternalRecruitment.IsClosed,
oInternalRecruitment.CreatedBy.Integer, oInternalRecruitment.CreatedDate);
tc.ExecuteNonQuery(ssql);
}
internal static void InsertNotification(TransactionContext tc, IRNotification oDetail)
{
string Ssql = SQLParser.MakeSQL("INSERT INTO IRNotification(IRNotificationID, PositionId, NotificationDate, Description,NotifiedBy)" +
" VALUES(%n, %n,%d,%s,%n)", oDetail.ID.Integer, oDetail.PositionID.Integer, oDetail.NotificationDate,oDetail.Description,oDetail.NotifiedBy.Integer);
tc.ExecuteNonQuery(Ssql);
}
internal static void InsertIREmployee(TransactionContext tc, IREmployee oemployee)
{
string Ssql = SQLParser.MakeSQL("INSERT INTO IREmployee(IREmployeeID, PositionId,EmployeeID, AppliedDate, Description,IsSelected,WFStatus)" +
" VALUES(%n, %n,%n,%d,%s,%n,%n)", oemployee.ID.Integer, oemployee.PositionID.Integer,oemployee.EmployeeID.Integer,oemployee.AppliedDate, oemployee.Description,
oemployee.IsSelected,(int)oemployee.WfStatus);
tc.ExecuteNonQuery(Ssql);
}
#endregion
#region Update
internal static void Update(TransactionContext tc, InternalRecruitment oInternalRecruitment)
{
string ssql = SQLParser.MakeSQL("UPDATE InternalReqruitment SET PositionName=%s, JobDescription=%s, Education=%s,Experience=%s,Responsibility=%s," +
" OtherResponsibility=%s, SalaryRange=%s, Benefits=%s, ApplicationLastDate=%s, PublishedDate=%d,WorkflowRequired=%n," +
" IsClosed=%n,ModifiedBy=%n,ModifiedDate=%d WHERE PositionId=%n",
oInternalRecruitment.PositionName, oInternalRecruitment.JobDescription, oInternalRecruitment.Education, oInternalRecruitment.Experience,
oInternalRecruitment.Responsibility, oInternalRecruitment.OtherResponsibility, oInternalRecruitment.SalaryRange, oInternalRecruitment.Benefits,
oInternalRecruitment.ApplicationLastDate, oInternalRecruitment.PublishedDate, oInternalRecruitment.WorkflowRequired,
oInternalRecruitment.IsClosed, oInternalRecruitment.ModifiedBy.Integer, oInternalRecruitment.ModifiedDate,
oInternalRecruitment.ID.Integer);
tc.ExecuteNonQuery(ssql);
}
#endregion
#region Delete
internal static void Delete(TransactionContext tc, int id)
{
string ssql = SQLParser.MakeSQL("DELETE FROM InternalReqruitment WHERE PositionId=%n", id);
tc.ExecuteNonQuery(ssql);
}
internal static void DeleteNotifications(TransactionContext tc, int id)
{
string ssql = SQLParser.MakeSQL("DELETE FROM IRNotification WHERE PositionId=%n", id);
tc.ExecuteNonQuery(ssql);
}
internal static void DeleteIREmployees(TransactionContext tc, int id)
{
string ssql = SQLParser.MakeSQL("DELETE FROM IREmployee WHERE PositionId=%n", id);
tc.ExecuteNonQuery(ssql);
}
internal static void DeleteIREmployees(TransactionContext tc, int positionID, int employeeId)
{
string ssql = SQLParser.MakeSQL("DELETE FROM IREmployee WHERE PositionId=%n and EmployeeID=%n", positionID, employeeId);
tc.ExecuteNonQuery(ssql);
}
#endregion
}
#endregion
}