2691 lines
91 KiB
C#
2691 lines
91 KiB
C#
using System;
|
|
using System.Data;
|
|
using Ease.Core.Model;
|
|
using Ease.Core.DataAccess;
|
|
using Ease.Core;
|
|
using System.Collections.Generic;
|
|
using Ease.Core.Utility;
|
|
using HRM.BO;
|
|
using System.Threading;
|
|
using HRM.BO.Configuration;
|
|
using Microsoft.Extensions.Configuration;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using NPOI.SS.Formula.Functions;
|
|
using static HRM.BO.RecJobTracking;
|
|
|
|
namespace HRM.DA
|
|
{
|
|
public class RecruitementProcessService : ServiceTemplate, IRecruitementProcessService
|
|
{
|
|
#region Object Mapping
|
|
|
|
#region Map RecruitementProcess Object
|
|
|
|
private void MapRecruitementProcess(RecruitementProcess obRecProc, DataReader oReader)
|
|
{
|
|
SetObjectID(obRecProc, (oReader.GetInt32("RecruitementProcessID").Value));
|
|
//obRecProc.recruitementID = oReader.GetInt32("recruitementID").Value;
|
|
obRecProc.Code = oReader.GetString("Code");
|
|
obRecProc.Description = oReader.GetString("Description");
|
|
obRecProc.EndDate = oReader.GetDateTime("EndDate") == null
|
|
? DateTime.MinValue
|
|
: oReader.GetDateTime("EndDate").Value;
|
|
obRecProc.ProcessStatus = (EnumRecruitementProcess)oReader.GetInt32("ProcessStatus");
|
|
obRecProc.StartDate = oReader.GetDateTime("StartDate").Value;
|
|
|
|
this.SetObjectState(obRecProc, ObjectState.Saved);
|
|
}
|
|
|
|
protected override T CreateObject<T>(DataReader oReader)
|
|
{
|
|
RecruitementProcess obRecProc = new RecruitementProcess();
|
|
MapRecruitementProcess(obRecProc, oReader);
|
|
return obRecProc as T;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Map RecruitementOrg Object
|
|
|
|
private void MapRecruitementOrg(RecruitementOrg obRecOrg, DataReader oReader)
|
|
{
|
|
SetObjectID(obRecOrg, (oReader.GetInt32("RecruitementOrgID").Value));
|
|
obRecOrg.ProcessId = oReader.GetInt32("ProcessId", 0);
|
|
obRecOrg.OrganizationId = oReader.GetInt32("OrganizationId", 0);
|
|
this.SetObjectState(obRecOrg, ObjectState.Saved);
|
|
}
|
|
|
|
|
|
private List<RecruitementOrg> CreateRecruitementOrgObjects(DataReader oReader)
|
|
{
|
|
List<RecruitementOrg> allRecruOrgs = new List<RecruitementOrg>();
|
|
while (oReader.Read())
|
|
{
|
|
RecruitementOrg obReOr = new RecruitementOrg();
|
|
MapRecruitementOrg(obReOr, oReader);
|
|
allRecruOrgs.Add(obReOr);
|
|
}
|
|
|
|
return allRecruOrgs;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Map RecruitementStep Object
|
|
|
|
private void MapRecruitementStep(RecruitementStep obRecStep, DataReader oReader)
|
|
{
|
|
SetObjectID(obRecStep, (oReader.GetInt32("RecruitementStepID").Value));
|
|
obRecStep.ProcessId = oReader.GetInt32("ProcessId").Value;
|
|
obRecStep.requisitionID = oReader.GetInt32("RequisitionID").Value;
|
|
|
|
obRecStep.StartDate = oReader.GetDateTime("StartDate").Value;
|
|
obRecStep.EndDate = oReader.GetDateTime("EndDate") == null
|
|
? DateTime.MinValue
|
|
: oReader.GetDateTime("EndDate").Value;
|
|
|
|
|
|
obRecStep.FullMark = oReader.GetDouble("FullMark").Value;
|
|
obRecStep.PassMark = oReader.GetDouble("PassMark").Value;
|
|
obRecStep.stepType = (EnumRecruitementStep)oReader.GetInt32("StepStatus");
|
|
|
|
obRecStep.StepSerial = oReader.GetInt32("stepSerial") == null ? 0 : oReader.GetInt32("stepSerial").Value;
|
|
obRecStep.TopSelect = oReader.GetDouble("TopSelect").Value;
|
|
obRecStep.AssesmentStatus = (EnumAssesmentStatus)oReader.GetInt32("AssesmentStatus");
|
|
|
|
this.SetObjectState(obRecStep, ObjectState.Saved);
|
|
}
|
|
|
|
private List<RecruitementStep> CreateRecruitementStepObjects(DataReader oReader)
|
|
{
|
|
List<RecruitementStep> allRecruSteps = new List<RecruitementStep>();
|
|
while (oReader.Read())
|
|
{
|
|
RecruitementStep obReStep = new RecruitementStep();
|
|
MapRecruitementStep(obReStep, oReader);
|
|
allRecruSteps.Add(obReStep);
|
|
}
|
|
|
|
return allRecruSteps;
|
|
}
|
|
|
|
private RecruitementStep CreateObjectRecruitmentStep(DataReader oReader)
|
|
{
|
|
RecruitementStep obRecProc = new RecruitementStep();
|
|
MapRecruitementStep(obRecProc, oReader);
|
|
return obRecProc;
|
|
}
|
|
|
|
private void MapInterviewStep(InterviewSession item, DataReader oReader)
|
|
{
|
|
SetObjectID(item, (oReader.GetInt32("InterviewSessionID").Value));
|
|
item.requitementStepID = oReader.GetInt32("requitementStepID").Value;
|
|
item.interviewDate = oReader.GetDateTime("interviewDate").Value;
|
|
|
|
item.StartTime = oReader.GetDateTime("StartTime").Value;
|
|
item.EndTime = oReader.GetDateTime("EndTime");
|
|
item.boardMemberSelfAssessment = oReader.GetBoolean("boardMemberSelfAssessment").Value;
|
|
item.SessionStatus = (EnumInterViewSesstionStatus)oReader.GetInt32("SessionStatus").Value;
|
|
|
|
|
|
item.Remarks = oReader.GetString("Remarks");
|
|
item.CreatedDate = oReader.GetDateTime("CreatedDate").Value;
|
|
item.CreatedBy = oReader.GetInt32("CreatedByID").Value;
|
|
|
|
item.ModifiedDate = oReader.GetDateTime("CreatedDate");
|
|
item.ModifiedBy = oReader.GetInt32("CreatedByID");
|
|
|
|
this.SetObjectState(item, ObjectState.Saved);
|
|
}
|
|
private List<InterviewSession> CreateInerveiwSessionsObjects(DataReader oReader)
|
|
{
|
|
List<InterviewSession> allRecruSteps = new List<InterviewSession>();
|
|
while (oReader.Read())
|
|
{
|
|
InterviewSession obReStep = new InterviewSession();
|
|
MapInterviewStep(obReStep, oReader);
|
|
allRecruSteps.Add(obReStep);
|
|
}
|
|
|
|
return allRecruSteps;
|
|
}
|
|
|
|
|
|
|
|
|
|
private void MapInterviewSessionCandidate(InterviewSessionCandidate item, DataReader oReader)
|
|
{
|
|
SetObjectID(item, (oReader.GetInt32("PKID").Value));
|
|
item.requitementStepID = oReader.GetInt32("requitementStepID").Value;
|
|
item.InterviewDateTime = oReader.GetDateTime("InterviewDateTime").Value;
|
|
item.InterViewSessionID = oReader.GetInt32("InterviewSessionID").Value;
|
|
item.CandidateID = oReader.GetInt32("CandidateID").Value;
|
|
item.isSelected = oReader.GetBoolean("isSelected").Value;
|
|
item.participate = oReader.GetBoolean("participate").Value;
|
|
item.cvid = oReader.GetInt32("cvid").Value;
|
|
item.positionName = oReader.GetString("PositionName",true,null);
|
|
|
|
item.remarks = oReader.GetString("Remarks");
|
|
item.CreatedDate = oReader.GetDateTime("CreatedDate").Value;
|
|
item.CreatedBy = oReader.GetInt32("CreatedByID").Value;
|
|
|
|
item.ModifiedDate = oReader.GetDateTime("CreatedDate");
|
|
item.ModifiedBy = oReader.GetInt32("CreatedByID");
|
|
|
|
this.SetObjectState(item, ObjectState.Saved);
|
|
}
|
|
private List<InterviewSessionCandidate> CreateInerveiwSessionCandidateObjects(DataReader oReader)
|
|
{
|
|
List<InterviewSessionCandidate> allRecruSteps = new List<InterviewSessionCandidate>();
|
|
while (oReader.Read())
|
|
{
|
|
InterviewSessionCandidate obReStep = new InterviewSessionCandidate();
|
|
MapInterviewSessionCandidate(obReStep, oReader);
|
|
allRecruSteps.Add(obReStep);
|
|
}
|
|
|
|
return allRecruSteps;
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#region Map BoardMember Object
|
|
|
|
private void MapBoardMember(BoardMember obBmember, DataReader oReader)
|
|
{
|
|
SetObjectID(obBmember, (oReader.GetInt32("BoardMemberID").Value));
|
|
obBmember.InterveiwSessionID = oReader.GetInt32("StepId").Value;
|
|
obBmember.EmployeeId = oReader.GetInt32("EmployeeId").Value;
|
|
obBmember.StepId = oReader.GetInt32("StepId").Value;
|
|
obBmember.ProcessId = oReader.GetInt32("ProcessId").Value;
|
|
obBmember.markEntryStatus = (EnumBaordMemberMarkEntryStatus)oReader.GetInt32("markEntryStatus").Value;
|
|
this.SetObjectState(obBmember, ObjectState.Saved);
|
|
}
|
|
|
|
private List<BoardMember> CreateBoardMemberObjects(DataReader oReader)
|
|
{
|
|
List<BoardMember> allMembers = new List<BoardMember>();
|
|
while (oReader.Read())
|
|
{
|
|
BoardMember obBMember = new BoardMember();
|
|
MapBoardMember(obBMember, oReader);
|
|
allMembers.Add(obBMember);
|
|
}
|
|
|
|
return allMembers;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Map MemberWiseMark Object
|
|
|
|
private void MapMemberWiseMark(MemberWiseMark obMemWisemark, DataReader oReader)
|
|
{
|
|
SetObjectID(obMemWisemark, (oReader.GetInt32("MemberWiseMarkID").Value));
|
|
obMemWisemark.ProcessId = oReader.GetInt32("ProcessId").Value;
|
|
obMemWisemark.InterveiwSessionID = oReader.GetInt32("InterviewSessionID").Value;
|
|
obMemWisemark.StepId = oReader.GetInt32("StepId").Value;
|
|
obMemWisemark.EmployeeId = oReader.GetInt32("EmployeeId").Value;
|
|
obMemWisemark.CandidateId = oReader.GetInt32("CandidateId").Value;
|
|
obMemWisemark.Marks = oReader.GetDouble("Marks").Value;
|
|
//obMemWisemark.IsSelected = oReader.GetBoolean("IsSelected").Value;
|
|
obMemWisemark.IsEmployee = oReader.GetBoolean("isEmployee").Value;
|
|
this.SetObjectState(obMemWisemark, ObjectState.Saved);
|
|
}
|
|
|
|
|
|
private List<MemberWiseMark> CreateMemberWiseMarkObjects(DataReader oReader)
|
|
{
|
|
List<MemberWiseMark> allMemberWiseMarks = new List<MemberWiseMark>();
|
|
while (oReader.Read())
|
|
{
|
|
MemberWiseMark obMemMarks = new MemberWiseMark();
|
|
MapMemberWiseMark(obMemMarks, oReader);
|
|
allMemberWiseMarks.Add(obMemMarks);
|
|
}
|
|
|
|
return allMemberWiseMarks;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Map Candidate Object
|
|
|
|
private void MapCandidate(Candidate obCandidate, DataReader oReader)
|
|
{
|
|
SetObjectID(obCandidate, (oReader.GetInt32("CandidateID").Value));
|
|
obCandidate.ProcessId = oReader.GetInt32("ProcessId", 0);
|
|
obCandidate.IsSelected = oReader.GetBoolean("IsSelected").Value;
|
|
obCandidate.IsEmployee = oReader.GetBoolean("IsEmployee").Value;
|
|
obCandidate.CvID = oReader.GetInt32("CvId", 0);
|
|
obCandidate.EmployeeId = oReader.GetInt32("EmployeeId", 0);
|
|
obCandidate.StartDate = oReader.GetDateTime("StartDate") == null
|
|
? DateTime.MinValue
|
|
: oReader.GetDateTime("StartDate").Value;
|
|
obCandidate.StartTime =
|
|
oReader.GetString("StartTime") == null ? String.Empty : oReader.GetString("StartTime");
|
|
this.SetObjectState(obCandidate, ObjectState.Saved);
|
|
}
|
|
|
|
|
|
private List<Candidate> CreateCandidateObjects(DataReader oReader)
|
|
{
|
|
List<Candidate> allCandidates = new List<Candidate>();
|
|
while (oReader.Read())
|
|
{
|
|
Candidate obCandidate = new Candidate();
|
|
MapCandidate(obCandidate, oReader);
|
|
allCandidates.Add(obCandidate);
|
|
}
|
|
|
|
return allCandidates;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Map SelectedCandidate Objects
|
|
|
|
private void MapSelectedCandidate(SelectedCandidate obSelectedCandidate, DataReader oReader)
|
|
{
|
|
SetObjectID(obSelectedCandidate, (oReader.GetInt32("PKID").Value));
|
|
obSelectedCandidate.IsEmployee = oReader.GetBoolean("isEmployee").Value;
|
|
obSelectedCandidate.ProcessId = oReader.GetInt32("processID", 0);
|
|
obSelectedCandidate.StepId = oReader.GetInt32("stepID", 0);
|
|
obSelectedCandidate.cvid = oReader.GetInt32("cvid").Value;
|
|
obSelectedCandidate.CandidateId = oReader.GetInt32("candidateID", 0);
|
|
obSelectedCandidate.IsSelected = oReader.GetBoolean("isSelected").Value;
|
|
this.SetObjectState(obSelectedCandidate, ObjectState.Saved);
|
|
}
|
|
|
|
private List<SelectedCandidate> CreateSelectedCandidateObjects(DataReader oReader)
|
|
{
|
|
List<SelectedCandidate> allSelectedCandidates = new List<SelectedCandidate>();
|
|
while (oReader.Read())
|
|
{
|
|
SelectedCandidate obCan = new SelectedCandidate();
|
|
MapSelectedCandidate(obCan, oReader);
|
|
allSelectedCandidates.Add(obCan);
|
|
}
|
|
|
|
return allSelectedCandidates;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Map RecruitmentType Objects
|
|
|
|
private void MapRecruitmentType(RecruitmentType obType, DataReader oReader)
|
|
{
|
|
SetObjectID(obType, (oReader.GetInt32("ID").Value));
|
|
obType.Name = oReader.GetString("name");
|
|
this.SetObjectState(obType, ObjectState.Saved);
|
|
}
|
|
|
|
private List<RecruitmentType> CreateRecruitmentTypeObjects(DataReader oReader)
|
|
{
|
|
List<RecruitmentType> allTypes = new List<RecruitmentType>();
|
|
while (oReader.Read())
|
|
{
|
|
RecruitmentType oType = new RecruitmentType();
|
|
MapRecruitmentType(oType, oReader);
|
|
allTypes.Add(oType);
|
|
}
|
|
|
|
return allTypes;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region Service Implementation
|
|
|
|
#region Save
|
|
|
|
public void Save(RecruitementProcess obRecrProc)
|
|
{
|
|
TransactionContext tc = null;
|
|
|
|
int oID = 0;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
if (obRecrProc.IsNew)
|
|
{
|
|
int id = tc.GenerateID("RecruitementProcess", "RecruitementProcessID");
|
|
oID = (id);
|
|
base.SetObjectID(obRecrProc, (id));
|
|
RecruitementProcessDA.Insert(obRecrProc, tc);
|
|
}
|
|
else
|
|
{
|
|
oID = obRecrProc.ID;
|
|
RecruitementProcessDA.Update(obRecrProc, tc);
|
|
}
|
|
|
|
|
|
|
|
#region RecruitementStep
|
|
|
|
|
|
foreach (RecruitementStep obRecrStep in obRecrProc.Steps)
|
|
{
|
|
if (obRecrStep.IsNew == true)
|
|
{
|
|
int recrStepId = 0;
|
|
int id = tc.GenerateID("RecruitementStep", "RecruitementStepID");
|
|
recrStepId = (id);
|
|
obRecrStep.ProcessId = oID;
|
|
base.SetObjectID(obRecrStep, (id));
|
|
RecruitementStepDA.Insert(obRecrStep, tc);
|
|
}
|
|
else
|
|
{
|
|
RecruitementStepDA.Update(obRecrStep, tc);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Save(RecruitementProcess obRecruProc, List<int> stepItemsToDelete)
|
|
|
|
//public void Save(RecruitementProcess obRecrProc, List<RecruitementStep> stepItemsToDelete)
|
|
//{
|
|
// TransactionContext tc = null;
|
|
// int oID = 0;
|
|
// try
|
|
// {
|
|
// tc = TransactionContext.Begin(true);
|
|
// if (obRecrProc.IsNew)
|
|
// {
|
|
// int id = tc.GenerateID("RecruitementProcess", "RecruitementProcessID");
|
|
// oID = (id);
|
|
// base.SetObjectID(obRecrProc, (id));
|
|
// RecruitementProcessDA.Insert(obRecrProc, tc);
|
|
// }
|
|
// else
|
|
// {
|
|
// oID = obRecrProc.ID;
|
|
// RecruitementProcessDA.Update(obRecrProc, tc);
|
|
// }
|
|
|
|
// #region RecruitementOrg
|
|
|
|
// //foreach (RecruitementOrg obRecrOrg in obRecrProc.AllRecruitementOrgs)
|
|
// //{
|
|
// // if (obRecrOrg.IsNew)
|
|
// // {
|
|
// // int id = tc.GenerateID("RecruitementOrg", "RecruitementOrgID");
|
|
// // obRecrOrg.ProcessId = oID;
|
|
// // base.SetObjectID(obRecrOrg, (id));
|
|
// // RecruitementOrgDA.Insert(obRecrOrg, tc);
|
|
// // }
|
|
// // else
|
|
// // {
|
|
// // RecruitementOrgDA.Update(obRecrOrg, tc);
|
|
// // }
|
|
// //}
|
|
|
|
// //CreatedRequisitionDA.Delete(tc, obRecrProc.ID);
|
|
// //foreach (CreatedRequisition item in obRecrProc.SelectedRequisitions)
|
|
// //{
|
|
// // int id = tc.GenerateID("CreatedRequisition", "CreatedRequisitionID");
|
|
// // base.SetObjectID(item, (id));
|
|
// // item.RecruitementProcessID = obRecrProc.ID;
|
|
// // CreatedRequisitionDA.Insert(tc, item);
|
|
// //}
|
|
|
|
// #endregion
|
|
|
|
// #region RecruitementStep
|
|
|
|
// foreach (RecruitementStep obRecrStep in stepItemsToDelete)
|
|
// {
|
|
// RecruitementSelectedCandidateDA.Delete(obRecrStep.ID, oID, tc);
|
|
// MemberWiseMarkDA.Delete(obRecrStep.ID, oID, tc);
|
|
// BoardMemberDA.Delete(oID, obRecrStep.ID, tc);
|
|
// RecruitementStepDA.Delete(oID, obRecrStep.ID, tc);
|
|
// }
|
|
|
|
// //foreach (RecruitementStep obRecrStep in obRecrProc.AllRecruitementSteps)
|
|
// //{
|
|
// // int recrStepId = 0;
|
|
// // if (obRecrStep.IsNew)
|
|
// // {
|
|
// // int id = tc.GenerateID("RecruitementStep", "RecruitementStepID");
|
|
// // recrStepId = (id);
|
|
// // obRecrStep.ProcessId = oID;
|
|
// // base.SetObjectID(obRecrStep, (id));
|
|
// // RecruitementStepDA.Insert(obRecrStep, tc);
|
|
|
|
// // //foreach (BoardMember obBm in obRecrStep.AllMembers)
|
|
// // //{
|
|
// // // int Id = tc.GenerateID("RecruitementBoardMember", "BoardMemberID");
|
|
// // // obBm.ProcessId = oID;
|
|
// // // obBm.StepId = recrStepId;
|
|
// // // base.SetObjectID(obBm, (Id));
|
|
// // // BoardMemberDA.Insert(obBm, tc);
|
|
// // //}
|
|
// // }
|
|
// // else
|
|
// // {
|
|
// // recrStepId = obRecrStep.ID;
|
|
// // RecruitementStepDA.Update(obRecrStep, tc);
|
|
// // DataReader oreader = new DataReader(BoardMemberDA.Get(tc, oID, recrStepId));
|
|
// // List<BoardMember> obmems = CreateBoardMemberObjects(oreader);
|
|
// // oreader.Close();
|
|
// // List<BoardMember> del = new List<BoardMember>();
|
|
// // List<BoardMember> insertItems = new List<BoardMember>();
|
|
// // foreach (var smember in obmems)
|
|
// // {
|
|
// // bool flag = true;
|
|
// // foreach (var tmember in obRecrStep.AllMembers)
|
|
// // {
|
|
// // if (smember.EmployeeId == tmember.EmployeeId)
|
|
// // {
|
|
// // flag = false;
|
|
// // break;
|
|
// // }
|
|
// // }
|
|
|
|
// // if (flag)
|
|
// // {
|
|
// // del.Add(smember);
|
|
// // }
|
|
// // }
|
|
|
|
// // foreach (var incomingmember in obRecrStep.AllMembers)
|
|
// // {
|
|
// // bool flag = true;
|
|
// // foreach (var smember in obmems)
|
|
// // {
|
|
// // if (smember.EmployeeId == incomingmember.EmployeeId)
|
|
// // {
|
|
// // flag = false;
|
|
// // break;
|
|
// // }
|
|
// // }
|
|
|
|
// // if (flag)
|
|
// // {
|
|
// // insertItems.Add(incomingmember);
|
|
// // }
|
|
// // }
|
|
|
|
// // foreach (var dmember in del)
|
|
// // {
|
|
// // MemberWiseMarkDA.Delete(obRecrProc.ID, obRecrStep.ID, dmember.EmployeeId, tc);
|
|
// // BoardMemberDA.Delete(oID, obRecrStep.ID, dmember.EmployeeId, tc);
|
|
// // }
|
|
|
|
// // foreach (var boardMember in insertItems)
|
|
// // {
|
|
// // int Id = tc.GenerateID("RecruitementBoardMember", "BoardMemberID");
|
|
// // base.SetObjectID(boardMember, (Id));
|
|
// // boardMember.ProcessId = oID;
|
|
// // boardMember.StepId = obRecrStep.ID;
|
|
// // BoardMemberDA.Insert(boardMember, tc);
|
|
// // }
|
|
// // }
|
|
|
|
// // //
|
|
// //}
|
|
|
|
// #endregion
|
|
|
|
|
|
// tc.End();
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// #region Handle Exception
|
|
|
|
// if (tc != null)
|
|
// tc.HandleError();
|
|
// ExceptionLog.Write(ex);
|
|
// throw new ServiceException(ex.Message, ex);
|
|
|
|
// #endregion
|
|
// }
|
|
//}
|
|
|
|
#endregion
|
|
|
|
#region void SaveRecruitementStep(RecruitementStep step, int processID, int stepID)
|
|
|
|
public InterviewSession SaveInterviewSession(InterviewSession intrSession)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
|
|
if (intrSession.interviewDate.Day != intrSession.StartTime.Day)
|
|
{
|
|
intrSession.StartTime = new DateTime(intrSession.interviewDate.Year, intrSession.interviewDate.Month
|
|
, intrSession.interviewDate.Day, intrSession.StartTime.Hour, intrSession.StartTime.Minute, 0);
|
|
|
|
}
|
|
if (intrSession.IsNew)
|
|
{
|
|
int id = tc.GenerateID("InterviewSession", "InterviewSessionID");
|
|
base.SetObjectID(intrSession, (id));
|
|
InterviewSessionDA.Insert(intrSession, tc);
|
|
|
|
}
|
|
else
|
|
{
|
|
InterviewSessionDA.Update(intrSession, tc);
|
|
}
|
|
|
|
foreach (BoardMember obmem in intrSession.BoadMembers)
|
|
{
|
|
obmem.InterveiwSessionID = intrSession.ID;
|
|
obmem.StepId = intrSession.requitementStepID;
|
|
if (intrSession.boardMemberSelfAssessment == true)
|
|
{
|
|
obmem.markEntryStatus = EnumBaordMemberMarkEntryStatus.Permission_Given;
|
|
|
|
}
|
|
|
|
int id = tc.GenerateID("RECRUITEMENTBOARDMEMBER", "BoardMemberID");
|
|
base.SetObjectID(obmem, (id));
|
|
BoardMemberDA.Insert(obmem, tc);
|
|
}
|
|
|
|
foreach (InterviewSessionCandidate obmem in intrSession.Candidates)
|
|
{
|
|
obmem.InterViewSessionID = intrSession.ID;
|
|
obmem.requitementStepID = intrSession.requitementStepID;
|
|
obmem.InterviewDateTime = intrSession.StartTime;
|
|
obmem.CreatedBy = intrSession.CreatedBy;
|
|
obmem.CreatedDate = DateTime.Now;
|
|
obmem.ModifiedBy = intrSession.CreatedBy;
|
|
obmem.CreatedDate = DateTime.Now;
|
|
if (obmem.IsNew)
|
|
{
|
|
int id = tc.GenerateID("InterViewSessionCandidate", "PKID");
|
|
base.SetObjectID(obmem, (id));
|
|
InterviewSessionDA.InsertInterViewSessionCandidate(obmem, tc);
|
|
}
|
|
else
|
|
{
|
|
InterviewSessionDA.UpdateInterViewSessionCandidate(obmem, tc);
|
|
}
|
|
}
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
return intrSession;
|
|
}
|
|
|
|
public void UpdateBoardMemberMark(InterviewSession intrSession)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
|
|
|
|
foreach (MemberWiseMark obmem in intrSession.BoadMemberWiseMarks)
|
|
{
|
|
obmem.InterveiwSessionID = intrSession.ID;
|
|
if (obmem.IsNew == true)
|
|
{
|
|
int id = tc.GenerateID("RecruitementMemberWiseMark", "MemberWiseMarkID");
|
|
base.SetObjectID(obmem, (id));
|
|
MemberWiseMarkDA.Insert(obmem, tc);
|
|
}
|
|
}
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
public void UpdateStepSelectedCandidates(RecruitementStep step)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
|
|
|
|
foreach (SelectedCandidate obmem in step.SelectedCandidates)
|
|
{
|
|
obmem.StepId = step.ID;
|
|
if (obmem.IsNew == true)
|
|
{
|
|
int id = tc.GenerateID("RecruitementMemberWiseMark", "MemberWiseMarkID");
|
|
base.SetObjectID(obmem, (id));
|
|
RecruitementSelectedCandidateDA.Insert(obmem, tc);
|
|
}
|
|
else
|
|
{
|
|
// RecruitementSelectedCandidateDA.up(obmem, tc);
|
|
|
|
}
|
|
}
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region List<RecruitementProcess>Get()
|
|
|
|
public List<RecruitementProcess> Get()
|
|
{
|
|
List<RecruitementProcess> allProcess = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(RecruitementProcessDA.Get(tc));
|
|
allProcess = this.CreateObjects<RecruitementProcess>(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return allProcess;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region List< RecruitementStep > Get(int processID)
|
|
|
|
public List<RecruitementStep> Get(int processID)
|
|
{
|
|
List<RecruitementStep> allSteps = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(RecruitementStepDA.Get(tc, processID));
|
|
allSteps = CreateRecruitementStepObjects(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return allSteps;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region List< RecruitementStep > GetByAssesmentStatus(int nAssesmentStatus)
|
|
|
|
public List<RecruitementStep> GetByAssesmentStatus(int nAssesmentStatus, int nEmpID)
|
|
{
|
|
List<RecruitementStep> allSteps = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader =
|
|
new DataReader(RecruitementStepDA.GetByAssesmentStatus(tc, nAssesmentStatus, nEmpID));
|
|
allSteps = CreateRecruitementStepObjects(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return allSteps;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region List< BoardMember > GetBoardMembers(int processID,int stepID)
|
|
|
|
public List<BoardMember> GetBoardMembers(int processID, int stepID)
|
|
{
|
|
List<BoardMember> allMems = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(BoardMemberDA.Get(tc, processID, stepID));
|
|
allMems = CreateBoardMemberObjects(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return allMems;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region GetByProcessId(int procID)
|
|
|
|
|
|
|
|
|
|
public RecruitementProcess GetByRequisitionID(int requisitionID)
|
|
{
|
|
List<RecruitementProcess> allProcess = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(RecruitementProcessDA.GetByRequisitionID(tc, requisitionID));
|
|
allProcess = this.CreateObjects<RecruitementProcess>(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
if (allProcess.Count == 1)
|
|
{
|
|
return allProcess[0];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
public RecruitementProcess GetByProcessId(int procID)
|
|
{
|
|
List<RecruitementProcess> allProcess = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(RecruitementProcessDA.GetByProcessId(tc, procID));
|
|
allProcess = this.CreateObjects<RecruitementProcess>(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
if (allProcess.Count == 1)
|
|
{
|
|
return allProcess[0];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
public RecruitementStep GetRStep(int recruitementid, int stepSerial)
|
|
{
|
|
List<RecruitementStep> allProcess = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(RecruitementStepDA.GetRStep(tc, recruitementid, stepSerial));
|
|
allProcess = CreateRecruitementStepObjects(oreader);
|
|
oreader.Close();
|
|
if (allProcess.Count == 1)
|
|
{
|
|
RecruitementStep item = allProcess[0];
|
|
oreader = new DataReader(RecruitementSelectedCandidateDA.GetSelectedCandidates(allProcess[0].ID, tc));
|
|
item.SelectedCandidates = CreateSelectedCandidateObjects(oreader);
|
|
oreader.Close();
|
|
|
|
oreader = new DataReader(InterviewSessionDA.getSessionByStepID(tc, allProcess[0].ID));
|
|
item.InterviewSessions = CreateInerveiwSessionsObjects(oreader);
|
|
oreader.Close();
|
|
}
|
|
|
|
|
|
tc.End();
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
|
|
if (allProcess.Count == 1)
|
|
{
|
|
return allProcess[0];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
public RecruitementStep GetRStep(int stepID)
|
|
{
|
|
List<RecruitementStep> allProcess = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(RecruitementStepDA.GetRStep(tc, stepID));
|
|
allProcess = CreateRecruitementStepObjects(oreader);
|
|
oreader.Close();
|
|
if (allProcess.Count == 1)
|
|
{
|
|
RecruitementStep item = allProcess[0];
|
|
oreader = new DataReader(RecruitementSelectedCandidateDA.GetSelectedCandidates(stepID, tc));
|
|
item.SelectedCandidates = CreateSelectedCandidateObjects(oreader);
|
|
oreader.Close();
|
|
|
|
oreader = new DataReader(InterviewSessionDA.getSessionByStepID(tc, stepID));
|
|
item.InterviewSessions = CreateInerveiwSessionsObjects(oreader);
|
|
oreader.Close();
|
|
}
|
|
|
|
tc.End();
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
if (allProcess.Count == 1)
|
|
{
|
|
return allProcess[0];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
#region List< Candidate > GetCanditates(int processID)
|
|
|
|
public List<Candidate> GetCanditates(int processID)
|
|
{
|
|
List<Candidate> allCans = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(CandidateDA.GetCanditates(tc, processID));
|
|
allCans = CreateCandidateObjects(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return allCans;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region List< Candidate > GetCanditates(int processID, int assessmentStatus, int logInID)
|
|
|
|
public List<Candidate> GetCanditates(int processID, int assessmentStatus, int logInID)
|
|
{
|
|
List<Candidate> allCans = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader =
|
|
new DataReader(CandidateDA.GetCanditates(tc, processID, assessmentStatus, logInID));
|
|
allCans = CreateCandidateObjects(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return allCans;
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
public Candidate GetByCandediateID(int nCandidateID)
|
|
{
|
|
List<Candidate> allCandidate = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(RecruitementProcessDA.GetByCandediateID(tc, nCandidateID));
|
|
allCandidate = CreateCandidateObjects(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
if (allCandidate.Count >= 1)
|
|
{
|
|
return allCandidate[0];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
|
|
#region void SaveCandidatesToProcess(int processID, List<Candidate> allCans)
|
|
|
|
public void SaveCandidatesToProcess(int processID, List<Candidate> allCans)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
List<Candidate> allCandidates = null;
|
|
DataReader oreader = new DataReader(CandidateDA.GetCanditates(tc, processID));
|
|
allCandidates = CreateCandidateObjects(oreader);
|
|
oreader.Close();
|
|
List<Candidate> finalCansForOtherDelition = new List<Candidate>();
|
|
|
|
foreach (var obcan in allCandidates)
|
|
{
|
|
bool flag = false;
|
|
foreach (var tarcan in allCans)
|
|
{
|
|
if (obcan.IsEmployee && tarcan.IsEmployee && obcan.ProcessId == tarcan.ProcessId &&
|
|
obcan.EmployeeId == tarcan.EmployeeId)
|
|
{
|
|
flag = true;
|
|
break;
|
|
}
|
|
|
|
if (!obcan.IsEmployee && !tarcan.IsEmployee && obcan.ProcessId == tarcan.ProcessId &&
|
|
obcan.CvID == tarcan.CvID)
|
|
{
|
|
flag = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!flag)
|
|
{
|
|
finalCansForOtherDelition.Add(obcan);
|
|
}
|
|
}
|
|
|
|
foreach (var src in finalCansForOtherDelition)
|
|
{
|
|
if (src.IsEmployee)
|
|
{
|
|
MemberWiseMarkDA.Delete(processID, (int)src.EmployeeId, src.IsEmployee, tc);
|
|
RecruitementSelectedCandidateDA.Delete(processID, (int)src.EmployeeId, src.IsEmployee, tc);
|
|
}
|
|
else
|
|
{
|
|
MemberWiseMarkDA.Delete(processID, src.CvID, src.IsEmployee, tc);
|
|
RecruitementSelectedCandidateDA.Delete(processID, src.CvID, src.IsEmployee, tc);
|
|
}
|
|
}
|
|
|
|
CandidateDA.Delete(tc, processID);
|
|
foreach (Candidate candidate in allCans)
|
|
{
|
|
int id = tc.GenerateID("RecruitementCandidate", "CandidateID");
|
|
candidate.ProcessId = processID;
|
|
base.SetObjectID(candidate, (id));
|
|
CandidateDA.Insert(candidate, tc);
|
|
}
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region void Delete(RecruitementProcess obRecruProc)
|
|
|
|
public void DeleteStep(int stepID)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
RecruitementStepDA.Delete(stepID, tc);
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region List< MemberWiseMark > Get(int stepID, int processID)
|
|
|
|
|
|
public List<InterviewSessionCandidate> getSessionActiveCandidatesByStepID(int stepID)
|
|
{
|
|
List<InterviewSessionCandidate> items = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
DataReader oreader = new DataReader(InterviewSessionDA.getSessionActiveCandidatesByStepID(tc, stepID));
|
|
items = CreateInerveiwSessionCandidateObjects(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return items;
|
|
}
|
|
public List<MemberWiseMark> GetmemberWiseMarkBySetpID(int stepID)
|
|
{
|
|
List<MemberWiseMark> allMarks = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
DataReader oreader = new DataReader(MemberWiseMarkDA.Get(stepID, tc));
|
|
allMarks = CreateMemberWiseMarkObjects(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return allMarks;
|
|
}
|
|
|
|
|
|
public List<MemberWiseMark> GetmemberWiseMarkBySessionID(int sessionID)
|
|
{
|
|
List<MemberWiseMark> allMarks = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
DataReader oreader = new DataReader(MemberWiseMarkDA.GetmemberWiseMarkBySessionID(sessionID, tc));
|
|
allMarks = CreateMemberWiseMarkObjects(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return allMarks;
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region SaveMemberWiseMark(List< MemberWiseMark > allmemMarks, int processID, int stepID)
|
|
|
|
public void SaveMemberWiseMark(InterviewSession session)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
|
|
tc = TransactionContext.Begin(true);
|
|
MemberWiseMarkDA.Delete(session.ID, tc);
|
|
|
|
foreach (InterviewSessionCandidate obmem in session.Candidates)
|
|
{
|
|
InterviewSessionDA.UpdateInterViewSessionCandidateSelection(obmem, tc);
|
|
if(obmem.isSelected== false)
|
|
{
|
|
if (session.Step == null)
|
|
{
|
|
session.Step = this.GetRStep(session.requitementStepID);
|
|
}
|
|
InternalRecruitment recruitment = new InternalRecruitmentService().Get(session.Step.requisitionID);
|
|
var status = "Discarded from" + session.Step.getStepName()+ " by Department. Position: " + recruitment.PositionName + " Date: " + recruitment.PositionDate.ToString("dd-MM-yyyy");
|
|
CVDA.UpdateCandidateLastStatus(status, obmem.CandidateID, tc);
|
|
}
|
|
}
|
|
|
|
foreach (MemberWiseMark obmem in session.BoadMemberWiseMarks)
|
|
{
|
|
int id = tc.GenerateID("RecruitementMemberWiseMark", "MemberWiseMarkID");
|
|
base.SetObjectID(obmem, (id));
|
|
MemberWiseMarkDA.Insert(obmem, tc);
|
|
}
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
|
|
public void CompleteMembersMarkByMember(InterviewSession session)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
|
|
// Find Board Member
|
|
BoardMember obm = session.BoadMembers.FirstOrDefault(x => x.EmployeeId == session.BoadMemberWiseMarks[0].EmployeeId);
|
|
obm.InterveiwSessionID = session.ID;
|
|
obm.StepId = session.BoadMemberWiseMarks[0].StepId;
|
|
obm.ProcessId = session.BoadMemberWiseMarks[0].ProcessId;
|
|
obm.markEntryStatus = EnumBaordMemberMarkEntryStatus.Entry_Completed;
|
|
BoardMemberDA.Update(obm, tc);
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
public void SaveMembersMarkByMember(InterviewSession session)
|
|
{
|
|
InterviewSession isession = this.GetInterveiwSession(session.ID);
|
|
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
|
|
foreach (MemberWiseMark obmem in session.BoadMemberWiseMarks)
|
|
{
|
|
bool IsNew = true;
|
|
if (isession.BoadMemberWiseMarks != null)
|
|
{
|
|
IsNew = !isession.BoadMemberWiseMarks.Any(x => x.EmployeeId == obmem.EmployeeId && x.CandidateId == obmem.CandidateId);
|
|
}
|
|
if (IsNew == true)
|
|
{
|
|
int id = tc.GenerateID("RecruitementMemberWiseMark", "MemberWiseMarkID");
|
|
base.SetObjectID(obmem, (id));
|
|
MemberWiseMarkDA.Insert(obmem, tc);
|
|
}
|
|
else
|
|
{
|
|
MemberWiseMarkDA.Update(obmem, tc);
|
|
}
|
|
}
|
|
// Find Board Member
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
public void CompleteInterviewSession(InterviewSession item)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
foreach (InterviewSessionCandidate obmem in item.Candidates)
|
|
{
|
|
InterviewSessionDA.UpdateInterViewSessionCandidateSelection(obmem, tc);
|
|
}
|
|
InterviewSessionDA.CompleteInterviewSession(item.ID, tc);
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
|
|
public void CompleteRecruitementStep(RecruitementStep item)
|
|
{
|
|
TransactionContext tc = null;
|
|
List<RecruitementStep> obs = new List<RecruitementStep>();
|
|
obs = new RecruitementProcessService().GetRecruitementSteps(item.requisitionID);
|
|
var recJobItem = new RecJobTrackingService().GetByRecruitmentId(item.requisitionID);
|
|
try
|
|
{
|
|
List<InterviewSessionCandidate> selectedCandiates = this.GetSessionsSelectedCandiates(item.ID);
|
|
tc = TransactionContext.Begin(true);
|
|
RecruitementStepDA.CompleteRecruitementStep(item.ID, tc);
|
|
|
|
int id = tc.GenerateID("RECRUITEMENTSELECTEDCANDIDATE", "PKID");
|
|
foreach (InterviewSessionCandidate obmem in selectedCandiates)
|
|
{
|
|
SelectedCandidate cnt = new SelectedCandidate();
|
|
cnt.CandidateId = obmem.CandidateID;
|
|
cnt.RecruitementID = item.requisitionID;
|
|
cnt.StepId = item.ID;
|
|
cnt.ProcessId = item.ProcessId;
|
|
cnt.CreatedDate = DateTime.Today;
|
|
cnt.CreatedBy = item.CreatedBy;
|
|
base.SetObjectID(cnt, (id));
|
|
RecruitementSelectedCandidateDA.Insert(cnt, tc);
|
|
id = id + 1;
|
|
}
|
|
if (obs != null && obs.Count > 0)
|
|
{
|
|
var maxSerial = obs.MaxBy(x => x.StepSerial);
|
|
if (maxSerial != null && recJobItem != null)
|
|
{
|
|
if (maxSerial.StepSerial == item.StepSerial && recJobItem.ActualInterviewEndDate == null)
|
|
{
|
|
RecJobTrackingDA.UpdateActualInterviewEndDate(tc, item.requisitionID);
|
|
}
|
|
}
|
|
if (maxSerial != null && maxSerial.StepSerial == item.StepSerial)
|
|
{
|
|
InternalRecruitmentDA.UpdateRecruitmentOnBoardStatus(tc, item.requisitionID, EnumOnBoradStatus.InterviewCompleted);
|
|
}
|
|
}
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#region List < SelectedCandidate > GetAllSelectedCandidates
|
|
|
|
public List<SelectedCandidate> GetAllSelectedCandidates(int processID, int stepID, bool flag)
|
|
{
|
|
List<SelectedCandidate> allSelectedCans = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader =
|
|
new DataReader(RecruitementSelectedCandidateDA.GetAllSelectedCandidates(processID, stepID, tc));
|
|
allSelectedCans = this.CreateSelectedCandidateObjects(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return allSelectedCans;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get AllSelectedCandidates
|
|
|
|
public List<SelectedCandidate> GetSelectedCandidates(int processID, int stepID, bool flag)
|
|
{
|
|
TransactionContext tc = null;
|
|
List<SelectedCandidate> allSeleCans = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
DataReader oreader =
|
|
new DataReader(
|
|
RecruitementSelectedCandidateDA.GetAllSelectedCandidates(processID, stepID, flag, tc));
|
|
allSeleCans = CreateSelectedCandidateObjects(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return allSeleCans;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get AllSelectedCandidates
|
|
|
|
public List<SelectedCandidate> GetSelectedCandidates(int processID, int stepID)
|
|
{
|
|
TransactionContext tc = null;
|
|
List<SelectedCandidate> allSeleCans = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
DataReader oreader =
|
|
new DataReader(RecruitementSelectedCandidateDA.GetAllSelectedCandidates(processID, stepID, tc));
|
|
allSeleCans = CreateSelectedCandidateObjects(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return allSeleCans;
|
|
}
|
|
|
|
public void RescheduleInterViewSession(InterviewSession item)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
|
|
InterviewSessionDA.UpdateRescheduleDate(item, tc);
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
public void CancelInterViewSession(InterviewSession item)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
|
|
InterviewSessionDA.Delete(item.ID, tc);
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
public void SendMailInThread(InterviewSession session)
|
|
{
|
|
Thread myNewThread = new Thread(() => SendMail(session));
|
|
myNewThread.Start();
|
|
}
|
|
public void SendMail(InterviewSession session)
|
|
{
|
|
MailSender sender = null;
|
|
EmailSettings st = new EmailSettings();
|
|
|
|
if (session.Step == null)
|
|
{
|
|
session.Step = this.GetRStep(session.requitementStepID);
|
|
}
|
|
InternalRecruitment rq = new InternalRecruitmentService().Get(session.Step.requisitionID);
|
|
|
|
try
|
|
{
|
|
var builder = new ConfigurationBuilder()
|
|
.SetBasePath(Directory.GetCurrentDirectory())
|
|
.AddJsonFile("appsettings.json");
|
|
|
|
IConfiguration Configuration = builder.Build();
|
|
Configuration.GetSection("EmailSettings").Bind(st);
|
|
sender = new MailSender();
|
|
|
|
|
|
//Send Email With Link
|
|
foreach (InterviewSessionCandidate candidate in session.Candidates)
|
|
{
|
|
Thread.Sleep(200);
|
|
string sbody = "";
|
|
|
|
|
|
if (candidate.cv.Email == null || candidate.cv.Email == string.Empty) continue;
|
|
|
|
sender = new MailSender();
|
|
sender.AddTo(candidate.cv.Email.Trim());
|
|
sbody = session.candidateMailtext;
|
|
sbody = sbody.Replace("<<Candidate_Name>>", candidate.cv.Name);
|
|
sbody = sbody.Replace("<<Session_Name>>", session.Step.getStepName());
|
|
sbody = sbody.Replace("<<Session_Date>>", session.interviewDate.ToString("dd MMM yyyy"));
|
|
sbody = sbody.Replace("<<Session_Time>>", session.StartTime.ToString("hh:mm tt"));
|
|
sbody = sbody.Replace("<<Position_Name>>", rq.PositionName);
|
|
|
|
sbody = sbody.Replace("\n", "<br/>");
|
|
|
|
|
|
sender.Body = sbody;
|
|
|
|
sender.Link = "";
|
|
sender.Subject = rq.PositionName + " " + session.Step.getStepName() + " Date";
|
|
sender.SendMail(st);
|
|
}
|
|
|
|
foreach (BoardMember item in session.BoadMembers)
|
|
{
|
|
Thread.Sleep(200);
|
|
string sbody = "";
|
|
sbody = session.boardMemberMailtext;
|
|
|
|
if (item.employee.EmployeeEmail == null || item.employee.EmployeeEmail == string.Empty) continue;
|
|
sbody = sbody.Replace("<<Candidate_Name>>", item.employee.Name);
|
|
sbody = sbody.Replace("<<Session_Name>>", session.Step.getStepName());
|
|
sbody = sbody.Replace("<<Session_Date>>", session.interviewDate.ToString("dd MMM yyyy"));
|
|
sbody = sbody.Replace("<<Session_Time>>", session.StartTime.ToString("hh:mm tt"));
|
|
sbody = sbody.Replace("<<Position_Name>>", rq.PositionName);
|
|
sbody = sbody.Replace("\n", "<br/>");
|
|
sender = new MailSender();
|
|
sender.AddTo(item.employee.EmployeeEmail.Trim());
|
|
sender.Body = sbody;
|
|
|
|
sender.Link = "";
|
|
sender.Subject = rq.PositionName + " " + session.Step.getStepName() + " Date";
|
|
sender.SendMail(st);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//throw new ServiceException(ex.Message);
|
|
// throw new CustomException(EnumExceptionType.Informational, "Successfully submitted but system could not send E-mail. You do not need to submit it again.");
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public List<InterviewSessionCandidate> GetSessionsSelectedCandiates(int stepID)
|
|
{
|
|
TransactionContext tc = null;
|
|
List<InterviewSessionCandidate> allSeleCans = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
DataReader oreader =
|
|
new DataReader(InterviewSessionDA.getselectedSessionsCandidates(tc, stepID));
|
|
allSeleCans = CreateInerveiwSessionCandidateObjects(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return allSeleCans;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get Type
|
|
|
|
public List<RecruitmentType> GetRecruitmentType()
|
|
{
|
|
TransactionContext tc = null;
|
|
List<RecruitmentType> allTypes = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
DataReader oreader = new DataReader(RecruitmentTypeDA.Get(tc));
|
|
allTypes = CreateRecruitmentTypeObjects(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return allTypes;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get Type
|
|
|
|
public RecruitmentType GetType(int id)
|
|
{
|
|
TransactionContext tc = null;
|
|
List<RecruitmentType> allTypes = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
DataReader oreader = new DataReader(RecruitmentTypeDA.GetType(tc, id));
|
|
allTypes = CreateRecruitmentTypeObjects(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
if (allTypes.Count == 1)
|
|
{
|
|
return allTypes[0];
|
|
}
|
|
else return null;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region DataSet GetShortListedCandidates(int processID)
|
|
|
|
public DataSet GetShortListedCandidates(int processID)
|
|
{
|
|
TransactionContext tc = null;
|
|
DataSet ds = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
|
|
ds = RecruitementProcessDA.GetShortListedCandidates(processID, tc);
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return ds;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region RecruitementStep GetRecruitmentStep(int processID, int serial)
|
|
|
|
public RecruitementStep GetRecruitmentStep(int processID, int serial)
|
|
{
|
|
TransactionContext tc = null;
|
|
List<RecruitementStep> allSteps = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(RecruitementStepDA.Get(processID, serial, tc));
|
|
allSteps = CreateRecruitementStepObjects(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
if (allSteps.Count == 1)
|
|
{
|
|
return allSteps[0];
|
|
}
|
|
else return null;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region RecruitementStep GetRecruitmentStep(int processID, int stepID)
|
|
|
|
public RecruitementStep GetRecruitmentStepWithStepID(int processID, int stepID)
|
|
{
|
|
TransactionContext tc = null;
|
|
List<RecruitementStep> allSteps = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(RecruitementStepDA.Get(processID, stepID, tc));
|
|
allSteps = CreateRecruitementStepObjects(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
if (allSteps.Count == 1)
|
|
{
|
|
return allSteps[0];
|
|
}
|
|
else return null;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region RecruitementStep GetRecruitmentStep(int processID, int StepStatus, int assessmentStatus)
|
|
|
|
public RecruitementStep GetRecruitmentStep(int processID, int StepStatus, int assessmentStatus)
|
|
{
|
|
TransactionContext tc = null;
|
|
List<RecruitementStep> allSteps = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader =
|
|
new DataReader(RecruitementStepDA.Get(processID, StepStatus, assessmentStatus, tc));
|
|
allSteps = CreateRecruitementStepObjects(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
if (allSteps.Count == 1)
|
|
{
|
|
return allSteps[0];
|
|
}
|
|
else return null;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region UpdateStep
|
|
|
|
public void UpdateStep(RecruitementStep obStep)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
RecruitementStepDA.Update(obStep, tc);
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
public void UpdateInterviewStartDate(InterviewSession session)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
if (session.Step == null)
|
|
{
|
|
session.Step = this.GetRStep(session.requitementStepID);
|
|
}
|
|
InternalRecruitment rq = new InternalRecruitmentService().Get(session.Step.requisitionID);
|
|
if (session.Step != null)
|
|
{
|
|
if (session.Step.StepSerial == 1)
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
var recJobTracking = new RecJobTrackingService().GetByRecruitmentId(tc, session.Step.requisitionID);
|
|
if (recJobTracking != null)
|
|
{
|
|
if (recJobTracking.ActualInterviewStartDate == null)
|
|
{
|
|
RecJobTrackingDA.UpdateInterViewStartDate(tc, session.Step.requisitionID);
|
|
}
|
|
}
|
|
tc.End();
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region List< RecruitementStep > GetAllSteps(int processID)
|
|
|
|
|
|
public InterviewSession GetInterveiwSession(int interviewSessionID)
|
|
{
|
|
TransactionContext tc = null;
|
|
InterviewSession item = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(InterviewSessionDA.GetinterviewSession(interviewSessionID, tc));
|
|
List<InterviewSession> items = CreateInerveiwSessionsObjects(oreader);
|
|
oreader.Close();
|
|
if (items.Count > 0)
|
|
{
|
|
item = items[0];
|
|
oreader = new DataReader(BoardMemberDA.Get(tc, item.ID));
|
|
item.BoadMembers = CreateBoardMemberObjects(oreader);
|
|
oreader.Close();
|
|
|
|
oreader = new DataReader(InterviewSessionDA.getInterviewSessionCandidates(tc, item.ID));
|
|
item.Candidates = CreateInerveiwSessionCandidateObjects(oreader);
|
|
oreader.Close();
|
|
|
|
oreader = new DataReader(MemberWiseMarkDA.GetmemberWiseMarkBySessionID(item.ID, tc));
|
|
item.BoadMemberWiseMarks = CreateMemberWiseMarkObjects(oreader);
|
|
oreader.Close();
|
|
}
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return item;
|
|
}
|
|
|
|
public InterviewSession GetInterveiwSessionReport(int interviewSessionID)
|
|
{
|
|
TransactionContext tc = null;
|
|
InterviewSession item = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(InterviewSessionDA.GetinterviewSession(interviewSessionID, tc));
|
|
List<InterviewSession> items = CreateInerveiwSessionsObjects(oreader);
|
|
oreader.Close();
|
|
if (items.Count > 0)
|
|
{
|
|
item = items[0];
|
|
oreader = new DataReader(RecruitementStepDA.GetRecruitmentStep(tc, item.requitementStepID));
|
|
if (oreader.Read())
|
|
{
|
|
item.Step = CreateObjectRecruitmentStep(oreader);
|
|
}
|
|
oreader.Close();
|
|
|
|
//oreader = new DataReader(BoardMemberDA.Get(tc, item.ID));
|
|
//item.BoadMembers = CreateBoardMemberObjects(oreader);
|
|
//oreader.Close();
|
|
|
|
oreader = new DataReader(InterviewSessionDA.getInterviewSessionCandidatesReport(tc, item.ID));
|
|
item.Candidates = CreateInerveiwSessionCandidateObjects(oreader);
|
|
oreader.Close();
|
|
|
|
//oreader = new DataReader(MemberWiseMarkDA.GetmemberWiseMarkBySessionID(item.ID, tc));
|
|
//item.BoadMemberWiseMarks = CreateMemberWiseMarkObjects(oreader);
|
|
//oreader.Close();
|
|
}
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return item;
|
|
}
|
|
public List<InterviewSession> GetInterveiwSessions(int requisitionID)
|
|
{
|
|
TransactionContext tc = null;
|
|
List<InterviewSession> allSteps = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(InterviewSessionDA.GetinterviewSessions(requisitionID, tc));
|
|
allSteps = CreateInerveiwSessionsObjects(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return allSteps;
|
|
}
|
|
|
|
public DataTable GetInterveiwSessionsByBoardMember(int employeeid, EnumBaordMemberMarkEntryStatus MarkEntrystatus)
|
|
{
|
|
TransactionContext tc = null;
|
|
List<InterviewSession> allSteps = null;
|
|
DataTable otable = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
//DataReader oreader = new DataReader(InterviewSessionDA.GetInterveiwSessionsByBoardMember(employeeid, MarkEntrystatus , tc));
|
|
//allSteps = CreateInerveiwSessionsObjects(oreader);
|
|
//oreader.Close();
|
|
otable = InterviewSessionDA.GetInterveiwSessionsByBoardMember(employeeid, MarkEntrystatus, tc);
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return otable;
|
|
}
|
|
|
|
public List<RecruitementStep> GetRecruitementSteps(int RequisitionID)
|
|
{
|
|
TransactionContext tc = null;
|
|
List<RecruitementStep> allSteps = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(RecruitementStepDA.GetRecruitementSteps(RequisitionID, tc));
|
|
allSteps = CreateRecruitementStepObjects(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return allSteps;
|
|
}
|
|
|
|
public List<RecruitementStep> GetRecruitementStepsWithSession(int RequisitionID)
|
|
{
|
|
TransactionContext tc = null;
|
|
List<RecruitementStep> allSteps = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(RecruitementStepDA.GetRecruitementSteps(RequisitionID, tc));
|
|
allSteps = CreateRecruitementStepObjects(oreader);
|
|
oreader.Close();
|
|
if (allSteps.Count > 0)
|
|
{
|
|
oreader = new DataReader(InterviewSessionDA.GetinterviewSessionByRequisitionID(RequisitionID, tc));
|
|
List<InterviewSession> items = CreateInerveiwSessionsObjects(oreader);
|
|
oreader.Close();
|
|
if (items.Count > 0)
|
|
{
|
|
foreach (RecruitementStep item in allSteps)
|
|
{
|
|
item.InterviewSessions = items.FindAll(x => x.requitementStepID == item.ID);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return allSteps;
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region public static void UpdateProcess(RecruitementProcess obProcess)
|
|
|
|
public void UpdateProcess(RecruitementProcess obProcess)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
RecruitementProcessDA.Update(obProcess, tc);
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region RecruitementProcess CheckCode(string code)
|
|
|
|
public RecruitementProcess CheckCode(string code)
|
|
{
|
|
List<RecruitementProcess> allProcess = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(RecruitementProcessDA.CheckCode(tc, code));
|
|
allProcess = this.CreateObjects<RecruitementProcess>(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
if (allProcess.Count >= 1)
|
|
{
|
|
return allProcess[0];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region GetProcess
|
|
|
|
public RecruitementProcess GetProcess(int status)
|
|
{
|
|
List<RecruitementProcess> allProcess = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(RecruitementProcessDA.GetProcess(tc, status));
|
|
allProcess = this.CreateObjects<RecruitementProcess>(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
if (allProcess.Count >= 1)
|
|
{
|
|
return allProcess[0];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region GetProcess
|
|
|
|
public RecruitementProcess GetProcess(int status, int empID)
|
|
{
|
|
List<RecruitementProcess> allProcess = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(RecruitementProcessDA.GetProcess(tc, status, empID));
|
|
allProcess = this.CreateObjects<RecruitementProcess>(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
if (allProcess.Count >= 1)
|
|
{
|
|
return allProcess[0];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region GetProcess
|
|
|
|
public RecruitementProcess GetProcess(int processID, int stepID, int empID)
|
|
{
|
|
List<RecruitementProcess> allProcess = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(RecruitementProcessDA.GetProcess(tc, processID, stepID, empID));
|
|
allProcess = this.CreateObjects<RecruitementProcess>(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
if (allProcess.Count >= 1)
|
|
{
|
|
return allProcess[0];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region GetProcess
|
|
|
|
public RecruitementProcess GetProcessID(int status, int empID, int stepID)
|
|
{
|
|
List<RecruitementProcess> allProcess = null;
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(RecruitementProcessDA.GetProcessID(tc, status, empID, stepID));
|
|
allProcess = this.CreateObjects<RecruitementProcess>(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
if (allProcess.Count >= 1)
|
|
{
|
|
return allProcess[0];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region List< RecruitementProcess > GetProcesses(string query)
|
|
|
|
public List<RecruitementProcess> GetProcesses(string query)
|
|
{
|
|
TransactionContext tc = null;
|
|
List<RecruitementProcess> allProcesses = null;
|
|
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
DataReader oreader = new DataReader(RecruitementProcessDA.Get(query, tc));
|
|
allProcesses = this.CreateObjects<RecruitementProcess>(oreader);
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return allProcesses;
|
|
}
|
|
|
|
public List<CandidateAverageMarkSummary> GetCandidateAverageMarks(string candidateIds)
|
|
{
|
|
TransactionContext tc = null;
|
|
List<CandidateAverageMarks> candidateAvgMarks = null;
|
|
List<CandidateAverageMarkSummary> candidateAvgMarksSummary = new List<CandidateAverageMarkSummary>();
|
|
DataSet ds = new DataSet();
|
|
CandidateAverageMarks tempItem = null;
|
|
var candidateIdList = candidateIds.Split(',').Select(Int32.Parse).ToList();
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
ds = RecruitementStepDA.GetCandidateAverageMarks(tc, candidateIds);
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
candidateAvgMarks = new List<CandidateAverageMarks>();
|
|
foreach (DataRow Dr in ds.Tables[0].Rows)
|
|
{
|
|
tempItem = new CandidateAverageMarks();
|
|
tempItem.CandidateID = Convert.ToInt32(Dr["CandidateID"].ToString());
|
|
tempItem.StepStatus = (EnumRecruitementStep)Convert.ToInt16(Dr["StepStatus"].ToString());
|
|
tempItem.StepStatusString = EnumDescription.GetEnumDescription(tempItem.StepStatus);
|
|
tempItem.AverageMarks = Dr["AverageMarks"] is DBNull ? 0 : Convert.ToDouble(Dr["AverageMarks"].ToString());
|
|
candidateAvgMarks.Add(tempItem);
|
|
}
|
|
}
|
|
|
|
if (candidateAvgMarks != null && candidateAvgMarks.Count > 0)
|
|
{
|
|
foreach (var item in candidateIdList)
|
|
{
|
|
var existItem = candidateAvgMarksSummary.Where(c => c.CandidateID == item)?.FirstOrDefault();
|
|
if (existItem == null)
|
|
{
|
|
CandidateAverageMarkSummary temp = new CandidateAverageMarkSummary();
|
|
temp.CandidateID = item;
|
|
var vivaMarks = candidateAvgMarks.Where(c => c.CandidateID == item && c.StepStatus == EnumRecruitementStep.Viva)?.FirstOrDefault()?.AverageMarks;
|
|
if (vivaMarks != null)
|
|
{
|
|
temp.StepAvgMarks = "Viva: " + vivaMarks;
|
|
}
|
|
else
|
|
{
|
|
temp.StepAvgMarks = "Viva: " + "0.0";
|
|
}
|
|
var writtenMarks = candidateAvgMarks.Where(c => c.CandidateID == item && c.StepStatus == EnumRecruitementStep.Written)?.FirstOrDefault()?.AverageMarks;
|
|
if (writtenMarks != null)
|
|
{
|
|
temp.StepAvgMarks = temp.StepAvgMarks + ", Written: " + writtenMarks;
|
|
}
|
|
else
|
|
{
|
|
temp.StepAvgMarks = temp.StepAvgMarks + ", Written: " + "0.0";
|
|
}
|
|
candidateAvgMarksSummary.Add(temp);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return candidateAvgMarksSummary;
|
|
}
|
|
|
|
#region public static void UpdateInterviewAssesmentMark(RecruitementProcess obProcess)
|
|
|
|
public void UpdateInterviewAssesmentMark(RecruitmentMarkExtend obProcess)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
RecruitementProcessDA.UpdateRecruitmentMark(obProcess, tc);
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
public List<CandidateMarksDetails> GetCandidateMarksDetails(int candidateId)
|
|
{
|
|
TransactionContext tc = null;
|
|
List<CandidateMarksDetails> candidateAvgMarks = null;
|
|
DataSet ds = new DataSet();
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
ds = RecruitementStepDA.GetCandidateMarksDetails(tc, candidateId);
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
candidateAvgMarks = new List<CandidateMarksDetails>();
|
|
foreach (DataRow Dr in ds.Tables[0].Rows)
|
|
{
|
|
var tempItem = new CandidateMarksDetails();
|
|
tempItem.EmployeeName = Dr["Name"] is DBNull ? null : Dr["Name"].ToString();
|
|
tempItem.CadidateId = Convert.ToInt32(Dr["CandidateID"].ToString());
|
|
tempItem.EmployeeId = Convert.ToInt32(Dr["EmployeeId"].ToString());
|
|
tempItem.StepId = Convert.ToInt32(Dr["StepId"].ToString());
|
|
tempItem.Marks = Convert.ToDouble(Dr["Marks"].ToString());
|
|
tempItem.StepStatus = (EnumRecruitementStep)Convert.ToInt16(Dr["StepStatus"].ToString());
|
|
tempItem.StepStatusString = EnumDescription.GetEnumDescription(tempItem.StepStatus);
|
|
tempItem.Marks = Dr["Marks"] is DBNull ? 0 : Convert.ToDouble(Dr["Marks"].ToString());
|
|
candidateAvgMarks.Add(tempItem);
|
|
}
|
|
}
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return candidateAvgMarks;
|
|
}
|
|
|
|
public DataTable GetInterViewInforBycandidateId(int jobId, int candidateId)
|
|
{
|
|
TransactionContext tc = null;
|
|
DataTable otable = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
otable = InterviewSessionDA.GetInterViewInforBycandidateId(candidateId, jobId, tc);
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(ex);
|
|
throw new ServiceException(ex.Message, ex);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return otable;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
}
|
|
}
|