CEL_Payroll/Payroll.Service/Recruitement/DA/ExperienceDA.cs
2024-09-17 14:30:13 +06:00

63 lines
2.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ease.CoreV35.DataAccess;
using Ease.CoreV35.Model;
using Payroll.BO;
namespace Payroll.Service
{
public class ExperienceDA
{
internal static void InsertExperience(Experience exprItem,TransactionContext tc)
{
DateTime? ToDate;
if(exprItem.ToDate == DateTime.MinValue)
{
ToDate = null;
}
else ToDate = exprItem.ToDate;
string sql =
SQLParser.MakeSQL(
@"Insert Into CVExperience(ExperienceID,ContactNo,ContactPerson,CvId,Employer,FromDate,ToDate,RoleDefination)
Values(%n,%s,%s,%n,%s,%d,%d,%s)",
exprItem.ID.Integer, exprItem.ContactNo, exprItem.ContactPerson, exprItem.CvId.Integer,
exprItem.Employer, exprItem.FromDate, DataReader.GetNullValue(ToDate), exprItem.RoleDefination);
tc.ExecuteNonQuery(sql);
}
internal static void UpdateExperience(Experience exprItem, TransactionContext tc)
{
DateTime? ToDate;
if (exprItem.ToDate == DateTime.MinValue)
{
ToDate = null;
}
else ToDate = exprItem.ToDate;
string sql =
SQLParser.MakeSQL(
@"Update CVExperience Set ContactNo = %s,ContactPerson = %s,CvId = %n,Employer = %s,FromDate = %d,ToDate = %d,RoleDefination = %s Where ExperienceID = %n",
exprItem.ContactNo, exprItem.ContactPerson, exprItem.CvId.Integer, exprItem.Employer,
exprItem.FromDate, DataReader.GetNullValue(ToDate), exprItem.RoleDefination, exprItem.ID.Integer);
tc.ExecuteNonQuery(sql);
}
internal static void Delete(ID iD, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Delete From CVExperience Where ExperienceID = %n", iD.Integer);
tc.ExecuteNonQuery(sql);
}
internal static void DeleteByCvId(ID oID, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Delete From CVExperience Where CvId = %n", oID.Integer);
tc.ExecuteNonQuery(sql);
}
}
}