300 lines
13 KiB
C#
300 lines
13 KiB
C#
|
using HRM.BO;
|
|||
|
using Ease.Core.DataAccess;
|
|||
|
using System;
|
|||
|
using System.Data;
|
|||
|
using Microsoft.Data.SqlClient;
|
|||
|
|
|||
|
namespace HRM.DA
|
|||
|
{
|
|||
|
public class ErAppliedApplicantDA
|
|||
|
{
|
|||
|
internal static void InsertErAppliedApplicant(ErAppliedApplicant obAppliedApplicant, TransactionContext tc)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(
|
|||
|
@"INSERT INTO ErAppliedApplicant
|
|||
|
(
|
|||
|
AppliedApplicantID, UserID, JobID,
|
|||
|
ApplyDate, ApplicationAcknowldged, IsSelectedforInterview,
|
|||
|
IsOfferLetterAccepted, OfferletterRejectReason, OfferLetterIssueDate,
|
|||
|
CREATIONDATE, CREATEDBY
|
|||
|
)
|
|||
|
VALUES
|
|||
|
(
|
|||
|
%n, %n, %n,
|
|||
|
%d, %b, %b,
|
|||
|
%b, %s, %d,
|
|||
|
%d, %n
|
|||
|
)", obAppliedApplicant.ID, obAppliedApplicant.UserID, obAppliedApplicant.JobID, obAppliedApplicant.ApplyDate,
|
|||
|
obAppliedApplicant.ApplicationAcknowldged, obAppliedApplicant.IsSelectedforInterview,
|
|||
|
obAppliedApplicant.IsOfferLetteraccepted, obAppliedApplicant.OfferletterRejectReason, obAppliedApplicant.OfferLetterIssueDate,
|
|||
|
obAppliedApplicant.CreatedDate, obAppliedApplicant.CreatedBy);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
internal static void UpdateErAppliedApplicant(ErAppliedApplicant obAppliedApplicant, TransactionContext tc)
|
|||
|
{
|
|||
|
int? modifiedBy = null;
|
|||
|
if (obAppliedApplicant.ModifiedBy == 0)
|
|||
|
{
|
|||
|
modifiedBy = null;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
modifiedBy = obAppliedApplicant.ModifiedBy;
|
|||
|
}
|
|||
|
|
|||
|
DateTime? modificationDate;
|
|||
|
if (obAppliedApplicant.ModifiedDate == null)
|
|||
|
{
|
|||
|
modificationDate = null;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
modificationDate = DateTime.Today;
|
|||
|
}
|
|||
|
|
|||
|
string sql = SQLParser.MakeSQL(
|
|||
|
@"UPDATE ErAppliedApplicant
|
|||
|
SET
|
|||
|
UserID = %n,
|
|||
|
JobID = %n,
|
|||
|
ApplyDate = %d,
|
|||
|
ApplicationAcknowldged = %b,
|
|||
|
IsSelectedforInterview = %b,
|
|||
|
IsOfferLetterAccepted = %b,
|
|||
|
OfferletterRejectReason = %s,
|
|||
|
OfferLetterIssueDate = %d,
|
|||
|
MODIFIEDBY = %n,
|
|||
|
MODIFIEDDATE = %d,
|
|||
|
OfferletterAcceptDate=%d,
|
|||
|
OfferletterAcceptBy=%n
|
|||
|
WHERE AppliedApplicantID = %n",
|
|||
|
obAppliedApplicant.UserID, obAppliedApplicant.JobID, obAppliedApplicant.ApplyDate,
|
|||
|
obAppliedApplicant.ApplicationAcknowldged, obAppliedApplicant.IsSelectedforInterview,
|
|||
|
obAppliedApplicant.IsOfferLetteraccepted, obAppliedApplicant.OfferletterRejectReason, obAppliedApplicant.OfferLetterIssueDate,
|
|||
|
obAppliedApplicant.ModifiedBy, obAppliedApplicant.ModifiedDate, obAppliedApplicant.OfferletterAcceptDate, obAppliedApplicant.OfferletterAcceptBy, obAppliedApplicant.ID);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static void InsertErJobupdate(ErJobupdate obErJobupdate, TransactionContext tc)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(
|
|||
|
@"INSERT INTO ErJobUpdate
|
|||
|
(
|
|||
|
UserID, JobID, AppliedApplicantID,UpdatedBy,
|
|||
|
Description, Remarks,
|
|||
|
UpdateDate, IsAcknowledged,AcknowledgeDate,ReferenceID
|
|||
|
)
|
|||
|
VALUES
|
|||
|
(
|
|||
|
%n, %n, %n,%n,%s,%s,
|
|||
|
%d, %b,%d, %n
|
|||
|
)", obErJobupdate.UserID, obErJobupdate.JobID, obErJobupdate.AppliedApplicantID, obErJobupdate.UpdatedBy, obErJobupdate.Description,
|
|||
|
obErJobupdate.Remarks,obErJobupdate.UpdateDate, obErJobupdate.IsAcknowledged,
|
|||
|
obErJobupdate.AcknowledgeDate, obErJobupdate.ReferenceID);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
internal static void UpdateJobUpdate(ErJobupdate obErJobupdate, TransactionContext tc)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(
|
|||
|
@"UPDATE ErJobUpdate
|
|||
|
SET
|
|||
|
JobID = %n,
|
|||
|
UpdatedBy = %n,
|
|||
|
Description = %s,
|
|||
|
Remarks = %s,
|
|||
|
UpdateDate = %d,
|
|||
|
IsAcknowledged = %b
|
|||
|
AcknowledgeDate=%d
|
|||
|
ReferenceID = %n
|
|||
|
WHERE AppliedApplicantID = %n",
|
|||
|
obErJobupdate.UserID, obErJobupdate.JobID, obErJobupdate.UpdatedBy, obErJobupdate.Description,
|
|||
|
obErJobupdate.Remarks, obErJobupdate.UpdateDate, obErJobupdate.IsAcknowledged,
|
|||
|
obErJobupdate.AcknowledgeDate, obErJobupdate.ReferenceID,
|
|||
|
obErJobupdate.AppliedApplicantID);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static void InsertErApplicantDoc(ErApplicantDoc erApplicantDoc, TransactionContext tc)
|
|||
|
{
|
|||
|
|
|||
|
string sql = SQLParser.MakeSQL(
|
|||
|
@"INSERT INTO ErApplicantDoc
|
|||
|
(
|
|||
|
AppliedApplicantID, UserID, DocType,UpdatedBy,
|
|||
|
CreatedDate,REMARKS
|
|||
|
)
|
|||
|
VALUES
|
|||
|
(
|
|||
|
%n, %n, %n,
|
|||
|
%n, %s
|
|||
|
)", erApplicantDoc.AppliedApplicantID, erApplicantDoc.UserID, (int)erApplicantDoc.DocType, erApplicantDoc.UpdatedBy,
|
|||
|
erApplicantDoc.CreatedDate, erApplicantDoc.Remarks);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static void UpdateErApplicantDoc(ErApplicantDoc obErApplicantDoc, TransactionContext tc)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(
|
|||
|
@"UPDATE ErApplicantDoc
|
|||
|
SET
|
|||
|
UserID = %n,
|
|||
|
DocType = %n,
|
|||
|
UpdatedBy = %s,
|
|||
|
CreatedDate=%d,
|
|||
|
Remarks = %s,
|
|||
|
WHERE AppliedApplicantID = %n",
|
|||
|
obErApplicantDoc.UserID,(int) obErApplicantDoc.DocType, obErApplicantDoc.UpdatedBy, obErApplicantDoc.CreatedDate,
|
|||
|
obErApplicantDoc.AppliedApplicantID);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
public static void Insert(ErApplicantDoc item, string connectionString)
|
|||
|
{
|
|||
|
using (SqlConnection connection = new SqlConnection(connectionString))
|
|||
|
{
|
|||
|
connection.Open();
|
|||
|
SqlCommand cmd = new SqlCommand();
|
|||
|
cmd.Connection = connection;
|
|||
|
string commandText = @"INSERT INTO ErApplicantDoc(AppliedApplicantID,UserID,DocType,UpdatedBy,CreatedDate,Remarks, FileData, OriginalFileName,JobID) Values (@AppliedApplicantID,@UserID,@DocType,@UpdatedBy,@CreatedDate,@Remarks,@FileData,@OriginalFileName,@JobID)";
|
|||
|
cmd.CommandText = commandText;
|
|||
|
cmd.CommandType = CommandType.Text;
|
|||
|
cmd.Parameters.Add("@AppliedApplicantID", SqlDbType.Int);
|
|||
|
cmd.Parameters["@AppliedApplicantID"].Value = item.AppliedApplicantID;
|
|||
|
|
|||
|
cmd.Parameters.Add("@UserID", SqlDbType.Int);
|
|||
|
cmd.Parameters["@UserID"].Value = item.UserID;
|
|||
|
|
|||
|
cmd.Parameters.Add("@DocType", SqlDbType.Int);
|
|||
|
cmd.Parameters["@DocType"].Value = (int)item.DocType;
|
|||
|
|
|||
|
|
|||
|
cmd.Parameters.Add("@UpdatedBy", SqlDbType.Int);
|
|||
|
cmd.Parameters["@UpdatedBy"].Value = item.UpdatedBy;
|
|||
|
|
|||
|
cmd.Parameters.Add("@CreatedDate", SqlDbType.DateTime);
|
|||
|
cmd.Parameters["@CreatedDate"].Value = DateTime.Now;
|
|||
|
|
|||
|
cmd.Parameters.Add("@Remarks", SqlDbType.VarChar);
|
|||
|
cmd.Parameters["@Remarks"].Value = item.Remarks;
|
|||
|
|
|||
|
cmd.Parameters.Add("@FileData", SqlDbType.VarBinary);
|
|||
|
cmd.Parameters["@FileData"].Value = item.FileData;
|
|||
|
|
|||
|
cmd.Parameters.Add("@OriginalFileName", SqlDbType.VarChar);
|
|||
|
cmd.Parameters["@OriginalFileName"].Value = item.OriginalFileName;
|
|||
|
|
|||
|
cmd.Parameters.Add("@JobID", SqlDbType.Int);
|
|||
|
cmd.Parameters["@JobID"].Value = item.JobID;
|
|||
|
|
|||
|
cmd.ExecuteNonQuery();
|
|||
|
cmd.Dispose();
|
|||
|
|
|||
|
connection.Close();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
internal static void UpdateAppliedApplicant(ErApplicantDoc obErApplicantDoc, TransactionContext tc)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(
|
|||
|
@"UPDATE ErAppliedApplicant
|
|||
|
SET
|
|||
|
OfferLetterIssueDate = %d
|
|||
|
WHERE AppliedApplicantID = %n",
|
|||
|
DateTime.Now,
|
|||
|
obErApplicantDoc.AppliedApplicantID);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetByID(int AppliedApplicantID, TransactionContext tc)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"Select * From ErAppliedApplicant Where AppliedApplicantID = %n", AppliedApplicantID);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetJobupdate(int AppliedApplicantID, TransactionContext tc)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"Select * From ErJobupdate Where AppliedApplicantID = %n", AppliedApplicantID);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetApplicantDoc(int AppliedApplicantID, TransactionContext tc)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"Select * From ErApplicantDoc Where AppliedApplicantID = %n", AppliedApplicantID);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetJobupdateByUserId(int userId,int jobId, TransactionContext tc)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"Select * From ErJobupdate Where jobId = %n and userId=%n", jobId,userId);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetApplicantInfoByRecruitmentID(int recruitmentId, TransactionContext tc)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"SELECT distinct era.*,eju.USERNAME,ir.PositionNo FROM ErAppliedApplicant era
|
|||
|
INNER JOIN ER_Circular ec ON ec.ERCircularID = era.JobID
|
|||
|
INNER JOIN INTERNALREQRUITMENT ir ON ir.POSITIONID= ec.RecruitementID
|
|||
|
INNER JOIN ERJOBUSER eju ON eju.USERID=era.UserID
|
|||
|
WHERE ec.RecruitementID = %n", recruitmentId);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetApplicantInfoByUserID(int recruitmentId,int userId, TransactionContext tc)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"SELECT eaa.* FROM ErAppliedApplicant eaa
|
|||
|
INNER JOIN ER_Circular ec ON eaa.JobID=ec.ERCircularID
|
|||
|
WHERE eaa.UserID=%n AND ec.RecruitementID=%n
|
|||
|
", userId, recruitmentId);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetApplicantDocByUserID(int jobId, int userId, TransactionContext tc)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"SELECT eaa.* FROM ErApplicantDoc eaa
|
|||
|
WHERE eaa.userId=%n AND eaa.jobId=%n
|
|||
|
", userId, jobId);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetJobApplicantByUserId(int userId, int jobId, TransactionContext tc)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"Select * From ErAppliedApplicant Where jobId = %n and userId=%n", jobId, userId);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetAllJobApplicantByUserId(int userId, TransactionContext tc)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"Select * From ErAppliedApplicant Where userId=%n", userId);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"Select * From ErAppliedApplicant");
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
internal static void Delete(int iD, TransactionContext tc)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"Delete From ErAppliedApplicant Where AppliedApplicantID = %n", iD);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
internal static void DeletJobupdate(int iD, TransactionContext tc)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"Delete From ErAppliedApplicant Where AppliedApplicantID= %n", iD);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
internal static void DeleteApplicantDoc(TransactionContext tc, int refID)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(@"DELETE FROM ErApplicantDoc WHERE AppliedApplicantID =%n", refID);
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|