5088 lines
178 KiB
C#
5088 lines
178 KiB
C#
|
using Ease.Core;
|
|||
|
using Ease.Core.DataAccess;
|
|||
|
using Ease.Core.Model;
|
|||
|
using Ease.Core.Utility;
|
|||
|
using HRM.BO;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data;
|
|||
|
using System.Linq;
|
|||
|
|
|||
|
namespace HRM.DA
|
|||
|
{
|
|||
|
public class HREmployeeService : ServiceTemplate, IHREmployeeService
|
|||
|
{
|
|||
|
#region Private functions and declaration
|
|||
|
|
|||
|
public HREmployeeService()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Object Mapping
|
|||
|
|
|||
|
#region parent object mapping
|
|||
|
|
|||
|
#region HREmployee Mapping
|
|||
|
|
|||
|
private void MapObject(HREmployee oHREmployee, DataReader oReader)
|
|||
|
{
|
|||
|
this.SetObjectID(oHREmployee, oReader.GetInt32("EmployeeID").Value);
|
|||
|
oHREmployee.EmployeeNo = oReader.GetString("EmployeeNo");
|
|||
|
oHREmployee.FirstName = oReader.GetString("FirstName");
|
|||
|
oHREmployee.MiddleName = oReader.GetString("MiddleName");
|
|||
|
oHREmployee.LastName = oReader.GetString("LastName");
|
|||
|
oHREmployee.NickName = oReader.GetString("ShortName");
|
|||
|
oHREmployee.Name = oReader.GetString("Name");
|
|||
|
//oHREmployee. = (oReader.GetInt32("SBUID"));
|
|||
|
oHREmployee.LocationID = oReader.GetInt32("LOCATIONID");
|
|||
|
oHREmployee.LineManagerID = oReader.GetInt32("linemanagerid");
|
|||
|
oHREmployee.DepartmentID = oReader.GetInt32("DEPARTMENTID");
|
|||
|
oHREmployee.FatherName = oReader.GetString("FATHERNAME");
|
|||
|
oHREmployee.MotherName = oReader.GetString("MotherName");
|
|||
|
oHREmployee.FatherNameBangla = oReader.GetString("FatherNameBangla", true, null);
|
|||
|
oHREmployee.MotherNameBangla = oReader.GetString("MotherNameBangla", true, null);
|
|||
|
oHREmployee.FatherOccupationID = oReader.GetInt32("FatherOccupationID", 0);
|
|||
|
oHREmployee.MotherOccupationID = oReader.GetInt32("MotherOccupationID", 0);
|
|||
|
oHREmployee.NationalityID = oReader.GetInt32("NationalityID");
|
|||
|
oHREmployee.BirthDate = oReader.GetDateTime("BirthDate").Value;
|
|||
|
oHREmployee.OfficialBirthDate = oReader.GetDateTime("BirthDate").Value;
|
|||
|
oHREmployee.BanglaName = oReader.GetString("BanglaName", null);
|
|||
|
oHREmployee.Height = oReader.GetString("Height");
|
|||
|
|
|||
|
//oHREmployee.BirthDate = oReader.GetDateTime("ORIGINALBIRTHDATE").HasValue ? oReader.GetDateTime("ORIGINALBIRTHDATE").Value:DateTime.Now;
|
|||
|
oHREmployee.BirthPlace = oReader.GetString("BirthPlace");
|
|||
|
oHREmployee.Gender = (EnumGender)oReader.GetInt32("Gender");
|
|||
|
oHREmployee.ReligionID = oReader.GetInt32("ReligionID").Value;
|
|||
|
oHREmployee.GradeID = oReader.GetInt32("GradeID");
|
|||
|
oHREmployee.DesignationID = oReader.GetInt32("DesignationID");
|
|||
|
oHREmployee.CategoryID = oReader.GetInt32("CATEGORYID").Value;
|
|||
|
oHREmployee.FunctionID = oReader.GetInt32("FunctionID", 0);
|
|||
|
oHREmployee.CompanyID = oReader.GetInt32("CompanyID");
|
|||
|
oHREmployee.BloodGroup = (EnumBloodGroup)oReader.GetInt32("BloodGroup").Value;
|
|||
|
oHREmployee.PassportNo = oReader.GetString("PassportNo");
|
|||
|
oHREmployee.TinNo = oReader.GetString("TINNO");
|
|||
|
oHREmployee.NationalID = oReader.GetString("NationalID");
|
|||
|
//oHREmployee.PhotoPath = oReader.GetString("PHOTOGRAPH");
|
|||
|
//oHREmployee.PhotoPath = oReader.GetString("PhotoPath");
|
|||
|
oHREmployee.JoiningDate = oReader.GetDateTime("JoiningDate").Value;
|
|||
|
oHREmployee.BranchID = oReader.GetInt32("BranchID").HasValue ? oReader.GetInt32("BranchID").Value : null;
|
|||
|
//DateTime? RetirementDateValue = oReader.GetDateTime("RetirementDate");
|
|||
|
//oHREmployee.RetirementDate = RetirementDateValue.HasValue ? RetirementDateValue.Value : null;
|
|||
|
//oHREmployee.DiscontinueDate = oReader.GetDateTime("DATEOFEXPIRY").HasValue ? oReader.GetDateTime("DATEOFEXPIRY").Value : (DateTime?)null;
|
|||
|
oHREmployee.Signature = oReader.GetString("EMPSIGNATURE");
|
|||
|
oHREmployee.Status = (EnumEmployeeStatus)oReader.GetInt32("Status");
|
|||
|
oHREmployee.IsConfirmed = oReader.GetBoolean("ISCONFIRMED").Value;
|
|||
|
oHREmployee.MaritalStatus = (EnumMaritalStatus)oReader.GetInt32("MARITALSTATUSID");
|
|||
|
oHREmployee.PayrollTypeID = oReader.GetInt32("PAYROLLTYPEID").Value;
|
|||
|
oHREmployee.DesktopUserPass = oReader.GetString("DESKTOPUSERPASS");
|
|||
|
oHREmployee.EmailAddress = oReader.GetString("EMAILADDRESS");
|
|||
|
oHREmployee.BasicSalary = oReader.GetDouble("BasicSalary").Value;
|
|||
|
oHREmployee.GrossSalary = oReader.GetDouble("GrossSalary").Value;
|
|||
|
oHREmployee.BirthPlace = oReader.GetString("BirthPlace");
|
|||
|
oHREmployee.GlobalID = oReader.GetString("GlobalID");
|
|||
|
//oHREmployee.OneviewID = oReader.GetString("OneviewID");
|
|||
|
//oHREmployee.PFMemberShiptDate = oReader.GetDateTime("PFAuditDate").Value;
|
|||
|
//oHREmployee.EndOfContractDate = oReader.GetDateTime("DATEOFEXPIRY").HasValue ? oReader.GetDateTime("DATEOFEXPIRY").Value : (DateTime?)null;
|
|||
|
oHREmployee.ConfirDate = oReader.GetDateTime("DATEOFCONFIRMATION").HasValue
|
|||
|
? oReader.GetDateTime("DATEOFCONFIRMATION").Value
|
|||
|
: DateTime.MinValue;
|
|||
|
//oHREmployee.AdloginID = oReader.GetID("ADLogInID");
|
|||
|
oHREmployee.DrivingLicenceNo = oReader.GetString("DrivingLicenceNo");
|
|||
|
oHREmployee.PassportIssuePlace = oReader.GetString("PassportIssuePlace");
|
|||
|
//oHREmployee.PassportIssueDate =
|
|||
|
// oReader.GetDateTime("PassportIssueDate").GetValueOrDefault(DateTime.MinValue);
|
|||
|
|
|||
|
DateTime? passportIssueDateValue = oReader.GetDateTime("PassportIssueDate");
|
|||
|
oHREmployee.PassportIssueDate = passportIssueDateValue.HasValue ? passportIssueDateValue.Value : null;
|
|||
|
|
|||
|
//oHREmployee.PassportExpDate = oReader.GetDateTime("PassportExpDate").GetValueOrDefault(DateTime.MinValue);
|
|||
|
|
|||
|
DateTime? PassportExpDateValue = oReader.GetDateTime("PassportExpDate");
|
|||
|
oHREmployee.PassportIssueDate = PassportExpDateValue.HasValue ? PassportExpDateValue.Value : null;
|
|||
|
|
|||
|
oHREmployee.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus", 0);
|
|||
|
//oHREmployee.Role = (EnumRole)oReader.GetInt32("Role").Value;
|
|||
|
oHREmployee.FileNo = oReader.GetString("FileNo");
|
|||
|
oHREmployee.MobileNo = oReader.GetString("MOBILENO");
|
|||
|
oHREmployee.GeId = oReader.GetString("GeId", true, string.Empty);
|
|||
|
oHREmployee.ExtraField1 = oReader.GetString("ExtraField1", true, string.Empty);
|
|||
|
oHREmployee.ExtraField2 = (EnumBaseStation)oReader.GetInt32("ExtraField2", true, 0);
|
|||
|
oHREmployee.ExtraField3 = oReader.GetString("ExtraField3", true, string.Empty);
|
|||
|
oHREmployee.ExtraField4 = oReader.GetString("ExtraField4", true, string.Empty);
|
|||
|
oHREmployee.ExtraField5 = oReader.GetString("ExtraField5", true, string.Empty);
|
|||
|
oHREmployee.VendorCode = oReader.GetString("VendorCode");
|
|||
|
oHREmployee.CrgId = oReader.GetInt32("CrgId").GetValueOrDefault();
|
|||
|
//oHREmployee.ProfileComplitionPercent = oReader.GetInt32("ProfileComplitionPercent", 0);
|
|||
|
oHREmployee.InsuranceId = oReader.GetString("InsuranceId", true, string.Empty);
|
|||
|
oHREmployee.InclusionDate = oReader.GetDateTime("InclusionDate").GetValueOrDefault(DateTime.MinValue);
|
|||
|
//oHREmployee.SBU = oReader.GetString("SBU", true, string.Empty);
|
|||
|
oHREmployee.SpouseNameBangla = oReader.GetString("SpouseNameBangla", true, string.Empty);
|
|||
|
oHREmployee.SpouseName = oReader.GetString("SpouseName", true, string.Empty);
|
|||
|
this.SetObjectState(oHREmployee, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
protected override T CreateObject<T>(DataReader oReader)
|
|||
|
{
|
|||
|
HREmployee oHREmployee = new HREmployee();
|
|||
|
MapObject(oHREmployee, oReader);
|
|||
|
return oHREmployee as T;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region children object mappping
|
|||
|
|
|||
|
#region Spouse object mapping
|
|||
|
|
|||
|
private void MapEmpSpouseObject(EmpSpouse oEmpSpouse, DataReader oReader)
|
|||
|
{
|
|||
|
oEmpSpouse.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
this.SetObjectID(oEmpSpouse, oReader.GetInt32("SpouseID").Value);
|
|||
|
oEmpSpouse.Name = oReader.GetString("Name");
|
|||
|
oEmpSpouse.Nameinbangla = oReader.GetString("nameinbangla", true, null);
|
|||
|
oEmpSpouse.MarriageDate = Convert.ToDateTime(oReader.GetString("MarriageDate"));
|
|||
|
oEmpSpouse.OccupationID = oReader.GetInt32("OccupationID", 0);
|
|||
|
oEmpSpouse.EducationLevelID = oReader.GetInt32("EducationLevelID", 0);
|
|||
|
oEmpSpouse.PassportNo = oReader.GetString("PassportNo");
|
|||
|
oEmpSpouse.PassportIssuePlace = oReader.GetString("PassportIssuePlace");
|
|||
|
//oEmpSpouse.PassportIssueDate = oReader.GetDateTime("PassportIssueDate").GetValueOrDefault(DateTime.MinValue);
|
|||
|
//oEmpSpouse.PassportExpDate = oReader.GetDateTime("PassportExpDate").GetValueOrDefault(DateTime.MinValue);
|
|||
|
oEmpSpouse.PassportIssueDate =
|
|||
|
Convert.ToDateTime(oReader.GetDateTime("PassportIssueDate").GetValueOrDefault(DateTime.MinValue));
|
|||
|
oEmpSpouse.PassportExpDate =
|
|||
|
Convert.ToDateTime(oReader.GetDateTime("PassportExpDate").GetValueOrDefault(DateTime.MinValue));
|
|||
|
//oEmpSpouse.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").Value;
|
|||
|
oEmpSpouse.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").GetValueOrDefault();
|
|||
|
oEmpSpouse.InsuranceId = oReader.GetString("InsuranceId", true, string.Empty);
|
|||
|
oEmpSpouse.InclusionDate = oReader.GetDateTime("InclusionDate").GetValueOrDefault(DateTime.MinValue);
|
|||
|
oEmpSpouse.DateOfBirth = oReader.GetDateTime("DateOfBirth").GetValueOrDefault(DateTime.MinValue);
|
|||
|
|
|||
|
this.SetObjectState(oEmpSpouse, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private void MapEmpCreditCardObject(EmpCreditCard oEmpCreditCard, DataReader oReader)
|
|||
|
{
|
|||
|
this.SetObjectID(oEmpCreditCard, oReader.GetInt32("EmpCreditCardID").Value);
|
|||
|
oEmpCreditCard.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
oEmpCreditCard.UserType = (EnumCardUserType)oReader.GetInt32("UserType");
|
|||
|
oEmpCreditCard.UserTypeID = oReader.GetInt32("UserTypeID", 0);
|
|||
|
oEmpCreditCard.CardNo = oReader.GetString("CardNo");
|
|||
|
oEmpCreditCard.CardName = oReader.GetString("CardName");
|
|||
|
oEmpCreditCard.BankID = oReader.GetInt32("BankID", 0);
|
|||
|
oEmpCreditCard.CardLimit = Convert.ToDouble(oReader.GetString("CardLimit"));
|
|||
|
oEmpCreditCard.CardExpiryDate = oReader.GetDateTime("CardExpiryDate").Value;
|
|||
|
oEmpCreditCard.TIN = oReader.GetString("TIN");
|
|||
|
oEmpCreditCard.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").GetValueOrDefault();
|
|||
|
|
|||
|
this.SetObjectState(oEmpCreditCard, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpSpouse CreateEmpSpouseObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpSpouse spouse = new EmpSpouse();
|
|||
|
MapEmpSpouseObject(spouse, oReader);
|
|||
|
return spouse;
|
|||
|
}
|
|||
|
|
|||
|
private EmpCreditCard CreateEmpCreditCardObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpCreditCard creditCard = new EmpCreditCard();
|
|||
|
MapEmpCreditCardObject(creditCard, oReader);
|
|||
|
return creditCard;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpSpouse> CreateEmpSpouses(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpSpouse> oEmpSpouses = new List<EmpSpouse>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpSpouse item = CreateEmpSpouseObject(oReader);
|
|||
|
oEmpSpouses.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpSpouses;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpCreditCard> CreateEmpCreditCard(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpCreditCard> oEmpCreditCard = new List<EmpCreditCard>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpCreditCard item = CreateEmpCreditCardObject(oReader);
|
|||
|
oEmpCreditCard.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpCreditCard;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpContact object mapping
|
|||
|
|
|||
|
private void MapEmpContactObject(EmpContact oEmpContact, DataReader oReader)
|
|||
|
{
|
|||
|
oEmpContact.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
this.SetObjectID(oEmpContact, oReader.GetInt32("ContactID").Value);
|
|||
|
oEmpContact.PermanentAddress = oReader.GetString("ParmanentAddress");
|
|||
|
oEmpContact.PermanentAddressInBangla = oReader.GetString("PermanentAddressInBangla", null);
|
|||
|
oEmpContact.PermanentPostCodeNo = oReader.GetString("PermanentPostCodeNo", null);
|
|||
|
oEmpContact.PermanentDistrictID = oReader.GetInt32("ParmanentDistrictID", 0);
|
|||
|
oEmpContact.PermanentThanaID = oReader.GetInt32("ParmanentThanaID", 0);
|
|||
|
oEmpContact.PermanentTelephone = oReader.GetString("ParmanentTelephone");
|
|||
|
oEmpContact.PermanentMobile = oReader.GetString("ParmanentMobile"); // Kalam
|
|||
|
oEmpContact.PresentAddress = oReader.GetString("PresentAddress");
|
|||
|
oEmpContact.PresentAddressInBangla = oReader.GetString("PresentAddressInBangla", null);
|
|||
|
oEmpContact.PresentPostCodeNo = oReader.GetString("PresentPostCodeNo", null);
|
|||
|
oEmpContact.PresentDistrictID = oReader.GetInt32("PresentDistrictID", 0);
|
|||
|
oEmpContact.PresentThanaID = oReader.GetInt32("PresentThanaID", 0);
|
|||
|
oEmpContact.PresentTelephone = oReader.GetString("PresentTelephone");
|
|||
|
oEmpContact.PresentMobile = oReader.GetString("PresentMobile"); // Kalam
|
|||
|
oEmpContact.Mobile = oReader.GetString("Mobile");
|
|||
|
oEmpContact.PersonalTelephone = oReader.GetString("PersonalTelephone"); // Kalam
|
|||
|
oEmpContact.PersonalEmail = oReader.GetString("PersonalEmail");
|
|||
|
oEmpContact.OfficalEmail = oReader.GetString("OfficialEMail");
|
|||
|
oEmpContact.Fax = oReader.GetString("Fax");
|
|||
|
oEmpContact.EmergencyContactAddress = oReader.GetString("EmergencyContactAddress");
|
|||
|
oEmpContact.EmergencyContactPerson = oReader.GetString("EmergencyContactPerson");
|
|||
|
oEmpContact.EmergencyTelephone = oReader.GetString("EmergencyTelephone");
|
|||
|
oEmpContact.EmergencyMobile = oReader.GetString("EmergencyMobile"); // Kalam
|
|||
|
oEmpContact.ContactPersonRelationId = oReader.GetInt32("CPRelationID", 0);
|
|||
|
oEmpContact.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").GetValueOrDefault();
|
|||
|
oEmpContact.PresentPOInBangla = oReader.GetString("PresentPOInBangla", true, null);
|
|||
|
oEmpContact.ParmanentPOInBangla = oReader.GetString("ParmanentPOInBangla", true, null);
|
|||
|
this.SetObjectState(oEmpContact, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpContact CreateContactObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpContact contact = new EmpContact();
|
|||
|
MapEmpContactObject(contact, oReader);
|
|||
|
return contact;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpContact> CreateEmpContactObjects(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpContact> oEmpContacts = new List<EmpContact>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpContact item = CreateContactObject(oReader);
|
|||
|
oEmpContacts.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpContacts;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpChildren Mapping
|
|||
|
|
|||
|
private void MapEmpChildrenObject(EmpChildren oEmpChildren, DataReader oReader)
|
|||
|
{
|
|||
|
oEmpChildren.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
this.SetObjectID(oEmpChildren, oReader.GetInt32("ChildID").Value);
|
|||
|
oEmpChildren.Name = oReader.GetString("Name");
|
|||
|
oEmpChildren.Gender = (EnumGender)oReader.GetInt16("Gender");
|
|||
|
oEmpChildren.BirthDate = Convert.ToDateTime(oReader.GetString("BirthDate"));
|
|||
|
oEmpChildren.MaritalStatus = (EnumMaritalStatus)oReader.GetInt32("MaritalStatus");
|
|||
|
oEmpChildren.OccupationID = oReader.GetInt32("OccupationID", 0);
|
|||
|
oEmpChildren.PassportNo = oReader.GetString("PassportNo");
|
|||
|
oEmpChildren.PassportIssuePlace = oReader.GetString("PassportIssuePlace");
|
|||
|
//oEmpChildren.PassportIssueDate = oReader.GetDateTime("PassportIssueDate").GetValueOrDefault(DateTime.MinValue);
|
|||
|
//oEmpChildren.PassportExpDate = oReader.GetDateTime("PassportExpDate").GetValueOrDefault(DateTime.MinValue);
|
|||
|
//oEmpChildren.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").Value;
|
|||
|
int? profileStatusValue = oReader.GetInt32("ProfileStatus");
|
|||
|
oEmpChildren.ProfileStatus = profileStatusValue.HasValue ? (EnumProfileStatus)profileStatusValue.Value : EnumProfileStatus.Inserted_By_Employee;
|
|||
|
|
|||
|
oEmpChildren.PassportIssueDate = oReader.GetDateTime("PassportIssueDate");
|
|||
|
// Convert.ToDateTime(oReader.GetDateTime("PassportIssueDate").GetValueOrDefault(DateTime.MinValue));
|
|||
|
oEmpChildren.PassportExpDate = oReader.GetDateTime("PassportExpDate");
|
|||
|
oEmpChildren.InsuranceId = oReader.GetString("InsuranceId", true, string.Empty);
|
|||
|
oEmpChildren.InclusionDate = oReader.GetDateTime("InclusionDate").GetValueOrDefault(DateTime.MinValue);
|
|||
|
// Convert.ToDateTime(oReader.GetDateTime("PassportExpDate").GetValueOrDefault(DateTime.MinValue));
|
|||
|
|
|||
|
this.SetObjectState(oEmpChildren, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpChildren CreateChildrenObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpChildren child = new EmpChildren();
|
|||
|
MapEmpChildrenObject(child, oReader);
|
|||
|
return child;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpChildren> CreateEmpChildrenObjects(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpChildren> oEmpChildrens = new List<EmpChildren>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpChildren item = CreateChildrenObject(oReader);
|
|||
|
oEmpChildrens.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpChildrens;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpPublication Mapping
|
|||
|
|
|||
|
private void MapEmpPublicationObject(EmpPublication oEmpPublication, DataReader oReader)
|
|||
|
{
|
|||
|
oEmpPublication.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
this.SetObjectID(oEmpPublication, oReader.GetInt32("PublicationID").Value);
|
|||
|
oEmpPublication.Title = oReader.GetString("Title");
|
|||
|
oEmpPublication.Description = oReader.GetString("Description");
|
|||
|
//oEmpPublication.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").Value;
|
|||
|
|
|||
|
int? profileStatusValue = oReader.GetInt32("ProfileStatus");
|
|||
|
oEmpPublication.ProfileStatus = profileStatusValue.HasValue ? (EnumProfileStatus)profileStatusValue.Value : EnumProfileStatus.Inserted_By_Employee;
|
|||
|
|
|||
|
oEmpPublication.Remarks = oReader.GetString("Remarks");
|
|||
|
oEmpPublication.PublicationDate = Convert.ToDateTime(oReader.GetString("PublicationDate"));
|
|||
|
oEmpPublication.PublicationType = oReader.GetString("PUBLICATIONTYPE");
|
|||
|
oEmpPublication.PublishersName = oReader.GetString("PUBLISHERSNAME");
|
|||
|
|
|||
|
this.SetObjectState(oEmpPublication, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpPublication CreateEmpPublicationObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpPublication publication = new EmpPublication();
|
|||
|
MapEmpPublicationObject(publication, oReader);
|
|||
|
return publication;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpPublication> CreateEmpPublicationObjects(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpPublication> oEmpPublications = new List<EmpPublication>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpPublication item = CreateEmpPublicationObject(oReader);
|
|||
|
oEmpPublications.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpPublications;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpReference Mapping
|
|||
|
|
|||
|
private void MapEmpReferenceObject(EmpReference oEmpReference, DataReader oReader)
|
|||
|
{
|
|||
|
oEmpReference.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
this.SetObjectID(oEmpReference, oReader.GetInt32("ReferenceID").Value);
|
|||
|
oEmpReference.Name = oReader.GetString("Name");
|
|||
|
oEmpReference.OccupationID = oReader.GetInt32("OccupationID", 0);
|
|||
|
oEmpReference.Address = oReader.GetString("Address");
|
|||
|
oEmpReference.Telephone = oReader.GetString("Telephone");
|
|||
|
oEmpReference.ReferenceMobile = oReader.GetString("ReferenceMobile");
|
|||
|
oEmpReference.EmailAddress = oReader.GetString("EmailAddress");
|
|||
|
oEmpReference.RelationID = oReader.GetInt32("RelationID", 0);
|
|||
|
//oEmpReference.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").Value;
|
|||
|
oEmpReference.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus", true, 0);
|
|||
|
|
|||
|
this.SetObjectState(oEmpReference, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpReference CreateEmpReferenceObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpReference reference = new EmpReference();
|
|||
|
MapEmpReferenceObject(reference, oReader);
|
|||
|
return reference;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpReference> CreateEmpReferenceObjects(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpReference> oEmpReferences = new List<EmpReference>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpReference item = CreateEmpReferenceObject(oReader);
|
|||
|
oEmpReferences.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpReferences;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpExperience Mapping
|
|||
|
|
|||
|
private void MapEmpExperienceObject(EmpExperience oEmpExperience, DataReader oReader)
|
|||
|
{
|
|||
|
oEmpExperience.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
this.SetObjectID(oEmpExperience, oReader.GetInt32("ExperienceID").Value);
|
|||
|
|
|||
|
oEmpExperience.Employer = oReader.GetString("Employer");
|
|||
|
oEmpExperience.ContactPerson = oReader.GetString("ContactPerson");
|
|||
|
oEmpExperience.Address = oReader.GetString("Address");
|
|||
|
|
|||
|
oEmpExperience.Telephone = oReader.GetString("Telephone");
|
|||
|
oEmpExperience.EmployerActivity = oReader.GetString("EmployerActivity");
|
|||
|
oEmpExperience.Designation = oReader.GetString("Designation");
|
|||
|
|
|||
|
oEmpExperience.JobDescription = oReader.GetString("JobDescription");
|
|||
|
oEmpExperience.FromDate = Convert.ToDateTime(oReader.GetString("FromDate"));
|
|||
|
oEmpExperience.ToDate = Convert.ToDateTime(oReader.GetString("ToDate"));
|
|||
|
oEmpExperience.TillDate = Convert.ToDateTime(oReader.GetString("TODATE"));
|
|||
|
|
|||
|
//DateTime? FromDateValue = oReader.GetDateTime("FromDate");
|
|||
|
//oEmpExperience.FromDate = FromDateValue.HasValue ? FromDateValue.Value : null;
|
|||
|
//DateTime? ToDateValue = oReader.GetDateTime("ToDate");
|
|||
|
//oEmpExperience.FromDate = ToDateValue.HasValue ? ToDateValue.Value : null;
|
|||
|
//oEmpExperience.TillDate = ToDateValue.HasValue ? ToDateValue.Value : null;
|
|||
|
|
|||
|
oEmpExperience.LastJob = Convert.ToInt32(oReader.GetString("LastJob")) == 0 ? false : true;
|
|||
|
//oEmpExperience.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").Value;
|
|||
|
|
|||
|
int? profileStatusValue = oReader.GetInt32("ProfileStatus");
|
|||
|
oEmpExperience.ProfileStatus = profileStatusValue.HasValue ? (EnumProfileStatus)profileStatusValue.Value : EnumProfileStatus.Inserted_By_Employee;
|
|||
|
|
|||
|
|
|||
|
oEmpExperience.HasAttachment = oReader.GetBoolean("HasAttachment", true, false);
|
|||
|
|
|||
|
this.SetObjectState(oEmpExperience, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpExperience CreateEmpExperienceObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpExperience experience = new EmpExperience();
|
|||
|
MapEmpExperienceObject(experience, oReader);
|
|||
|
return experience;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpExperience> CreateEmpExperienceObjects(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpExperience> oEmpExperiences = new List<EmpExperience>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpExperience item = CreateEmpExperienceObject(oReader);
|
|||
|
oEmpExperiences.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpExperiences;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpTraining Mapping
|
|||
|
|
|||
|
private void MapEmpTrainingObject(EmpTraining oEmpTraining, DataReader oReader)
|
|||
|
{
|
|||
|
oEmpTraining.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
this.SetObjectID(oEmpTraining, oReader.GetInt32("EmpTrainingID").Value);
|
|||
|
|
|||
|
oEmpTraining.Name = oReader.GetString("Name");
|
|||
|
oEmpTraining.Description = oReader.GetString("Description");
|
|||
|
oEmpTraining.CountryID = oReader.GetInt32("CountryID", 0);
|
|||
|
|
|||
|
oEmpTraining.NatureOfTrainingID = oReader.GetInt32("NatureOfTrainingID", 0);
|
|||
|
oEmpTraining.TrainingTypeID = oReader.GetInt32("TrainingTypeID", 0);
|
|||
|
oEmpTraining.TrainingCompletedFrom = (EnumTrainingCompletedFrom)oReader.GetInt32("TrainingCompletedFrom", 0);
|
|||
|
|
|||
|
oEmpTraining.InstitutionID = oReader.GetInt32("InstitutionID", 0);
|
|||
|
oEmpTraining.Place = oReader.GetString("TrainingPlace");
|
|||
|
oEmpTraining.Achievement = oReader.GetString("Achievement");
|
|||
|
|
|||
|
oEmpTraining.Fees = oReader.GetDouble("Fees", 0);
|
|||
|
oEmpTraining.OtherCost = oReader.GetDouble("OtherCost", 0);
|
|||
|
|
|||
|
oEmpTraining.FromDate = oReader.GetDateTime("FromDate", DateTime.MinValue);
|
|||
|
oEmpTraining.ToDate = oReader.GetDateTime("ToDate", DateTime.MinValue);
|
|||
|
oEmpTraining.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus", 0);
|
|||
|
|
|||
|
oEmpTraining.TrainingMonth = oReader.GetInt32("TrainingMonth", 0);
|
|||
|
oEmpTraining.TrainingDay = oReader.GetInt32("TrainingDay", 0);
|
|||
|
oEmpTraining.TrainingHour = oReader.GetInt32("TrainingHour", 0);
|
|||
|
oEmpTraining.ConfirmationDate = oReader.GetDateTime("ConfirmationDate", DateTime.MinValue);
|
|||
|
oEmpTraining.HasAttachment = oReader.GetBoolean("HasAttachment", true, false);
|
|||
|
oEmpTraining.HasBond = oReader.GetBoolean("HasBond", true, false);
|
|||
|
|
|||
|
int? SponsorTypeValue = oReader.GetInt32("SponsoredType");
|
|||
|
oEmpTraining.SponsoredType = SponsorTypeValue.HasValue ? (EnumSponsoredType)SponsorTypeValue.Value : EnumSponsoredType.None;
|
|||
|
|
|||
|
this.SetObjectState(oEmpTraining, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpTraining CreateEmpTrainingObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpTraining training = new EmpTraining();
|
|||
|
MapEmpTrainingObject(training, oReader);
|
|||
|
return training;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpTraining> CreateEmpTrainingObjects(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpTraining> oEmpTrainings = new List<EmpTraining>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpTraining item = CreateEmpTrainingObject(oReader);
|
|||
|
oEmpTrainings.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpTrainings;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpNominee Mapping
|
|||
|
|
|||
|
private void MapEmpNomineeObject(EmpNominee oEmpNominee, DataReader oReader)
|
|||
|
{
|
|||
|
oEmpNominee.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
this.SetObjectID(oEmpNominee, oReader.GetInt32("NomineeID").Value);
|
|||
|
|
|||
|
oEmpNominee.NominationPurposeID = oReader.GetInt32("NominationPurposeID", 0);
|
|||
|
oEmpNominee.NominationDate = Convert.ToDateTime(oReader.GetString("NominationDate"));
|
|||
|
oEmpNominee.Name = oReader.GetString("Name");
|
|||
|
|
|||
|
oEmpNominee.RelationID = oReader.GetInt32("RelationID", 0);
|
|||
|
oEmpNominee.Percentage = Convert.ToDouble(oReader.GetString("Percentage"));
|
|||
|
oEmpNominee.BirthDate = Convert.ToDateTime(oReader.GetString("BirthDate"));
|
|||
|
|
|||
|
oEmpNominee.OccupationID = oReader.GetInt32("OccupationID", 0);
|
|||
|
oEmpNominee.Address = oReader.GetString("Address");
|
|||
|
/*oEmpNominee.Photograph = oReader.GetString("PHOTOPATH");
|
|||
|
oEmpNominee.Signature = oReader.GetString("Signature");*/
|
|||
|
|
|||
|
oEmpNominee.TelePhone = oReader.GetString("TelePhone");
|
|||
|
oEmpNominee.EmailAddress = oReader.GetString("EmailAddress");
|
|||
|
oEmpNominee.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus", true, 0);
|
|||
|
oEmpNominee.HasPicture = oReader.GetBoolean("HasPicture", true, false);
|
|||
|
oEmpNominee.HasSignature = oReader.GetBoolean("HasSignature", true, false);
|
|||
|
|
|||
|
this.SetObjectState(oEmpNominee, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpNominee CreateEmpNomineeObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpNominee nominee = new EmpNominee();
|
|||
|
MapEmpNomineeObject(nominee, oReader);
|
|||
|
return nominee;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpNominee> CreateEmpNomineeObjects(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpNominee> oEmpNominees = new List<EmpNominee>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpNominee item = CreateEmpNomineeObject(oReader);
|
|||
|
oEmpNominees.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpNominees;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpAcademic Mapping
|
|||
|
|
|||
|
private void MapEmpAcademicObject(EmpAcademic oEmpAcademic, DataReader oReader)
|
|||
|
{
|
|||
|
oEmpAcademic.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
this.SetObjectID(oEmpAcademic, oReader.GetInt32("AcademicID").Value);
|
|||
|
|
|||
|
oEmpAcademic.EducationTypeID = oReader.GetInt32("EducationTypeID", 0);
|
|||
|
oEmpAcademic.EducationLevelID = oReader.GetInt32("EducationLevelID", 0);
|
|||
|
oEmpAcademic.DisciplineID = oReader.GetInt32("DisciplineID", 0);
|
|||
|
oEmpAcademic.InstitutionID = oReader.GetInt32("InstitutionID", 0);
|
|||
|
|
|||
|
oEmpAcademic.PassingYear = oReader.GetInt32("PassingYear").Value;
|
|||
|
oEmpAcademic.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus", 0);
|
|||
|
|
|||
|
oEmpAcademic.ResultTypeID = oReader.GetInt32("ResultTypeID", 0);
|
|||
|
oEmpAcademic.GPAOrMarks = oReader.GetDouble("GPAOrMarks", 0);
|
|||
|
oEmpAcademic.OutOf = oReader.GetDouble("OutOf", 0);
|
|||
|
oEmpAcademic.LastLevel = oReader.GetBoolean("LastLevel", false);
|
|||
|
oEmpAcademic.InstituteName = oReader.GetString("InstituteName");
|
|||
|
oEmpAcademic.PhotoPath = oReader.GetString("PhotoPath");
|
|||
|
oEmpAcademic.DocSubmissionDate = oReader.GetDateTime("DocSubmissionDate");
|
|||
|
oEmpAcademic.HasAttachment = oReader.GetBoolean("HasAttachment", true, false);
|
|||
|
|
|||
|
this.SetObjectState(oEmpAcademic, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpAcademic CreateEmpAcademicObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpAcademic academic = new EmpAcademic();
|
|||
|
MapEmpAcademicObject(academic, oReader);
|
|||
|
return academic;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpAcademic> CreateEmpAcademicObjects(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpAcademic> oEmpAcademics = new List<EmpAcademic>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpAcademic item = CreateEmpAcademicObject(oReader);
|
|||
|
oEmpAcademics.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpAcademics;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpAchievement Mapping
|
|||
|
|
|||
|
private void MapEmpAchievementObject(EmpAchievement oEmpAchievement, DataReader oReader)
|
|||
|
{
|
|||
|
oEmpAchievement.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
this.SetObjectID(oEmpAchievement, oReader.GetInt32("EmpAchivementID").Value);
|
|||
|
oEmpAchievement.AchievementID = oReader.GetInt32("AchivementID", 0);
|
|||
|
//oEmpAchievement.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").Value;
|
|||
|
int? profileStatusValue = oReader.GetInt32("ProfileStatus");
|
|||
|
oEmpAchievement.ProfileStatus = profileStatusValue.HasValue ? (EnumProfileStatus)profileStatusValue.Value : EnumProfileStatus.Inserted_By_Employee;
|
|||
|
|
|||
|
this.SetObjectState(oEmpAchievement, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpAchievement CreateEmpAchievementObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpAchievement achievement = new EmpAchievement();
|
|||
|
MapEmpAchievementObject(achievement, oReader);
|
|||
|
return achievement;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpAchievement> CreateEmpAchievementObjects(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpAchievement> oEmpAchievements = new List<EmpAchievement>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpAchievement item = CreateEmpAchievementObject(oReader);
|
|||
|
oEmpAchievements.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpAchievements;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpCurricularActivity Mapping
|
|||
|
|
|||
|
private void MapEmpCurricularActivityObject(EmpCurricularActivity oEmpCurricularActivity, DataReader oReader)
|
|||
|
{
|
|||
|
oEmpCurricularActivity.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
this.SetObjectID(oEmpCurricularActivity, oReader.GetInt32("EmpExtraCurricularActivityID").Value);
|
|||
|
oEmpCurricularActivity.CurricularActivityID = oReader.GetInt32("ExtraCurricularActivityID", 0);
|
|||
|
//oEmpCurricularActivity.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").Value;
|
|||
|
int? profileStatusValue = oReader.GetInt32("ProfileStatus");
|
|||
|
oEmpCurricularActivity.ProfileStatus = profileStatusValue.HasValue ? (EnumProfileStatus)profileStatusValue.Value : EnumProfileStatus.Inserted_By_Employee;
|
|||
|
|
|||
|
|
|||
|
this.SetObjectState(oEmpCurricularActivity, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpCurricularActivity CreateEmpCurricularActivityObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpCurricularActivity curricularActivity = new EmpCurricularActivity();
|
|||
|
MapEmpCurricularActivityObject(curricularActivity, oReader);
|
|||
|
return curricularActivity;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpCurricularActivity> CreateEmpCurricularActivityObjects(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpCurricularActivity> oEmpCurricularActivitys = new List<EmpCurricularActivity>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpCurricularActivity item = CreateEmpCurricularActivityObject(oReader);
|
|||
|
oEmpCurricularActivitys.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpCurricularActivitys;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpOtherTalent Mapping
|
|||
|
|
|||
|
private void MapEmpOtherTalentObject(EmpOtherTalent oEmpOtherTalent, DataReader oReader)
|
|||
|
{
|
|||
|
oEmpOtherTalent.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
this.SetObjectID(oEmpOtherTalent, oReader.GetInt32("EmpOtherTalentID").Value);
|
|||
|
oEmpOtherTalent.OtherTalentID = oReader.GetInt32("OtherTalentID", 0);
|
|||
|
//oEmpOtherTalent.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").Value;
|
|||
|
int? profileStatusValue = oReader.GetInt32("ProfileStatus");
|
|||
|
oEmpOtherTalent.ProfileStatus = profileStatusValue.HasValue ? (EnumProfileStatus)profileStatusValue.Value : EnumProfileStatus.Inserted_By_Employee;
|
|||
|
|
|||
|
this.SetObjectState(oEmpOtherTalent, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpOtherTalent CreateEmpOtherTalentObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpOtherTalent otherTalents = new EmpOtherTalent();
|
|||
|
MapEmpOtherTalentObject(otherTalents, oReader);
|
|||
|
return otherTalents;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpOtherTalent> CreateEmpOtherTalentObjects(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpOtherTalent> oEmpOtherTalents = new List<EmpOtherTalent>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpOtherTalent item = CreateEmpOtherTalentObject(oReader);
|
|||
|
oEmpOtherTalents.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpOtherTalents;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpHobby Mapping
|
|||
|
|
|||
|
private void MapEmpHobby(EmpHobby oEmpHobby, DataReader oReader)
|
|||
|
{
|
|||
|
oEmpHobby.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
this.SetObjectID(oEmpHobby, oReader.GetInt32("EmpHobbyID").Value);
|
|||
|
oEmpHobby.HobbyID = oReader.GetInt32("HobbyID", 0);
|
|||
|
//oEmpHobby.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").Value;
|
|||
|
int? profileStatusValue = oReader.GetInt32("ProfileStatus");
|
|||
|
oEmpHobby.ProfileStatus = profileStatusValue.HasValue ? (EnumProfileStatus)profileStatusValue.Value : EnumProfileStatus.Inserted_By_Employee;
|
|||
|
|
|||
|
this.SetObjectState(oEmpHobby, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpHobby CreateEmpHobbyObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpHobby hobbys = new EmpHobby();
|
|||
|
MapEmpHobby(hobbys, oReader);
|
|||
|
return hobbys;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpHobby> CreateEmpHobbyObjects(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpHobby> oEmpHobbys = new List<EmpHobby>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpHobby item = CreateEmpHobbyObject(oReader);
|
|||
|
oEmpHobbys.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpHobbys;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpAllergy Mapping
|
|||
|
|
|||
|
private void MapEmpAllergy(EmpAllergy oEmpAllergy, DataReader oReader)
|
|||
|
{
|
|||
|
oEmpAllergy.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
this.SetObjectID(oEmpAllergy, oReader.GetInt32("EmpAllergyID").Value);
|
|||
|
oEmpAllergy.AllergyID = oReader.GetInt32("AllergyID", 0);
|
|||
|
//oEmpAllergy.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").Value;
|
|||
|
int? profileStatusValue = oReader.GetInt32("ProfileStatus");
|
|||
|
oEmpAllergy.ProfileStatus = profileStatusValue.HasValue ? (EnumProfileStatus)profileStatusValue.Value : EnumProfileStatus.Inserted_By_Employee;
|
|||
|
|
|||
|
this.SetObjectState(oEmpAllergy, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpAllergy CreateEmpAllergyObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpAllergy allergies = new EmpAllergy();
|
|||
|
MapEmpAllergy(allergies, oReader);
|
|||
|
return allergies;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpAllergy> CreateEmpAllergyObjects(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpAllergy> oEmpAllergys = new List<EmpAllergy>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpAllergy item = CreateEmpAllergyObject(oReader);
|
|||
|
oEmpAllergys.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpAllergys;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpHospitalization Mapping
|
|||
|
|
|||
|
private void MapEmpHospitalization(EmpHospitalization oEmpHospitalization, DataReader oReader)
|
|||
|
{
|
|||
|
oEmpHospitalization.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
this.SetObjectID(oEmpHospitalization, oReader.GetInt32("HospitalizationID").Value);
|
|||
|
|
|||
|
oEmpHospitalization.RegistrationDate = oReader.GetDateTime("RegistrationDate").Value;
|
|||
|
oEmpHospitalization.RegisteredPerson = oReader.GetString("RegisteredPerson");
|
|||
|
oEmpHospitalization.RelationId = oReader.GetInt32("RelationId", 0);
|
|||
|
|
|||
|
oEmpHospitalization.BirthDate = oReader.GetDateTime("BirthDate").Value;
|
|||
|
oEmpHospitalization.OccupationID = oReader.GetInt32("OccupationID", 0);
|
|||
|
oEmpHospitalization.Address = oReader.GetString("Address");
|
|||
|
oEmpHospitalization.Photograph = oReader.GetString("Photograph");
|
|||
|
oEmpHospitalization.Telephone = oReader.GetString("TelePhone");
|
|||
|
oEmpHospitalization.Mobile = oReader.GetString("Mobile");
|
|||
|
oEmpHospitalization.Email = oReader.GetString("Email");
|
|||
|
//oEmpHospitalization.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").Value;
|
|||
|
int? profileStatusValue = oReader.GetInt32("ProfileStatus");
|
|||
|
oEmpHospitalization.ProfileStatus = profileStatusValue.HasValue ? (EnumProfileStatus)profileStatusValue.Value : EnumProfileStatus.Inserted_By_Employee;
|
|||
|
|
|||
|
|
|||
|
this.SetObjectState(oEmpHospitalization, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpHospitalization CreateEmpHospitalizationObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpHospitalization hospitalization = new EmpHospitalization();
|
|||
|
MapEmpHospitalization(hospitalization, oReader);
|
|||
|
return hospitalization;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpHospitalization> CreateEmpHospitalizationObjects(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpHospitalization> oEmpHospitalizations = new List<EmpHospitalization>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpHospitalization item = CreateEmpHospitalizationObject(oReader);
|
|||
|
oEmpHospitalizations.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpHospitalizations;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region MapEmpGuarantor Mapping
|
|||
|
|
|||
|
private void MapEmpGuarantor(EmpGuarantor oEmpGuarantor, DataReader oReader)
|
|||
|
{
|
|||
|
this.SetObjectID(oEmpGuarantor, oReader.GetInt32("GUARANTORID").Value);
|
|||
|
oEmpGuarantor.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
oEmpGuarantor.Name = oReader.GetString("NAME");
|
|||
|
oEmpGuarantor.OccupationID = oReader.GetInt32("OCCUPATIONID", 0);
|
|||
|
|
|||
|
oEmpGuarantor.Address = oReader.GetString("ADDRESS");
|
|||
|
oEmpGuarantor.Telephone = oReader.GetString("TELEPHONE");
|
|||
|
oEmpGuarantor.GuarantorMobile = oReader.GetString("MOBILE");
|
|||
|
oEmpGuarantor.EmailAddress = oReader.GetString("EMAILADDRESS");
|
|||
|
oEmpGuarantor.CategotyDocId = oReader.GetInt32("CATEGORYDOCID", 0);
|
|||
|
oEmpGuarantor.DocumentPath = oReader.GetString("DOCUMENTPATH");
|
|||
|
//oEmpGuarantor.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").Value;
|
|||
|
int? profileStatusValue = oReader.GetInt32("ProfileStatus");
|
|||
|
oEmpGuarantor.ProfileStatus = profileStatusValue.HasValue ? (EnumProfileStatus)profileStatusValue.Value : EnumProfileStatus.Inserted_By_Employee;
|
|||
|
|
|||
|
this.SetObjectState(oEmpGuarantor, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpGuarantor CreateEmpGuarantorObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpGuarantor guarantor = new EmpGuarantor();
|
|||
|
MapEmpGuarantor(guarantor, oReader);
|
|||
|
return guarantor;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpGuarantor> CreateEmpGuarantorObjects(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpGuarantor> oEmpGuarantor = new List<EmpGuarantor>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpGuarantor item = CreateEmpGuarantorObject(oReader);
|
|||
|
oEmpGuarantor.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpGuarantor;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpWorkPlan Mapping
|
|||
|
|
|||
|
//private void MapObject(EmpWorkPlanSetup oEmployeeWorkPlanSetup, DataReader oReader)
|
|||
|
//{
|
|||
|
// base.SetObjectID(oEmployeeWorkPlanSetup, oReader.GetInt32("EmployeeWorkPlanSetupID").Value);
|
|||
|
// oEmployeeWorkPlanSetup.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
// oEmployeeWorkPlanSetup.ShiftID = oReader.GetInt32("ShiftID", 0);
|
|||
|
// oEmployeeWorkPlanSetup.StartDate = oReader.GetDateTime("StartDate").Value;
|
|||
|
// oEmployeeWorkPlanSetup.WorkPlanGroupID = oReader.GetInt32("WorkPlanGroupID", 0);
|
|||
|
// oEmployeeWorkPlanSetup.WeekEndOn = (DayOfWeek)oReader.GetInt32("WeekEndOn").Value;
|
|||
|
// oEmployeeWorkPlanSetup.CreatedBy = oReader.GetInt32("CreatedBy", 0);
|
|||
|
// oEmployeeWorkPlanSetup.CreatedDate = oReader.GetDateTime("CreatedDate").HasValue
|
|||
|
// ? oReader.GetDateTime("CreatedDate").Value
|
|||
|
// : DateTime.MinValue;
|
|||
|
// oEmployeeWorkPlanSetup.ModifiedBy = oReader.GetInt32("ModifiedBy", 0);
|
|||
|
// oEmployeeWorkPlanSetup.ModifiedDate = oReader.GetDateTime("ModifiedDate").HasValue
|
|||
|
// ? oReader.GetDateTime("ModifiedDate").Value
|
|||
|
// : (DateTime?)null;
|
|||
|
// // oEmployeeWorkPlanSetup.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").Value;
|
|||
|
// this.SetObjectState(oEmployeeWorkPlanSetup, Ease.Core.ObjectState.Saved);
|
|||
|
//}
|
|||
|
|
|||
|
//protected EmpWorkPlanSetup CreateEmpWorkObject(DataReader oReader)
|
|||
|
//{
|
|||
|
// EmpWorkPlanSetup oEmployeeWorkPlanSetup = new EmpWorkPlanSetup();
|
|||
|
// MapObject(oEmployeeWorkPlanSetup, oReader);
|
|||
|
// return oEmployeeWorkPlanSetup;
|
|||
|
//}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpLanguage Mapping
|
|||
|
|
|||
|
private void MapEmpLanguage(EmpLanguage oEmpLanguage, DataReader oReader)
|
|||
|
{
|
|||
|
this.SetObjectID(oEmpLanguage, oReader.GetInt32("EmpLanguageID").Value);
|
|||
|
oEmpLanguage.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
oEmpLanguage.LanguageName = oReader.GetString("LanguageName");
|
|||
|
oEmpLanguage.SpokenStatus = (EnumLanguageEfficiency)oReader.GetInt32("SpokenStatus");
|
|||
|
oEmpLanguage.WrittenStatus = (EnumLanguageEfficiency)oReader.GetInt32("WrittenStatus");
|
|||
|
//oEmpLanguage.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").Value;
|
|||
|
int? profileStatusValue = oReader.GetInt32("ProfileStatus");
|
|||
|
oEmpLanguage.ProfileStatus = profileStatusValue.HasValue ? (EnumProfileStatus)profileStatusValue.Value : EnumProfileStatus.Inserted_By_Employee;
|
|||
|
|
|||
|
this.SetObjectState(oEmpLanguage, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpLanguage CreateEmpLanguageObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpLanguage language = new EmpLanguage();
|
|||
|
MapEmpLanguage(language, oReader);
|
|||
|
return language;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpLanguage> CreateEmpLanguageObjects(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpLanguage> oEmpLanguage = new List<EmpLanguage>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpLanguage item = CreateEmpLanguageObject(oReader);
|
|||
|
oEmpLanguage.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpLanguage;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpRelative Mapping
|
|||
|
|
|||
|
private void MapEmpRelative(EmpRelative oEmpRelative, DataReader oReader)
|
|||
|
{
|
|||
|
this.SetObjectID(oEmpRelative, oReader.GetInt32("EmpRelativeID").Value);
|
|||
|
oEmpRelative.Name = oReader.GetString("Name");
|
|||
|
oEmpRelative.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
oEmpRelative.Designation = oReader.GetString("Designation");
|
|||
|
oEmpRelative.RelationID = oReader.GetInt32("RelationID", 0);
|
|||
|
oEmpRelative.EmpNo = oReader.GetString("EmpNo");
|
|||
|
oEmpRelative.JoiningDate = oReader.GetDateTime("JoiningDate").HasValue
|
|||
|
? oReader.GetDateTime("JoiningDate").Value
|
|||
|
: DateTime.MinValue;
|
|||
|
; //(DateTime)oReader.GetDateTime("JoiningDate");
|
|||
|
oEmpRelative.EndDate = oReader.GetDateTime("EndDate").HasValue
|
|||
|
? oReader.GetDateTime("EndDate").Value
|
|||
|
: DateTime.MinValue;
|
|||
|
//oEmpRelative.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").Value;
|
|||
|
int? profileStatusValue = oReader.GetInt32("ProfileStatus");
|
|||
|
oEmpRelative.ProfileStatus = profileStatusValue.HasValue ? (EnumProfileStatus)profileStatusValue.Value : EnumProfileStatus.Inserted_By_Employee;
|
|||
|
|
|||
|
this.SetObjectState(oEmpRelative, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpRelative CreateEmpRelativeObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpRelative relative = new EmpRelative();
|
|||
|
MapEmpRelative(relative, oReader);
|
|||
|
return relative;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpRelative> CreateEmpRelativeObjects(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpRelative> oEmpRelative = new List<EmpRelative>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpRelative item = CreateEmpRelativeObject(oReader);
|
|||
|
oEmpRelative.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpRelative;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpMembership Mapping
|
|||
|
|
|||
|
private void MapEmpMembership(EmpMembership oEmpMembership, DataReader oReader)
|
|||
|
{
|
|||
|
this.SetObjectID(oEmpMembership, oReader.GetInt32("EmpMembershipID").Value);
|
|||
|
oEmpMembership.Organization = oReader.GetString("Organization");
|
|||
|
oEmpMembership.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
oEmpMembership.Activity = oReader.GetString("Activity");
|
|||
|
oEmpMembership.FromDate = (DateTime)oReader.GetDateTime("FromDate");
|
|||
|
oEmpMembership.EndDate = oReader.GetDateTime("EndDate").HasValue
|
|||
|
? oReader.GetDateTime("EndDate").Value
|
|||
|
: DateTime.MinValue;
|
|||
|
; //(DateTime)oReader.GetDateTime("EndDate");
|
|||
|
oEmpMembership.OrganizationType = (EnumOrganizationType)oReader.GetInt32("OrganizationType");
|
|||
|
//oEmpMembership.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").Value;
|
|||
|
int? profileStatusValue = oReader.GetInt32("ProfileStatus");
|
|||
|
oEmpMembership.ProfileStatus = profileStatusValue.HasValue ? (EnumProfileStatus)profileStatusValue.Value : EnumProfileStatus.Inserted_By_Employee;
|
|||
|
|
|||
|
this.SetObjectState(oEmpMembership, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpMembership CreateEmpMembershipObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpMembership membership = new EmpMembership();
|
|||
|
MapEmpMembership(membership, oReader);
|
|||
|
return membership;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpMembership> CreateEmpMembershipObjects(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpMembership> oEmpMembership = new List<EmpMembership>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpMembership item = CreateEmpMembershipObject(oReader);
|
|||
|
oEmpMembership.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpMembership;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpRelation Mapping
|
|||
|
|
|||
|
private void MapEmpRelation(EmpRelation oEmpRelation, DataReader oReader)
|
|||
|
{
|
|||
|
this.SetObjectID(oEmpRelation, oReader.GetInt32("EmpRelationID").Value);
|
|||
|
oEmpRelation.Name = oReader.GetString("Name");
|
|||
|
oEmpRelation.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
oEmpRelation.RelationID = oReader.GetInt32("Relation", 0);
|
|||
|
oEmpRelation.OccupationID = oReader.GetInt32("Occupation", 0);
|
|||
|
//oEmpRelation.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").Value;
|
|||
|
int? profileStatusValue = oReader.GetInt32("ProfileStatus");
|
|||
|
oEmpRelation.ProfileStatus = profileStatusValue.HasValue ? (EnumProfileStatus)profileStatusValue.Value : EnumProfileStatus.Inserted_By_Employee;
|
|||
|
|
|||
|
this.SetObjectState(oEmpRelation, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpRelation CreateoEmpRelationObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpRelation relation = new EmpRelation();
|
|||
|
MapEmpRelation(relation, oReader);
|
|||
|
return relation;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpRelation> CreateEmpRelationObjects(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpRelation> oEmpRelation = new List<EmpRelation>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpRelation item = CreateoEmpRelationObject(oReader);
|
|||
|
oEmpRelation.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oEmpRelation;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpHRQuestionAnswer mapping
|
|||
|
|
|||
|
private void MapEmpHRQuestionAnswer(EmpHRQuestionAnswer oHRQuestionAnswer, DataReader oReader)
|
|||
|
{
|
|||
|
this.SetObjectID(oHRQuestionAnswer, oReader.GetInt32("EmpHRQuestionAnswerID").Value);
|
|||
|
oHRQuestionAnswer.QAnswer = oReader.GetString("QAnswer");
|
|||
|
oHRQuestionAnswer.QuestionDes = oReader.GetString("Question");
|
|||
|
oHRQuestionAnswer.EmployeeID = oReader.GetInt32("EmployeeID", 0);
|
|||
|
oHRQuestionAnswer.QuestionaryID = oReader.GetInt32("QuestionaryID", 0);
|
|||
|
oHRQuestionAnswer.QuestionNo = oReader.GetString("QuestionNo");
|
|||
|
//oHRQuestionAnswer.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus").Value;
|
|||
|
int? profileStatusValue = oReader.GetInt32("ProfileStatus");
|
|||
|
oHRQuestionAnswer.ProfileStatus = profileStatusValue.HasValue ? (EnumProfileStatus)profileStatusValue.Value : EnumProfileStatus.Inserted_By_Employee;
|
|||
|
|
|||
|
this.SetObjectState(oHRQuestionAnswer, ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
private EmpHRQuestionAnswer CreateoEmpHRQuestionAnswerObject(DataReader oReader)
|
|||
|
{
|
|||
|
EmpHRQuestionAnswer hRQuestionAnswer = new EmpHRQuestionAnswer();
|
|||
|
MapEmpHRQuestionAnswer(hRQuestionAnswer, oReader);
|
|||
|
return hRQuestionAnswer;
|
|||
|
}
|
|||
|
|
|||
|
protected List<EmpHRQuestionAnswer> CreateEmpHRQuestionAnswerObjects(DataReader oReader)
|
|||
|
{
|
|||
|
List<EmpHRQuestionAnswer> oHRQuestionAnswer = new List<EmpHRQuestionAnswer>();
|
|||
|
while (oReader.Read())
|
|||
|
{
|
|||
|
EmpHRQuestionAnswer item = CreateoEmpHRQuestionAnswerObject(oReader);
|
|||
|
oHRQuestionAnswer.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
return oHRQuestionAnswer;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Service Implimentation
|
|||
|
|
|||
|
#region parent service implimentation
|
|||
|
|
|||
|
#region Get Functions
|
|||
|
|
|||
|
#region Fill Childs
|
|||
|
|
|||
|
public HREmployee GetHREmployeeRelatedData(TransactionContext tc, HREmployee oHREmployee)
|
|||
|
{
|
|||
|
oHREmployee.FatherOccupation = (new OccupationService()).Get(tc, oHREmployee.FatherOccupationID);
|
|||
|
oHREmployee.MotherOccupation = (new OccupationService()).Get(tc, oHREmployee.MotherOccupationID);
|
|||
|
|
|||
|
if (oHREmployee.DesignationID != null)
|
|||
|
{
|
|||
|
Designation desig = new DesignationService().Get((int)oHREmployee.DesignationID);
|
|||
|
oHREmployee.DesignationName = desig != null ? desig.Name : string.Empty;
|
|||
|
}
|
|||
|
//if (oHREmployee.GradeID != null)
|
|||
|
//{
|
|||
|
// Grade grade = new GradeService().Get((int)oHREmployee.GradeID);
|
|||
|
// oHREmployee.GradeName = grade != null ? grade.Name : string.Empty;
|
|||
|
if (oHREmployee.DepartmentID != null && oHREmployee.DepartmentID != 0)
|
|||
|
{
|
|||
|
Department dept = new DepartmentService().Get((int)oHREmployee.DepartmentID);
|
|||
|
oHREmployee.DepartmentName = dept != null ? dept.Name : string.Empty;
|
|||
|
}
|
|||
|
//if(oHREmployee.LocationID != null && oHREmployee.LocationID !=0)
|
|||
|
// {
|
|||
|
// Location location = new LocationService().Get((int)oHREmployee.LocationID);
|
|||
|
// oHREmployee.LocationName = location != null ? location.Name : string.Empty;
|
|||
|
//}
|
|||
|
if (oHREmployee.NationalityID != null)
|
|||
|
{
|
|||
|
oHREmployee.Nationality = (new NationalityService()).Get(tc, (int)oHREmployee.NationalityID);
|
|||
|
}
|
|||
|
//oHREmployee.Category = (new CategoryService()).Get(tc, oHREmployee.CategoryID);
|
|||
|
//oHREmployee.Function = (new FunctionService()).Get(tc, oHREmployee.FunctionID);
|
|||
|
//oHREmployee.Company = (new CompanyService()).Get(tc ,oHREmployee.CompanyID);
|
|||
|
oHREmployee.Religion = (new ReligionService()).Get(oHREmployee.ReligionID);
|
|||
|
oHREmployee.Contacts = GetEmpContacts(tc, oHREmployee.ID);
|
|||
|
oHREmployee.Grade = new GradeService().Get(oHREmployee.GradeID.GetValueOrDefault());
|
|||
|
//oHREmployee.WorkPlanSetup = GetEmpWorkPlanSetup(tc, oHREmployee.ID);
|
|||
|
oHREmployee.Spouses = GetSpouse(tc, oHREmployee.ID);
|
|||
|
oHREmployee.ChildrenList = GetChildrens(tc, oHREmployee.ID);
|
|||
|
oHREmployee.CreditCards = GetEmpCreditCard(tc, oHREmployee.ID);
|
|||
|
//oHREmployee.Publications = GetEmpPublications(tc, oHREmployee.ID);
|
|||
|
oHREmployee.References = GetEmpReferences(tc, oHREmployee.ID);
|
|||
|
oHREmployee.Experiences = GetEmpExperiences(tc, oHREmployee.ID);
|
|||
|
oHREmployee.Trainings = GetEmpTrainings(tc, oHREmployee.ID);
|
|||
|
oHREmployee.Nominees = GetEmpNominees(tc, oHREmployee.ID);
|
|||
|
oHREmployee.Academics = GetEmpAcademics(tc, oHREmployee.ID);
|
|||
|
//oHREmployee.Achievements = GetEmpAchievements(tc, oHREmployee.ID);
|
|||
|
//oHREmployee.CurricularActivities = GetEmpCurricularActivitys(tc, oHREmployee.ID);
|
|||
|
//oHREmployee.OtherTalents = GetEmpOtherTalents(tc, oHREmployee.ID);
|
|||
|
//oHREmployee.Hobbies = GetEmpHobbys(tc, oHREmployee.ID);
|
|||
|
//oHREmployee.Allergies = GetEmpAllergys(tc, oHREmployee.ID);
|
|||
|
//oHREmployee.Hospitalizations = GetEmpHospitalizations(tc, oHREmployee.ID);
|
|||
|
//oHREmployee.Guarantors = GetEmpGuarantors(tc, oHREmployee.ID);
|
|||
|
//oHREmployee.EmpLanguages = GetEmpLanguages(tc, oHREmployee.ID);
|
|||
|
//oHREmployee.EmpRelatives = GetEmpRelatives(tc, oHREmployee.ID);
|
|||
|
//oHREmployee.Experiences = GetEmpExperiences(tc, oHREmployee.ID);
|
|||
|
//oHREmployee.EmpMemberships = GetEmpMemberships(tc, oHREmployee.ID);
|
|||
|
//oHREmployee.EmpRelations = GetEmpRelations(tc, oHREmployee.ID);
|
|||
|
//oHREmployee.EmpHRQuestionAnswers = GetEmpHRQuestionAnswers(tc, oHREmployee.ID);
|
|||
|
if (oHREmployee.BranchID != null)
|
|||
|
{
|
|||
|
tc.End();
|
|||
|
oHREmployee.Branch = new BranchService().Get((int)oHREmployee.BranchID);
|
|||
|
|
|||
|
if (oHREmployee.Branch != null)
|
|||
|
{
|
|||
|
tc.End();
|
|||
|
oHREmployee.Branch.Bank = new BankService().GetByBrancID(oHREmployee.Branch.ID);
|
|||
|
}
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
}
|
|||
|
|
|||
|
return oHREmployee;
|
|||
|
}
|
|||
|
|
|||
|
List<EmpSpouse> GetSpouse(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpSpouse> spouse = GetEmpSpouses(tc, id);
|
|||
|
spouse.ForEach(x =>
|
|||
|
{
|
|||
|
if (x.OccupationID != null)
|
|||
|
x.Occupation = new OccupationService().Get(x.OccupationID);
|
|||
|
if (x.EducationLevelID != null)
|
|||
|
x.EducationLevel = new EducationLevelService().Get(x.EducationLevelID);
|
|||
|
});
|
|||
|
//for (int i = 0; i < spouse.Count; i++)
|
|||
|
//{
|
|||
|
// spouse[i].CreditCards = GetEmpCreditCard(tc, spouse[i].ID);
|
|||
|
//}
|
|||
|
|
|||
|
return spouse;
|
|||
|
}
|
|||
|
|
|||
|
List<EmpChildren> GetChildrens(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpChildren> children = GetEmpChildrens(tc, id);
|
|||
|
children.ForEach(x =>
|
|||
|
{
|
|||
|
if (x.OccupationID != null)
|
|||
|
x.Occupation = new OccupationService().Get(x.OccupationID);
|
|||
|
});
|
|||
|
|
|||
|
return children;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
public HREmployee Get(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
HREmployee oHREmployee = new HREmployee();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmployees(tc, id));
|
|||
|
if (dr.Read())
|
|||
|
{
|
|||
|
oHREmployee = this.CreateObject<HREmployee>(dr);
|
|||
|
GetHREmployeeRelatedData(tc, oHREmployee);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oHREmployee;
|
|||
|
}
|
|||
|
|
|||
|
/*public HREmployee GetEmployeeByCode(string employeeNo)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
HREmployee hrEmployee = new HREmployee();
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmployeeByCode(tc, employeeNo));
|
|||
|
if (dr.Read())
|
|||
|
{
|
|||
|
hrEmployee = this.CreateObject<HREmployee>(dr);
|
|||
|
}
|
|||
|
|
|||
|
Console.WriteLine(hrEmployee);
|
|||
|
dr.Close();
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return hrEmployee;
|
|||
|
}*/
|
|||
|
|
|||
|
public List<EmpCreditCard> GetEmpCreditCard(int id)
|
|||
|
{
|
|||
|
List<EmpCreditCard> oEmpCreditCard = new List<EmpCreditCard>();
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpCreditCard(tc, id));
|
|||
|
oEmpCreditCard = this.CreateEmpCreditCard(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
return oEmpCreditCard;
|
|||
|
}
|
|||
|
|
|||
|
public HREmployee Get(int id)
|
|||
|
{
|
|||
|
HREmployee oHREmployee = null;
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmployees(tc, id));
|
|||
|
if (dr.Read())
|
|||
|
{
|
|||
|
oHREmployee = this.CreateObject<HREmployee>(dr);
|
|||
|
}
|
|||
|
|
|||
|
dr.Close();
|
|||
|
GetHREmployeeRelatedData(tc, oHREmployee);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oHREmployee;
|
|||
|
}
|
|||
|
|
|||
|
public HREmployee GetEmployee(string employeeNo, int payrolltypeid)
|
|||
|
{
|
|||
|
HREmployee oEmployee = null;
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oreader = new DataReader(HREmployeeDA.GetEmployee(tc, employeeNo, payrolltypeid));
|
|||
|
if (oreader.Read())
|
|||
|
{
|
|||
|
oEmployee = this.CreateObject<HREmployee>(oreader);
|
|||
|
GetHREmployeeRelatedData(tc, oEmployee);
|
|||
|
}
|
|||
|
|
|||
|
oreader.Close();
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmployee;
|
|||
|
}
|
|||
|
|
|||
|
//public EmpWorkPlanSetup GetEmpWorkPlanSetup(TransactionContext tc, int id)
|
|||
|
//{
|
|||
|
// EmpWorkPlanSetup oEmployeeWorkPlanSetup = null;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// DataReader oreader = new DataReader(HREmployeeDA.GetEmpWorkPlanSetup(tc, id));
|
|||
|
// if (oreader.Read())
|
|||
|
// {
|
|||
|
// oEmployeeWorkPlanSetup = this.CreateEmpWorkObject(oreader);
|
|||
|
// }
|
|||
|
|
|||
|
// oreader.Close();
|
|||
|
// }
|
|||
|
// catch (Exception e)
|
|||
|
// {
|
|||
|
// #region Handle Exception
|
|||
|
|
|||
|
// ExceptionLog.Write(e);
|
|||
|
// throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
// #endregion
|
|||
|
// }
|
|||
|
|
|||
|
// return oEmployeeWorkPlanSetup;
|
|||
|
//}
|
|||
|
|
|||
|
//public EmpWorkPlanSetup GetEmpWorkPlanSetup(int id)
|
|||
|
//{
|
|||
|
// EmpWorkPlanSetup oEmployeeWorkPlanSetup = null;
|
|||
|
|
|||
|
// TransactionContext tc = null;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// tc = TransactionContext.Begin();
|
|||
|
// DataReader oreader = new DataReader(HREmployeeDA.GetEmpWorkPlanSetup(tc, id));
|
|||
|
// if (oreader.Read())
|
|||
|
// {
|
|||
|
// oEmployeeWorkPlanSetup = this.CreateEmpWorkObject(oreader);
|
|||
|
// }
|
|||
|
|
|||
|
// oreader.Close();
|
|||
|
// tc.End();
|
|||
|
// }
|
|||
|
// catch (Exception e)
|
|||
|
// {
|
|||
|
// #region Handle Exception
|
|||
|
|
|||
|
// if (tc != null)
|
|||
|
// tc.HandleError();
|
|||
|
// ExceptionLog.Write(e);
|
|||
|
// throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
// #endregion
|
|||
|
// }
|
|||
|
|
|||
|
// return oEmployeeWorkPlanSetup;
|
|||
|
//}
|
|||
|
|
|||
|
public HREmployee GetByEmployeeNo(string empNo, int payrolltypeid)
|
|||
|
{
|
|||
|
HREmployee oHREmployee = null;
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetByEmployeeNo(tc, empNo, payrolltypeid));
|
|||
|
if (dr.Read())
|
|||
|
{
|
|||
|
oHREmployee = this.CreateObject<HREmployee>(dr);
|
|||
|
}
|
|||
|
dr.Close();
|
|||
|
|
|||
|
if (oHREmployee != null)
|
|||
|
{
|
|||
|
GetHREmployeeRelatedData(tc, oHREmployee);
|
|||
|
}
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oHREmployee;
|
|||
|
}
|
|||
|
|
|||
|
public List<HREmployee> GetUserGroups()
|
|||
|
{
|
|||
|
List<HREmployee> oHREmployees = new List<HREmployee>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetUserGroups(tc));
|
|||
|
oHREmployees = this.CreateObjects<HREmployee>(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oHREmployees;
|
|||
|
}
|
|||
|
|
|||
|
public List<HREmployee> GetEmployeeByIds(string idS)
|
|||
|
{
|
|||
|
List<HREmployee> oHREmployees = new List<HREmployee>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmployeeByIds(tc, idS));
|
|||
|
oHREmployees = this.CreateObjects<HREmployee>(dr);
|
|||
|
dr.Close();
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oHREmployees;
|
|||
|
}
|
|||
|
|
|||
|
public string GetSubordinateIDs(int nodeID)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
string subOrdinateIDs = HREmployeeDA.GetSubordinateIDs(tc, nodeID);
|
|||
|
tc.End();
|
|||
|
return subOrdinateIDs;
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public DataSet GetSubordinatesDataset(int nodeID, string AdditionalSQL)
|
|||
|
{
|
|||
|
//TransactionContext tc = null;
|
|||
|
//DataSet employees = null;
|
|||
|
//string sql = string.Empty;
|
|||
|
//try
|
|||
|
//{
|
|||
|
// tc = TransactionContext.Begin(true);
|
|||
|
// RAHierarchyNodeService nodeService = new RAHierarchyNodeService();
|
|||
|
// RAHierarchyNode node = nodeService.Get(tc, nodeID);
|
|||
|
// int maxLevel = nodeService.GetMaxLevel(tc);
|
|||
|
// if (node != null)
|
|||
|
// {
|
|||
|
// string subQuery = " Select NodeID From RAHierarchyNode Where ParentNodeID=" + nodeID.ToString();
|
|||
|
// for (int i = 0; i <= maxLevel - node.Level; i++)
|
|||
|
// {
|
|||
|
// if (sql.Length > 0) sql += " UNION ";
|
|||
|
// sql = sql + " " + recure(subQuery, i);
|
|||
|
// }
|
|||
|
// sql = "Select Employee.EmployeeId, Employee.EmployeeNo, Employee.Name, RANodeProperty.NodeId From RANodeProperty , Employee Where NodeID In " +
|
|||
|
// "(" + sql + ")" +
|
|||
|
// "AND RANodeProperty.EmployeeID IS NOT NULL AND RANodeProperty.EmployeeID = Employee.EmployeeID AND Employee.Status =1";
|
|||
|
// if (AdditionalSQL != "")
|
|||
|
// {
|
|||
|
// sql = sql + " AND " + AdditionalSQL;
|
|||
|
// }
|
|||
|
// employees = EmployeeDA.GetSubordinatesEmps(tc, sql);
|
|||
|
// }
|
|||
|
|
|||
|
// tc.End();
|
|||
|
|
|||
|
// return employees;
|
|||
|
//}
|
|||
|
//catch (Exception e)
|
|||
|
//{
|
|||
|
// #region Handle Exception
|
|||
|
// if (tc != null)
|
|||
|
// tc.HandleError();
|
|||
|
// ExceptionLog.Write(e);
|
|||
|
// throw new ServiceException(e.Message, e);
|
|||
|
// #endregion
|
|||
|
//}
|
|||
|
return null;
|
|||
|
}
|
|||
|
|
|||
|
public DataSet GetEmployeesDataset(string sQuery)
|
|||
|
{
|
|||
|
DataSet oEmployees = null;
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
oEmployees = HREmployeeDA.GetSubordinatesEmps(tc, sQuery);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmployees;
|
|||
|
}
|
|||
|
|
|||
|
public List<HREmployee> GetGroupEmployees()
|
|||
|
{
|
|||
|
List<HREmployee> employees = new List<HREmployee>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oReader = new DataReader(HREmployeeDA.GetUserGroups(tc));
|
|||
|
employees = this.CreateObjects<HREmployee>(oReader);
|
|||
|
oReader.Close();
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return employees;
|
|||
|
}
|
|||
|
|
|||
|
public List<HREmployee> GetEmployees(string sQuery)
|
|||
|
{
|
|||
|
List<HREmployee> oEmployees = new List<HREmployee>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oReader = new DataReader(HREmployeeDA.GetEmployees(tc, sQuery));
|
|||
|
oEmployees = this.CreateObjects<HREmployee>(oReader);
|
|||
|
oReader.Close();
|
|||
|
tc.End();
|
|||
|
|
|||
|
#region Child Objects
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmployees;
|
|||
|
}
|
|||
|
|
|||
|
public List<HREmployee> GetWithPayrollType(int payrollTypeID)
|
|||
|
{
|
|||
|
List<HREmployee> employees = new List<HREmployee>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oReader = new DataReader(EmployeeDA.GetWithPayrollType(tc, payrollTypeID));
|
|||
|
employees = this.CreateObjects<HREmployee>(oReader);
|
|||
|
oReader.Close();
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return employees;
|
|||
|
}
|
|||
|
|
|||
|
public List<HREmployee> GetAllHREmps()
|
|||
|
{
|
|||
|
List<HREmployee> employees = new List<HREmployee>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetAllHREmps(tc));
|
|||
|
employees = this.CreateObjects<HREmployee>(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return employees;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region MyRegion
|
|||
|
|
|||
|
public bool IsEmployeeNoExist(string empNo)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
|
|||
|
bool result = false;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
result = HREmployeeDA.IsExists("Employee", "EmployeeNo", empNo, tc);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
public bool IsNickNameExists(string nickName)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
|
|||
|
bool result = false;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
result = HREmployeeDA.IsExists("Employee", "ShortName", nickName, tc);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
public bool IsExists(string sSearch)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
bool bExists = false;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
bExists = HREmployeeDA.IsExists(tc, sSearch);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return bExists;
|
|||
|
}
|
|||
|
|
|||
|
public LogInStatus IsValidateForDesktop(string empNo, string password, ref HREmployee employee)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
LogInStatus result = LogInStatus.InvalidPassword;
|
|||
|
//try
|
|||
|
//{
|
|||
|
// tc = TransactionContext.Begin();
|
|||
|
// #region Employee
|
|||
|
// IDataReader iReader = HR.Service.EmployeeDA.Get(tc, empNo);
|
|||
|
// DataReader oReader = new DataReader(iReader);
|
|||
|
// if (iReader.Read())
|
|||
|
// {
|
|||
|
// employee = CreateHREmployeeObject(oReader);
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// employee = new HREmployee();
|
|||
|
// result = LogInStatus.InvalidEmployee;
|
|||
|
// //employee.ValidationMessage = "Logged In Employee Code is not valid";
|
|||
|
// }
|
|||
|
// iReader.Close();
|
|||
|
// #endregion
|
|||
|
// tc.End();
|
|||
|
// if (employee.PayRollStatus != EnumEmployeePayStatus.EmployeeStatusLive)
|
|||
|
// {
|
|||
|
// if (employee.ValidationMessage.Length == 0)
|
|||
|
// {
|
|||
|
// employee.ValidationMessage = "Employee status is not 'live'.";
|
|||
|
// result = LogInStatus.DiscontinueEmployee;
|
|||
|
// }
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// if (password.Equals(employee.DesktopPassWord))
|
|||
|
// {
|
|||
|
// employee.ValidationMessage = "Password is set from HRMIS. Please Change your password.";
|
|||
|
// result = LogInStatus.PasswordIsSetFromHR;
|
|||
|
// }
|
|||
|
// else if (Ease.Core.Global.Encrypt(password).Equals(employee.DesktopPassWord) == false)
|
|||
|
// {
|
|||
|
// employee.ValidationMessage = "Invalid password. Try Again";
|
|||
|
// result = LogInStatus.InvalidPassword;
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// result = LogInStatus.SuccessfulLogin;
|
|||
|
|
|||
|
// HRUser.Employee = employee;
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
//}
|
|||
|
//catch (Exception e)
|
|||
|
//{
|
|||
|
// #region Handle Exception
|
|||
|
// if (tc != null)
|
|||
|
// tc.HandleError();
|
|||
|
// ExceptionLog.Write(e);
|
|||
|
// throw new ServiceException(e.Message, e);
|
|||
|
// #endregion
|
|||
|
//}
|
|||
|
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
public void DeleteChildData(string tableName, string columnName, int id)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
HREmployeeDA.DeleteChildData(tc, tableName, columnName, id);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
public int Save(HREmployee employee, int candidateId)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
if (employee.IsNew)
|
|||
|
{
|
|||
|
this.SetObjectID(employee, (HREmployeeDA.GetNewID(tc)));
|
|||
|
HREmployeeDA.Insert(tc, employee);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
HREmployeeDA.Update(tc, employee);
|
|||
|
|
|||
|
#region Delete Children
|
|||
|
|
|||
|
HREmployeeDA.Delete(tc, "EmpContact", "EmployeeID", employee.ID);
|
|||
|
|
|||
|
HREmployeeDA.Delete(tc, "EmpChildren", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpSpouse", "EmployeeID", employee.ID);
|
|||
|
|
|||
|
HREmployeeDA.Delete(tc, "EmpExperience", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpTraining", "EmployeeID", employee.ID);
|
|||
|
|
|||
|
HREmployeeDA.Delete(tc, "EmpAcademic", "EmployeeID", employee.ID);
|
|||
|
|
|||
|
HREmployeeDA.Delete(tc, "EmpAchivement", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpOtherTalent", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpExtraCurricularActivity", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpHobby", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpAllergy", "EmployeeID", employee.ID);
|
|||
|
|
|||
|
HREmployeeDA.Delete(tc, "EmpReference", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpPublication", "EmployeeID", employee.ID);
|
|||
|
|
|||
|
HREmployeeDA.Delete(tc, "EmpNominee", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpHospitalization", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpGuarantor", "EmployeeID", employee.ID);
|
|||
|
|
|||
|
HREmployeeDA.Delete(tc, "EmpLanguage", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpRelative", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpMembership", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpRelation", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpHRQuestionAnswer", "EmployeeID", employee.ID);
|
|||
|
|
|||
|
HREmployeeDA.Delete(tc, "EmpCreditCard", "EmployeeID", employee.ID);
|
|||
|
|
|||
|
//HREmployeeDA.Delete(tc,employee.ID);
|
|||
|
//HREmployeeDA.Insert(tc, employee);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
#region Contact
|
|||
|
|
|||
|
foreach (EmpContact item in employee.Contacts)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, HREmployeeDA.GetNewID(tc, "EmpContact", "ContactID"));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Spouse
|
|||
|
|
|||
|
foreach (EmpSpouse item in employee.Spouses)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, HREmployeeDA.GetNewID(tc, "EmpSpouse", "SpouseID"));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
|
|||
|
if (item.CreditCards != null)
|
|||
|
{
|
|||
|
foreach (EmpCreditCard card in item.CreditCards)
|
|||
|
{
|
|||
|
card.EmployeeID = employee.ID;
|
|||
|
card.UserTypeID = item.ID;
|
|||
|
card.UserType = EnumCardUserType.Spouse;
|
|||
|
this.SetObjectID(card, HREmployeeDA.GetNewID(tc, "EmpCreditCard", "EmpCreditCardID"));
|
|||
|
HREmployeeDA.Insert(tc, card);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Children
|
|||
|
|
|||
|
foreach (EmpChildren item in employee.ChildrenList)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, HREmployeeDA.GetNewID(tc, "EmpChildren", "ChildID"));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
|
|||
|
if (item.CreditCards != null)
|
|||
|
{
|
|||
|
foreach (EmpCreditCard card in item.CreditCards)
|
|||
|
{
|
|||
|
card.EmployeeID = employee.ID;
|
|||
|
card.UserTypeID = item.ID;
|
|||
|
card.UserType = EnumCardUserType.Children;
|
|||
|
this.SetObjectID(card, HREmployeeDA.GetNewID(tc, "EmpCreditCard", "EmpCreditCardID"));
|
|||
|
HREmployeeDA.Insert(tc, card);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Experience
|
|||
|
|
|||
|
foreach (EmpExperience item in employee.Experiences)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, HREmployeeDA.GetNewID(tc, "EmpExperience", "ExperienceID"));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Training
|
|||
|
|
|||
|
foreach (EmpTraining item in employee.Trainings)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, HREmployeeDA.GetNewID(tc, "EmpTraining", "EmpTrainingID"));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Academic
|
|||
|
|
|||
|
foreach (EmpAcademic item in employee.Academics)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, HREmployeeDA.GetNewID(tc, "EmpAcademic", "AcademicID"));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region other Qualification
|
|||
|
|
|||
|
#region EmployeeAchivement
|
|||
|
|
|||
|
foreach (EmpAchievement item in employee.Achievements)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, HREmployeeDA.GetNewID(tc, "EmpAchivement", "EmpAchivementID"));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmployeeHobby
|
|||
|
|
|||
|
foreach (EmpHobby item in employee.Hobbies)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpHobby", "EmpHobbyID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmployeeOtherTalent
|
|||
|
|
|||
|
foreach (EmpOtherTalent item in employee.OtherTalents)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpOtherTalent", "EmpOtherTalentID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmployeeCurricularActivity
|
|||
|
|
|||
|
foreach (EmpCurricularActivity item in employee.CurricularActivities)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item,
|
|||
|
(HREmployeeDA.GetNewID(tc, "EmpExtraCurricularActivity", "EmpExtraCurricularActivityID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmployeeAllergy
|
|||
|
|
|||
|
foreach (EmpAllergy item in employee.Allergies)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpAllergy", "EmpAllergyID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Reference
|
|||
|
|
|||
|
foreach (EmpReference item in employee.References)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpReference", "ReferenceID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Publication
|
|||
|
|
|||
|
foreach (EmpPublication item in employee.Publications)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpPublication", "PublicationID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Nominee
|
|||
|
|
|||
|
foreach (EmpNominee item in employee.Nominees)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpNominee", "NomineeID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Hospitalization
|
|||
|
|
|||
|
foreach (EmpHospitalization item in employee.Hospitalizations)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpHospitalization", "HospitalizationID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Guarantor
|
|||
|
|
|||
|
foreach (EmpGuarantor item in employee.Guarantors)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpGuarantor", "GuarantorID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpLanguage
|
|||
|
|
|||
|
foreach (EmpLanguage item in employee.EmpLanguages)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpLanguage", "EmpLanguageID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpRelative
|
|||
|
|
|||
|
foreach (EmpRelative item in employee.EmpRelatives)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpRelative", "EmpRelativeID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpMembership
|
|||
|
|
|||
|
foreach (EmpMembership item in employee.EmpMemberships)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpMembership", "EmpMembershipID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpRelation
|
|||
|
|
|||
|
foreach (EmpRelation item in employee.EmpRelations)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpRelation", "EmpRelationID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpHRQuestionAnswer
|
|||
|
|
|||
|
foreach (EmpHRQuestionAnswer item in employee.EmpHRQuestionAnswers)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpHRQuestionAnswer", "EmpHRQuestionAnswerID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpCreditCard
|
|||
|
|
|||
|
if (employee.CreditCards != null)
|
|||
|
{
|
|||
|
foreach (EmpCreditCard item in employee.CreditCards)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
item.UserTypeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpCreditCard", "EmpCreditCardID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
//if(employee.WorkPlanSetup!=null)
|
|||
|
//{
|
|||
|
// employee.WorkPlanSetup.EmployeeID = employee.ID;
|
|||
|
// employee.WorkPlanSetup.CreatedBy = (1); //employee.CreatedBy;
|
|||
|
// employee.WorkPlanSetup.CreatedDate = DateTime.Today;
|
|||
|
// this.SetObjectID(employee.WorkPlanSetup, (HREmployeeDA.GetNewID(tc, "EmployeeWorkPlanSetup", "EmployeeWorkPlanSetupID")));
|
|||
|
// HREmployeeDA.Insert(tc, employee.WorkPlanSetup);
|
|||
|
|
|||
|
//}
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return employee.ID;
|
|||
|
}
|
|||
|
|
|||
|
public void Save(List<HREmployee> oEmployees)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
foreach (HREmployee employee in oEmployees)
|
|||
|
{
|
|||
|
if (employee.BloodGroup > 0) employee.ProfileComplitionPercent += 5;
|
|||
|
if (employee.NationalID != string.Empty) employee.ProfileComplitionPercent += 5;
|
|||
|
if (employee.PhotoPath != string.Empty) employee.ProfileComplitionPercent += 5;
|
|||
|
if (employee.Contacts != null && employee.Contacts.Count > 0) employee.ProfileComplitionPercent += 30;
|
|||
|
if (employee.Academics != null && employee.Academics.Count > 0) employee.ProfileComplitionPercent += 30;
|
|||
|
|
|||
|
if (employee.IsNew)
|
|||
|
{
|
|||
|
this.SetObjectID(employee, (HREmployeeDA.GetNewID(tc)));
|
|||
|
HREmployeeDA.Insert(tc, employee);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
HREmployeeDA.Update(tc, employee);
|
|||
|
|
|||
|
#region Delete Children
|
|||
|
|
|||
|
HREmployeeDA.Delete(tc, "EmpContact", "EmployeeID", employee.ID);
|
|||
|
|
|||
|
HREmployeeDA.Delete(tc, "EmpChildren", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpSpouse", "EmployeeID", employee.ID);
|
|||
|
|
|||
|
HREmployeeDA.Delete(tc, "EmpExperience", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpTraining", "EmployeeID", employee.ID);
|
|||
|
|
|||
|
HREmployeeDA.Delete(tc, "EmpAcademic", "EmployeeID", employee.ID);
|
|||
|
|
|||
|
HREmployeeDA.Delete(tc, "EmpAchivement", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpOtherTalent", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpExtraCurricularActivity", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpHobby", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpAllergy", "EmployeeID", employee.ID);
|
|||
|
|
|||
|
HREmployeeDA.Delete(tc, "EmpReference", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpPublication", "EmployeeID", employee.ID);
|
|||
|
|
|||
|
HREmployeeDA.Delete(tc, "EmpNominee", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpHospitalization", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpGuarantor", "EmployeeID", employee.ID);
|
|||
|
|
|||
|
HREmployeeDA.Delete(tc, "EmpLanguage", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpRelative", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpMembership", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpRelation", "EmployeeID", employee.ID);
|
|||
|
HREmployeeDA.Delete(tc, "EmpHRQuestionAnswer", "EmployeeID", employee.ID);
|
|||
|
|
|||
|
HREmployeeDA.Delete(tc, "EmpCreditCard", "EmployeeID", employee.ID);
|
|||
|
|
|||
|
//HREmployeeDA.Delete(tc,employee.ID);
|
|||
|
//HREmployeeDA.Insert(tc, employee);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
#region Contact
|
|||
|
|
|||
|
foreach (EmpContact item in employee.Contacts)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpContact", "ContactID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Spouse
|
|||
|
|
|||
|
foreach (EmpSpouse item in employee.Spouses)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpSpouse", "SpouseID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
|
|||
|
if (item.CreditCards != null)
|
|||
|
{
|
|||
|
foreach (EmpCreditCard card in item.CreditCards)
|
|||
|
{
|
|||
|
card.EmployeeID = employee.ID;
|
|||
|
card.UserTypeID = item.ID;
|
|||
|
card.UserType = EnumCardUserType.Spouse;
|
|||
|
this.SetObjectID(card, (HREmployeeDA.GetNewID(tc, "EmpCreditCard", "EmpCreditCardID")));
|
|||
|
HREmployeeDA.Insert(tc, card);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Children
|
|||
|
|
|||
|
foreach (EmpChildren item in employee.ChildrenList)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpChildren", "ChildID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
|
|||
|
if (item.CreditCards != null)
|
|||
|
{
|
|||
|
foreach (EmpCreditCard card in item.CreditCards)
|
|||
|
{
|
|||
|
card.EmployeeID = employee.ID;
|
|||
|
card.UserTypeID = item.ID;
|
|||
|
card.UserType = EnumCardUserType.Children;
|
|||
|
this.SetObjectID(card, (HREmployeeDA.GetNewID(tc, "EmpCreditCard", "EmpCreditCardID")));
|
|||
|
HREmployeeDA.Insert(tc, card);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Experience
|
|||
|
|
|||
|
foreach (EmpExperience item in employee.Experiences)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpExperience", "ExperienceID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Training
|
|||
|
|
|||
|
foreach (EmpTraining item in employee.Trainings)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpTraining", "EmpTrainingID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Academic
|
|||
|
|
|||
|
foreach (EmpAcademic item in employee.Academics)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpAcademic", "AcademicID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region other Qualification
|
|||
|
|
|||
|
#region EmployeeAchivement
|
|||
|
|
|||
|
foreach (EmpAchievement item in employee.Achievements)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpAchivement", "EmpAchivementID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmployeeHobby
|
|||
|
|
|||
|
foreach (EmpHobby item in employee.Hobbies)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpHobby", "EmpHobbyID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmployeeOtherTalent
|
|||
|
|
|||
|
foreach (EmpOtherTalent item in employee.OtherTalents)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpOtherTalent", "EmpOtherTalentID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmployeeCurricularActivity
|
|||
|
|
|||
|
foreach (EmpCurricularActivity item in employee.CurricularActivities)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item,
|
|||
|
(HREmployeeDA.GetNewID(tc, "EmpExtraCurricularActivity", "EmpExtraCurricularActivityID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmployeeAllergy
|
|||
|
|
|||
|
foreach (EmpAllergy item in employee.Allergies)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpAllergy", "EmpAllergyID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Reference
|
|||
|
|
|||
|
foreach (EmpReference item in employee.References)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpReference", "ReferenceID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Publication
|
|||
|
|
|||
|
foreach (EmpPublication item in employee.Publications)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpPublication", "PublicationID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Nominee
|
|||
|
|
|||
|
foreach (EmpNominee item in employee.Nominees)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpNominee", "NomineeID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Hospitalization
|
|||
|
|
|||
|
foreach (EmpHospitalization item in employee.Hospitalizations)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpHospitalization", "HospitalizationID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Guarantor
|
|||
|
|
|||
|
foreach (EmpGuarantor item in employee.Guarantors)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpGuarantor", "GuarantorID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpLanguage
|
|||
|
|
|||
|
foreach (EmpLanguage item in employee.EmpLanguages)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpLanguage", "EmpLanguageID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpRelative
|
|||
|
|
|||
|
foreach (EmpRelative item in employee.EmpRelatives)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpRelative", "EmpRelativeID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpMembership
|
|||
|
|
|||
|
foreach (EmpMembership item in employee.EmpMemberships)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpMembership", "EmpMembershipID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpRelation
|
|||
|
|
|||
|
foreach (EmpRelation item in employee.EmpRelations)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpRelation", "EmpRelationID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpHRQuestionAnswer
|
|||
|
|
|||
|
foreach (EmpHRQuestionAnswer item in employee.EmpHRQuestionAnswers)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(item,
|
|||
|
(HREmployeeDA.GetNewID(tc, "EmpHRQuestionAnswer", "EmpHRQuestionAnswerID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpCreditCard
|
|||
|
|
|||
|
if (employee.CreditCards != null)
|
|||
|
{
|
|||
|
foreach (EmpCreditCard item in employee.CreditCards)
|
|||
|
{
|
|||
|
item.EmployeeID = employee.ID;
|
|||
|
item.UserTypeID = employee.ID;
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpCreditCard", "EmpCreditCardID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
//if(employee.WorkPlanSetup!=null)
|
|||
|
//{
|
|||
|
// employee.WorkPlanSetup.EmployeeID = employee.ID;
|
|||
|
// employee.WorkPlanSetup.CreatedBy = (1); //employee.CreatedBy;
|
|||
|
// employee.WorkPlanSetup.CreatedDate = DateTime.Today;
|
|||
|
// this.SetObjectID(employee.WorkPlanSetup, (HREmployeeDA.GetNewID(tc, "EmployeeWorkPlanSetup", "EmployeeWorkPlanSetupID")));
|
|||
|
// HREmployeeDA.Insert(tc, employee.WorkPlanSetup);
|
|||
|
|
|||
|
//}
|
|||
|
}
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void SaveEmployeeProfileUpload(List<HREmployee> oEmployees)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
foreach (HREmployee item in oEmployees)
|
|||
|
{
|
|||
|
if (item.IsNew)
|
|||
|
{
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc)));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
#region Email
|
|||
|
if (item.EmailAddress.Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployeeDA.UpdateEmail(tc, item);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Mobile
|
|||
|
if (item.MobileNo.Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployeeDA.UpdateMobile(tc, item);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Blood Group
|
|||
|
if (item.BloodGroup != EnumBloodGroup.None || item.BloodGroup != EnumBloodGroup.NA)
|
|||
|
{
|
|||
|
HREmployeeDA.UpdateBloodgroup(tc, item);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region National ID
|
|||
|
if (item.NationalID.Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployeeDA.UpdateNationalID(tc, item);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region TIN
|
|||
|
if (item.TinNo.Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployeeDA.UpdateTin(tc, item);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
|
|||
|
public int SavePersonalInfo(HREmployee employee)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
/*if (employee.BloodGroup > 0) employee.ProfileComplitionPercent += 5;
|
|||
|
if (employee.NationalID != string.Empty) employee.ProfileComplitionPercent += 5;
|
|||
|
if (employee.PhotoPath != string.Empty) employee.ProfileComplitionPercent += 5;
|
|||
|
if (employee.Contacts.Count > 0) employee.ProfileComplitionPercent += 30;
|
|||
|
if (employee.Academics.Count > 0) employee.ProfileComplitionPercent += 30;*/
|
|||
|
|
|||
|
if (employee.IsNew)
|
|||
|
{
|
|||
|
this.SetObjectID(employee, (HREmployeeDA.GetNewID(tc)));
|
|||
|
|
|||
|
HREmployeeDA.Insert(tc, employee);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
HREmployeeDA.Update(tc, employee);
|
|||
|
ProfileUpdateRequestDA.UpdateProfilePercentage(tc, employee.ID);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
tc.End();
|
|||
|
return employee.ID;
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
public int Save(HREmployee employee)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
try
|
|||
|
{
|
|||
|
HREmployeeDA.UpdateForSelfService(tc, employee);
|
|||
|
if (employee.Contacts != null && employee.Contacts.Count > 0)
|
|||
|
{
|
|||
|
if (employee.Contacts[0].IsNew)
|
|||
|
{
|
|||
|
employee.Contacts[0].EmployeeID = employee.ID;
|
|||
|
this.SetObjectID(employee.Contacts[0], (HREmployeeDA.GetNewID(tc, "EmpContact", "ContactID")));
|
|||
|
HREmployeeDA.Insert(tc, employee.Contacts[0]);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
HREmployeeDA.UpdateForSelfService(tc, employee.Contacts[0]);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new Exception(ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
tc.End();
|
|||
|
return employee.ID;
|
|||
|
}
|
|||
|
|
|||
|
public int SaveEmpTraining(EmpTraining empTraining)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
this.SetObjectID(empTraining, (HREmployeeDA.GetNewID(tc, "EmpTraining", "EmpTrainingID")));
|
|||
|
HREmployeeDA.Insert(tc, empTraining);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
return empTraining.ID;
|
|||
|
}
|
|||
|
|
|||
|
public void UpdateStatus(int employeeID, EnumEmployeeStatus status)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
HREmployeeDA.UpdateStatus(tc, employeeID, status);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void UpdatePassword(string password, int id)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
HREmployeeDA.UpdatePassword(tc, password, id);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public int SaveContact(EmpContact contactInfo)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
if (contactInfo.IsNew == true)
|
|||
|
{
|
|||
|
this.SetObjectID(contactInfo, (HREmployeeDA.GetNewID(tc, "EmpContact", "ContactID")));
|
|||
|
HREmployeeDA.Insert(tc, contactInfo);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
HREmployeeDA.update(tc, contactInfo);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(ex);
|
|||
|
throw new ServiceException(ex.Message, ex);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
tc.End();
|
|||
|
return contactInfo.ID;
|
|||
|
}
|
|||
|
|
|||
|
public int SaveEmpNominee(EmpNominee nominee)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
int? PurposePercentageCount = 0;
|
|||
|
int? DBPurposePercentageCount = 0;
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetPurposePercentage(tc, nominee));
|
|||
|
if (dr.Read())
|
|||
|
{
|
|||
|
//count total percentage from database, purpose id wise
|
|||
|
DBPurposePercentageCount = dr.GetInt32(0);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
if (nominee.IsNew)
|
|||
|
{
|
|||
|
//count percentage for new entry
|
|||
|
PurposePercentageCount = DBPurposePercentageCount + (int)nominee.Percentage;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
List<EmpNominee> nominees = this.GetEmpNominees(tc, nominee.EmployeeID);
|
|||
|
int ExistingNomineePercentage = (int)nominees.Find(x => x.ID == nominee.ID).Percentage;
|
|||
|
//count percentage for updatation
|
|||
|
PurposePercentageCount = (DBPurposePercentageCount - ExistingNomineePercentage) + (int)nominee.Percentage;
|
|||
|
}
|
|||
|
if (PurposePercentageCount > 100)
|
|||
|
{
|
|||
|
throw new InvalidOperationException(nominee.NominationPurpose.Description + " exceeds the limit");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (nominee.IsNew)
|
|||
|
{
|
|||
|
if (nominee.NominationPurposeID != 0)
|
|||
|
{
|
|||
|
//nominee.NominationPurpose = new NominationPurposeService().Get(nominee.NominationPurposeID);
|
|||
|
//List<NominationPurpose> NominationPurposes = new List<NominationPurpose>();
|
|||
|
//NominationPurposes = new NominationPurposeService().GetListbyId(nominee.NominationPurposeID);
|
|||
|
//if (NominationPurposes.Count > 0)
|
|||
|
// throw new InvalidOperationException("A nominee with the purpose '" + nominee.NominationPurpose.Description + "' already exists.");
|
|||
|
|
|||
|
//List<EmpNominee> nominees = this.GetEmpNominees(tc, nominee.EmployeeID);
|
|||
|
//if (nominees.Count > 0)
|
|||
|
//{
|
|||
|
// EmpNominee empNominee = nominees.Find(x => x.NominationPurposeID == nominee.NominationPurposeID);
|
|||
|
// if (empNominee != null)
|
|||
|
// throw new InvalidOperationException("A nominee with the purpose '" + nominee.NominationPurpose.Description + "' already exists.");
|
|||
|
//}
|
|||
|
|
|||
|
this.SetObjectID(nominee, (HREmployeeDA.GetNewID(tc, "EmpNominee", "NomineeID")));
|
|||
|
HREmployeeDA.Insert(tc, nominee);
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
HREmployeeDA.Update(tc, nominee);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(ex);
|
|||
|
throw new ServiceException(ex.Message, ex);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
tc.End();
|
|||
|
return nominee.ID;
|
|||
|
}
|
|||
|
public int SaveExperience(EmpExperience item)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
if (item.IsNew == true)
|
|||
|
{
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpExperience", "ExperienceID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
HREmployeeDA.update(tc, item);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(ex);
|
|||
|
throw new ServiceException(ex.Message, ex);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
tc.End();
|
|||
|
return item.ID;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public int SaveSpouce(EmpSpouse item)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
if (item.IsNew == true)
|
|||
|
{
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpSpouse", "SpouseID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
HREmployeeDA.update(tc, item);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(ex);
|
|||
|
throw new ServiceException(ex.Message, ex);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
tc.End();
|
|||
|
return item.ID;
|
|||
|
}
|
|||
|
|
|||
|
public int Savechildren(EmpChildren item)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
if (item.IsNew == true)
|
|||
|
{
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpChildren", "ChildID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
HREmployeeDA.update(tc, item);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(ex);
|
|||
|
throw new ServiceException(ex.Message, ex);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
tc.End();
|
|||
|
return item.ID;
|
|||
|
}
|
|||
|
|
|||
|
public int SaveAcademic(EmpAcademic item)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
if (item.IsNew == true)
|
|||
|
{
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpAcademic", "AcademicID")));
|
|||
|
HREmployeeDA.Insert(tc, item);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
HREmployeeDA.update(tc, item);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(ex);
|
|||
|
throw new ServiceException(ex.Message, ex);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
tc.End();
|
|||
|
return item.ID;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public void UpdateEmpWithoutChild(HREmployee employee)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
try
|
|||
|
{
|
|||
|
HREmployeeDA.Update(tc, employee);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(ex);
|
|||
|
throw new ServiceException(ex.Message, ex);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
|
|||
|
public void UpdateUserGroup(HREmployee item)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
HREmployeeDA.UpdateUserGroup(tc, item);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
public void uplaodFile(empFileupload item)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
|
|||
|
{
|
|||
|
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
this.SetObjectID(item, (HREmployeeDA.GetNewID(tc, "EmpFileupload", "EmpFileuploadID")));
|
|||
|
HREmployeeDA.uplaodFile(tc, item);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(ex);
|
|||
|
throw new ServiceException("Failed to save file", ex);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
public void UplaodFileInProfileUpdate(empFileupload item)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
HREmployeeDA.UploadFileInProfileUpdate(tc, item);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(ex);
|
|||
|
throw new ServiceException("Failed to save file", ex);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
public void ApproveUplaodFileInProfileUpdate(empFileupload item)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
HREmployeeDA.uplaodFile(tc, item);
|
|||
|
HREmployeeDA.DeletePictureInProfileUpdate(tc, item);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(ex);
|
|||
|
throw new ServiceException("Failed to save file", ex);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public empFileupload getuploadedFile(int empid, int referenceID, enumEmpFileUploadType type)
|
|||
|
{
|
|||
|
empFileupload item = null;
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oreader = new DataReader(HREmployeeDA.getUloadedFile(tc, empid, referenceID, type));
|
|||
|
if (oreader.Read())
|
|||
|
{
|
|||
|
item = new empFileupload();
|
|||
|
item.fileData = oreader.GetLob("fileData");
|
|||
|
item.employeeID = empid;
|
|||
|
item.referenceID = referenceID;
|
|||
|
item.filetype = type;
|
|||
|
}
|
|||
|
|
|||
|
oreader.Close();
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return item;
|
|||
|
}
|
|||
|
|
|||
|
public empFileupload GetuploadedFileInProfileUpdate(int empid, int referenceID, enumEmpFileUploadType type)
|
|||
|
{
|
|||
|
empFileupload item = null;
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oreader = new DataReader(HREmployeeDA.GetUploadedFileInProfileRequest(tc, empid, referenceID, type));
|
|||
|
if (oreader.Read())
|
|||
|
{
|
|||
|
item = new empFileupload();
|
|||
|
item.fileData = oreader.GetLob("fileData");
|
|||
|
item.employeeID = empid;
|
|||
|
item.referenceID = referenceID;
|
|||
|
item.filetype = type;
|
|||
|
item.fileName = oreader.GetString("fileName");
|
|||
|
item.FileFormat = (EnumFileFormat)oreader.GetInt32("fileFormat").GetValueOrDefault();
|
|||
|
}
|
|||
|
|
|||
|
oreader.Close();
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return item;
|
|||
|
}
|
|||
|
|
|||
|
public List<empFileupload> GetAllAttachmentsById(int empid)
|
|||
|
{
|
|||
|
List<empFileupload> items = new List<empFileupload>();
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oreader = new DataReader(HREmployeeDA.GetAllAttachmentsById(tc, empid));
|
|||
|
while (oreader.Read())
|
|||
|
{
|
|||
|
empFileupload item = new empFileupload();
|
|||
|
item.ID = oreader.GetInt32("empFileuploadid").Value;
|
|||
|
item.fileData = oreader.GetLob("fileData");
|
|||
|
item.employeeID = empid;
|
|||
|
item.referenceID = oreader.GetInt32("referenceid").Value;
|
|||
|
item.filetype = (enumEmpFileUploadType)oreader.GetInt32("fileType").Value;
|
|||
|
item.fileName = oreader.GetString("fileName");
|
|||
|
items.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
oreader.Close();
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return items;
|
|||
|
}
|
|||
|
|
|||
|
public empFileupload GetAttachmentsByType(int empid, int refId, enumEmpFileUploadType type)
|
|||
|
{
|
|||
|
empFileupload item = new empFileupload();
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oreader = new DataReader(HREmployeeDA.GetAllAttachmentsByType(tc, empid, refId, (int)type));
|
|||
|
while (oreader.Read())
|
|||
|
{
|
|||
|
item.ID = oreader.GetInt32("empFileuploadid").Value;
|
|||
|
item.fileData = oreader.GetLob("fileData");
|
|||
|
item.employeeID = empid;
|
|||
|
item.referenceID = oreader.GetInt32("referenceid").Value;
|
|||
|
item.filetype = (enumEmpFileUploadType)oreader.GetInt32("fileType").Value;
|
|||
|
item.fileName = oreader.GetString("fileName");
|
|||
|
}
|
|||
|
|
|||
|
oreader.Close();
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return item;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public void Delete(int id)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
HREmployeeDA.Delete(tc, id);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException("Failed to GetEmployee", e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region child service implimentation
|
|||
|
|
|||
|
#region spouse service implimentation
|
|||
|
|
|||
|
public List<EmpSpouse> GetEmpSpouses(int id)
|
|||
|
{
|
|||
|
List<EmpSpouse> oEmpSpouses = new List<EmpSpouse>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpSpouse(tc, id));
|
|||
|
oEmpSpouses = this.CreateEmpSpouses(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
return oEmpSpouses;
|
|||
|
}
|
|||
|
|
|||
|
public List<EmpSpouse> GetEmpSpouses(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpSpouse> oEmpSpouses = new List<EmpSpouse>();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpSpouse(tc, id));
|
|||
|
oEmpSpouses = this.CreateEmpSpouses(dr);
|
|||
|
dr.Close();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
return oEmpSpouses;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
#region EmpCreditCard service implementation
|
|||
|
|
|||
|
public List<EmpCreditCard> GetEmpCreditCard(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpCreditCard> oEmpCreditCard = new List<EmpCreditCard>();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpCreditCard(tc, id));
|
|||
|
oEmpCreditCard = this.CreateEmpCreditCard(dr);
|
|||
|
dr.Close();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpCreditCard;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpContact service implimentation
|
|||
|
|
|||
|
public List<EmpContact> GetEmpContacts(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpContact> oEmpContacts = new List<EmpContact>();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpContact(tc, id));
|
|||
|
oEmpContacts = this.CreateEmpContactObjects(dr);
|
|||
|
dr.Close();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpContacts;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public List<EmpContact> GetEmpContacts(int id)
|
|||
|
{
|
|||
|
List<EmpContact> oEmpContacts = new List<EmpContact>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpContact(tc, id));
|
|||
|
oEmpContacts = this.CreateEmpContactObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpContacts;
|
|||
|
}
|
|||
|
|
|||
|
public List<EmpContact> GetEmpContacts()
|
|||
|
{
|
|||
|
List<EmpContact> oEmpContacts = new List<EmpContact>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpContact(tc));
|
|||
|
oEmpContacts = this.CreateEmpContactObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
return oEmpContacts;
|
|||
|
}
|
|||
|
|
|||
|
public void SaveMultipleEmployeeContacts(List<EmpContact> oEmpContacts)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
|
|||
|
foreach (var oEmpContact in oEmpContacts)
|
|||
|
{
|
|||
|
if (oEmpContact.IsNew)
|
|||
|
{
|
|||
|
int id = tc.GenerateID("EMPCONTACT", "ContactID");
|
|||
|
base.SetObjectID(oEmpContact, (id));
|
|||
|
HREmployeeDA.Insert(tc, oEmpContact);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
HREmployeeDA.Update(tc, oEmpContact);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException("Failed to GetOpiParameterIndividual", e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpChildren service implimentation
|
|||
|
|
|||
|
public List<EmpChildren> GetEmpChildrens(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpChildren> oEmpChildrens = new List<EmpChildren>();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpChildrens(tc, id));
|
|||
|
oEmpChildrens = this.CreateEmpChildrenObjects(dr);
|
|||
|
dr.Close();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpChildrens;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public List<EmpChildren> GetEmpChildrens(int id)
|
|||
|
{
|
|||
|
List<EmpChildren> oEmpChildrens = new List<EmpChildren>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpChildrens(tc, id));
|
|||
|
oEmpChildrens = this.CreateEmpChildrenObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpChildrens;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpPublication service implimentation
|
|||
|
|
|||
|
public List<EmpPublication> GetEmpPublications(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpPublication> oEmpPublications = new List<EmpPublication>();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpPublications(tc, id));
|
|||
|
oEmpPublications = this.CreateEmpPublicationObjects(dr);
|
|||
|
dr.Close();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpPublications;
|
|||
|
}
|
|||
|
|
|||
|
public List<EmpPublication> GetEmpPublications(int id)
|
|||
|
{
|
|||
|
List<EmpPublication> oEmpPublications = new List<EmpPublication>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpPublications(tc, id));
|
|||
|
oEmpPublications = this.CreateEmpPublicationObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpPublications;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpReference service implimentation
|
|||
|
|
|||
|
public List<EmpReference> GetEmpReferences(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpReference> oEmpReferences = new List<EmpReference>();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpReferences(tc, id));
|
|||
|
oEmpReferences = this.CreateEmpReferenceObjects(dr);
|
|||
|
dr.Close();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpReferences;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public List<EmpReference> GetEmpReferences(int id)
|
|||
|
{
|
|||
|
List<EmpReference> oEmpReferences = new List<EmpReference>();
|
|||
|
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpReferences(tc, id));
|
|||
|
oEmpReferences = this.CreateEmpReferenceObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpReferences;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpExperience service implimentation
|
|||
|
|
|||
|
public List<EmpExperience> GetEmpExperiences(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpExperience> oEmpExperiences = new List<EmpExperience>();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpExperiences(tc, id));
|
|||
|
oEmpExperiences = this.CreateEmpExperienceObjects(dr);
|
|||
|
dr.Close();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpExperiences;
|
|||
|
}
|
|||
|
|
|||
|
public DataTable GetTrainingForEss(int employeeId)
|
|||
|
{
|
|||
|
DataTable dt = new DataTable();
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
dt = HREmployeeDA.GetTrainingForEss(tc, employeeId);
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return dt;
|
|||
|
}
|
|||
|
|
|||
|
public List<EmpExperience> GetEmpExperiences(int empId)
|
|||
|
{
|
|||
|
List<EmpExperience> oEmpExperiences = new List<EmpExperience>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpExperiences(tc, empId));
|
|||
|
oEmpExperiences = this.CreateEmpExperienceObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpExperiences;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpTraining service implimentation
|
|||
|
|
|||
|
public List<EmpTraining> GetEmpTrainings(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpTraining> oEmpTrainings = new List<EmpTraining>();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpTrainings(tc, id));
|
|||
|
oEmpTrainings = this.CreateEmpTrainingObjects(dr);
|
|||
|
dr.Close();
|
|||
|
oEmpTrainings.ForEach(x =>
|
|||
|
{
|
|||
|
if (x.TrainingTypeID != null)
|
|||
|
x.TrainingType = new TrainingTypeService().Get(x.TrainingTypeID);
|
|||
|
if (x.InstitutionID != null)
|
|||
|
x.Institution = new InstitutionService().Get(x.InstitutionID);
|
|||
|
if (x.NatureOfTrainingID != null)
|
|||
|
x.NatureOfTraining = new NatureOfTrainingService().Get(x.NatureOfTrainingID);
|
|||
|
if (x.CountryID != null)
|
|||
|
x.Country = new CountryService().Get(x.CountryID);
|
|||
|
});
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpTrainings;
|
|||
|
}
|
|||
|
|
|||
|
public List<EmpTraining> GetEmpTrainings(int id)
|
|||
|
{
|
|||
|
List<EmpTraining> oEmpTrainings = new List<EmpTraining>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpTrainings(tc, id));
|
|||
|
oEmpTrainings = this.CreateEmpTrainingObjects(dr);
|
|||
|
dr.Close();
|
|||
|
oEmpTrainings.ForEach(x =>
|
|||
|
{
|
|||
|
if (x.TrainingTypeID != null)
|
|||
|
x.TrainingType = new TrainingTypeService().Get(x.TrainingTypeID);
|
|||
|
if (x.InstitutionID != null)
|
|||
|
x.Institution = new InstitutionService().Get(x.InstitutionID);
|
|||
|
});
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpTrainings;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpNominee service implimentation
|
|||
|
|
|||
|
public List<EmpNominee> GetEmpNominees(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpNominee> oEmpNominees = new List<EmpNominee>();
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpNominees(tc, id));
|
|||
|
oEmpNominees = this.CreateEmpNomineeObjects(dr);
|
|||
|
dr.Close();
|
|||
|
oEmpNominees.ForEach(x =>
|
|||
|
{
|
|||
|
if (x.NominationPurposeID != null)
|
|||
|
x.NominationPurpose = new NominationPurposeService().Get(x.NominationPurposeID);
|
|||
|
if (x.RelationID != null)
|
|||
|
x.Relation = new RelationService().Get(x.RelationID);
|
|||
|
});
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpNominees;
|
|||
|
}
|
|||
|
|
|||
|
public List<EmpNominee> GetEmpNominees(int id)
|
|||
|
{
|
|||
|
List<EmpNominee> oEmpNominees = new List<EmpNominee>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpNominees(tc, id));
|
|||
|
oEmpNominees = this.CreateEmpNomineeObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpNominees;
|
|||
|
}
|
|||
|
|
|||
|
public DataTable GetNomineesForEss(int employeeId)
|
|||
|
{
|
|||
|
DataTable dt = null;
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
dt = HREmployeeDA.GetNomineesForEss(tc, employeeId);
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return dt;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpAcademic service implimentation
|
|||
|
|
|||
|
public List<EmpAcademic> GetEmpAcademics(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpAcademic> oEmpAcademics = new List<EmpAcademic>();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpAcademics(tc, id));
|
|||
|
oEmpAcademics = this.CreateEmpAcademicObjects(dr);
|
|||
|
dr.Close();
|
|||
|
oEmpAcademics.ForEach(x =>
|
|||
|
{
|
|||
|
if (x.EducationLevelID != null)
|
|||
|
x.EducationLevel = new EducationLevelService().Get(x.EducationLevelID);
|
|||
|
if (x.InstitutionID != null)
|
|||
|
x.Institution = new InstitutionService().Get(x.InstitutionID);
|
|||
|
//if (x.EducationTypeID != null)
|
|||
|
// x.EducationType = new EducationTypeService().Get(x.EducationTypeID);
|
|||
|
if (x.DisciplineID != null)
|
|||
|
x.Discipline = new DisciplineService().Get(x.DisciplineID);
|
|||
|
if (x.ResultTypeID != null)
|
|||
|
x.ResultType = new ResultTypeService().Get(x.ResultTypeID);
|
|||
|
if (x.EducationTypeID == 0)
|
|||
|
{
|
|||
|
x.EducationTypeID = x.EducationLevel.EducationTypeID;
|
|||
|
x.EducationType = new EducationTypeService().Get(x.EducationTypeID);
|
|||
|
}
|
|||
|
});
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpAcademics;
|
|||
|
}
|
|||
|
|
|||
|
public List<EmpAcademic> GetEmpAcademics(int id)
|
|||
|
{
|
|||
|
List<EmpAcademic> oEmpAcademics = new List<EmpAcademic>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpAcademics(tc, id));
|
|||
|
oEmpAcademics = this.CreateEmpAcademicObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpAcademics;
|
|||
|
}
|
|||
|
|
|||
|
public DataSet GetSelfServiceAcademic(int employeeId)
|
|||
|
{
|
|||
|
DataSet ds = new DataSet();
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
ds = HREmployeeDA.GetSelfServiceAcademic(tc, employeeId);
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return ds;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpAchievement service implimentation
|
|||
|
|
|||
|
public List<EmpAchievement> GetEmpAchievements(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpAchievement> oEmpAchievements = new List<EmpAchievement>();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpAchievements(tc, id));
|
|||
|
oEmpAchievements = this.CreateEmpAchievementObjects(dr);
|
|||
|
dr.Close();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpAchievements;
|
|||
|
}
|
|||
|
|
|||
|
public List<EmpAchievement> GetEmpAchievements(int id)
|
|||
|
{
|
|||
|
List<EmpAchievement> oEmpAchievements = new List<EmpAchievement>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpAchievements(tc, id));
|
|||
|
oEmpAchievements = this.CreateEmpAchievementObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpAchievements;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpCurricularActivity service implimentation
|
|||
|
|
|||
|
public List<EmpCurricularActivity> GetEmpCurricularActivitys(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpCurricularActivity> oEmpCurricularActivitys = new List<EmpCurricularActivity>();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpCurricularActivities(tc, id));
|
|||
|
oEmpCurricularActivitys = this.CreateEmpCurricularActivityObjects(dr);
|
|||
|
dr.Close();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpCurricularActivitys;
|
|||
|
}
|
|||
|
|
|||
|
public List<EmpCurricularActivity> GetEmpCurricularActivitys(int id)
|
|||
|
{
|
|||
|
List<EmpCurricularActivity> oEmpCurricularActivitys = new List<EmpCurricularActivity>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpCurricularActivities(tc, id));
|
|||
|
oEmpCurricularActivitys = this.CreateEmpCurricularActivityObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpCurricularActivitys;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpOtherTalent service implimentation
|
|||
|
|
|||
|
public List<EmpOtherTalent> GetEmpOtherTalents(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpOtherTalent> oEmpOtherTalents = new List<EmpOtherTalent>();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpOtherTalents(tc, id));
|
|||
|
oEmpOtherTalents = this.CreateEmpOtherTalentObjects(dr);
|
|||
|
dr.Close();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpOtherTalents;
|
|||
|
}
|
|||
|
|
|||
|
public List<EmpOtherTalent> GetEmpOtherTalents(int id)
|
|||
|
{
|
|||
|
List<EmpOtherTalent> oEmpOtherTalents = new List<EmpOtherTalent>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpOtherTalents(tc, id));
|
|||
|
oEmpOtherTalents = this.CreateEmpOtherTalentObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpOtherTalents;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpHobby service implimentation
|
|||
|
|
|||
|
public List<EmpHobby> GetEmpHobbys(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpHobby> oEmpHobbys = new List<EmpHobby>();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmployeeHobbys(tc, id));
|
|||
|
oEmpHobbys = this.CreateEmpHobbyObjects(dr);
|
|||
|
dr.Close();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpHobbys;
|
|||
|
}
|
|||
|
|
|||
|
public List<EmpHobby> GetEmpHobbys(int id)
|
|||
|
{
|
|||
|
List<EmpHobby> oEmpHobbys = new List<EmpHobby>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmployeeHobbys(tc, id));
|
|||
|
oEmpHobbys = this.CreateEmpHobbyObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpHobbys;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpAllergy service implimentation
|
|||
|
|
|||
|
public List<EmpAllergy> GetEmpAllergys(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpAllergy> oEmpAllergys = new List<EmpAllergy>();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpAllergies(tc, id));
|
|||
|
oEmpAllergys = this.CreateEmpAllergyObjects(dr);
|
|||
|
dr.Close();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpAllergys;
|
|||
|
}
|
|||
|
|
|||
|
public List<EmpAllergy> GetEmpAllergys(int id)
|
|||
|
{
|
|||
|
List<EmpAllergy> oEmpAllergys = new List<EmpAllergy>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpAllergies(tc, id));
|
|||
|
oEmpAllergys = this.CreateEmpAllergyObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpAllergys;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpHospitalization service implimentation
|
|||
|
|
|||
|
public List<EmpHospitalization> GetEmpHospitalizations(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpHospitalization> oEmpHospitalizations = new List<EmpHospitalization>();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpHospitalizations(tc, id));
|
|||
|
oEmpHospitalizations = this.CreateEmpHospitalizationObjects(dr);
|
|||
|
dr.Close();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpHospitalizations;
|
|||
|
}
|
|||
|
|
|||
|
public List<EmpHospitalization> GetEmpHospitalizations(int id)
|
|||
|
{
|
|||
|
List<EmpHospitalization> oEmpHospitalizations = new List<EmpHospitalization>();
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpHospitalizations(tc, id));
|
|||
|
oEmpHospitalizations = this.CreateEmpHospitalizationObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpHospitalizations;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpGuarantor service implimentation
|
|||
|
|
|||
|
public List<EmpGuarantor> GetEmpGuarantors(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpGuarantor> oEmpGuarantors = new List<EmpGuarantor>();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpGuarantors(tc, id));
|
|||
|
oEmpGuarantors = this.CreateEmpGuarantorObjects(dr);
|
|||
|
dr.Close();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpGuarantors;
|
|||
|
}
|
|||
|
|
|||
|
public List<EmpGuarantor> GetEmpGuarantors(int id)
|
|||
|
{
|
|||
|
List<EmpGuarantor> oEmpGuarantors = new List<EmpGuarantor>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpGuarantors(tc, id));
|
|||
|
oEmpGuarantors = this.CreateEmpGuarantorObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpGuarantors;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpLanguage service implementation
|
|||
|
|
|||
|
public List<EmpLanguage> GetEmpLanguages(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpLanguage> oEmpLanguages = new List<EmpLanguage>();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpLanguages(tc, id));
|
|||
|
oEmpLanguages = this.CreateEmpLanguageObjects(dr);
|
|||
|
dr.Close();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpLanguages;
|
|||
|
}
|
|||
|
|
|||
|
public List<EmpLanguage> GetEmpLanguages(int id)
|
|||
|
{
|
|||
|
List<EmpLanguage> oEmpLanguages = new List<EmpLanguage>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpLanguages(tc, id));
|
|||
|
oEmpLanguages = this.CreateEmpLanguageObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpLanguages;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpRelative service implementation
|
|||
|
|
|||
|
public List<EmpRelative> GetEmpRelatives(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpRelative> oEmpRelatives = new List<EmpRelative>();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpRelatives(tc, id));
|
|||
|
oEmpRelatives = this.CreateEmpRelativeObjects(dr);
|
|||
|
dr.Close();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpRelatives;
|
|||
|
}
|
|||
|
|
|||
|
public List<EmpRelative> GetEmpRelatives(int id)
|
|||
|
{
|
|||
|
List<EmpRelative> oEmpRelatives = new List<EmpRelative>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpRelatives(tc, id));
|
|||
|
oEmpRelatives = this.CreateEmpRelativeObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpRelatives;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpMembership service implementation
|
|||
|
|
|||
|
public List<EmpMembership> GetEmpMemberships(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpMembership> oEmpMemberships = new List<EmpMembership>();
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpMemberships(tc, id));
|
|||
|
oEmpMemberships = this.CreateEmpMembershipObjects(dr);
|
|||
|
dr.Close();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpMemberships;
|
|||
|
}
|
|||
|
|
|||
|
public List<EmpMembership> GetEmpMemberships(int id)
|
|||
|
{
|
|||
|
List<EmpMembership> oEmpMemberships = new List<EmpMembership>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpMemberships(tc, id));
|
|||
|
oEmpMemberships = this.CreateEmpMembershipObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpMemberships;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpRelation service implementation
|
|||
|
|
|||
|
public List<EmpRelation> GetEmpRelations(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpRelation> oEmpRelations = new List<EmpRelation>();
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpRelations(tc, id));
|
|||
|
oEmpRelations = this.CreateEmpRelationObjects(dr);
|
|||
|
dr.Close();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpRelations;
|
|||
|
}
|
|||
|
|
|||
|
public List<EmpRelation> GetEmpRelations(int id)
|
|||
|
{
|
|||
|
List<EmpRelation> oEmpRelations = new List<EmpRelation>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpRelations(tc, id));
|
|||
|
oEmpRelations = this.CreateEmpRelationObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpRelations;
|
|||
|
}
|
|||
|
|
|||
|
public List<EmpRelation> GetAllEmpRelations()
|
|||
|
{
|
|||
|
List<EmpRelation> oEmpRelations = new List<EmpRelation>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetAllEmpRelations(tc));
|
|||
|
oEmpRelations = this.CreateEmpRelationObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oEmpRelations;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
public List<int> GetMaritalStats()
|
|||
|
{
|
|||
|
List<int> list = new List<int>();
|
|||
|
DataSet ds = new DataSet();
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
ds = HREmployeeDA.GetMaritalStats(tc);
|
|||
|
if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
|
|||
|
{
|
|||
|
foreach (DataRow dataRow in ds.Tables[0].Rows)
|
|||
|
{
|
|||
|
list.Add(int.Parse(dataRow["MaritalStatusCount"].ToString()));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/*list.Add( HREmployeeDA.GetMaritalStatsWhenMarried(tc));
|
|||
|
list.Add( HREmployeeDA.GetMaritalStatsWhenUnMarried(tc));
|
|||
|
list.Add( HREmployeeDA.GetMaritalStatsWhenDivorced(tc));
|
|||
|
list.Add( HREmployeeDA.GetMaritalStatsWhenWidow(tc));*/
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
return list;
|
|||
|
}
|
|||
|
|
|||
|
public List<dynamic> GetChildrenCount()
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
DataTable dt = new DataTable();
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
dt = HREmployeeDA.GetChildrenCount(tc);
|
|||
|
var result = dt.AsEnumerable().Select(x => new
|
|||
|
{
|
|||
|
ChildCount = x["Number_of_child"],
|
|||
|
TotalEmployees = x["total_employees"]
|
|||
|
}).ToList<dynamic>();
|
|||
|
try
|
|||
|
{
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
return result;
|
|||
|
}
|
|||
|
public DataSet GetSelfServiceFamilyInfo(int employeeId)
|
|||
|
{
|
|||
|
DataSet ds = new DataSet();
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
ds = HREmployeeDA.GetSelfServiceFamilyInfo(tc, employeeId);
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return ds;
|
|||
|
}
|
|||
|
|
|||
|
public List<dynamic> GetAcademicStat()
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
var result = new List<dynamic>();
|
|||
|
try
|
|||
|
{
|
|||
|
int totalMasters = 0;
|
|||
|
int totalBachelor = 0;
|
|||
|
int totalOthers = 0;
|
|||
|
DataTable dt = new DataTable();
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
dt = HREmployeeDA.GetAcademicStat(tc);
|
|||
|
|
|||
|
DataTable temp = new DataTable();
|
|||
|
temp.Columns.Add("Total");
|
|||
|
temp.Columns.Add("Description");
|
|||
|
//temp.Columns.Add("Code");
|
|||
|
|
|||
|
foreach (DataRow dataRow in dt.Rows)
|
|||
|
{
|
|||
|
if (Convert.ToString(dataRow["Code"]) == "001" ||
|
|||
|
Convert.ToString(dataRow["Code"]) == "002" ||
|
|||
|
Convert.ToString(dataRow["Code"]) == "003" ||
|
|||
|
Convert.ToString(dataRow["Code"]) == "004" ||
|
|||
|
Convert.ToString(dataRow["Code"]) == "005" ||
|
|||
|
Convert.ToString(dataRow["Code"]) == "006")
|
|||
|
{
|
|||
|
temp.Rows.Add(dataRow["Total"] = totalMasters + Convert.ToInt32(dataRow["Total"]),
|
|||
|
dataRow["Description"] = "Master's Degree");
|
|||
|
totalMasters = Convert.ToInt32(dataRow["Total"]);
|
|||
|
}
|
|||
|
else if (Convert.ToString(dataRow["Code"]) == "007" ||
|
|||
|
Convert.ToString(dataRow["Code"]) == "008" ||
|
|||
|
Convert.ToString(dataRow["Code"]) == "009" ||
|
|||
|
Convert.ToString(dataRow["Code"]) == "010" ||
|
|||
|
Convert.ToString(dataRow["Code"]) == "011" ||
|
|||
|
Convert.ToString(dataRow["Code"]) == "012" ||
|
|||
|
Convert.ToString(dataRow["Code"]) == "013")
|
|||
|
{
|
|||
|
temp.Rows.Add(dataRow["Total"] = totalBachelor + Convert.ToInt32(dataRow["Total"]),
|
|||
|
dataRow["Description"] = "Bachelor Degree");
|
|||
|
totalBachelor = Convert.ToInt32(dataRow["Total"]);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
temp.Rows.Add(dataRow["Total"] = totalOthers + Convert.ToInt32(dataRow["Total"]),
|
|||
|
dataRow["Description"] = "Others");
|
|||
|
totalOthers = Convert.ToInt32(dataRow["Total"]);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
result = temp.AsEnumerable().Select(x => new
|
|||
|
{
|
|||
|
Total = x["Total"],
|
|||
|
Description = x["Description"]
|
|||
|
}).ToList<dynamic>();
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
public int GetProfileCompletePercentage(int empId)
|
|||
|
{
|
|||
|
int ans;
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
ans = HREmployeeDA.GetProfileCompletePercentage(tc, empId);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
return ans;
|
|||
|
}
|
|||
|
|
|||
|
public List<int> GetEmployeeMaleStatByAge()
|
|||
|
{
|
|||
|
List<int> list = new List<int>();
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
list.Add(HREmployeeDA.GetEmployeeMaleAgeStat18_25(tc));
|
|||
|
list.Add(HREmployeeDA.GetEmployeeMaleAgeStat26_35(tc));
|
|||
|
list.Add(HREmployeeDA.GetEmployeeMaleAgeStat36_45(tc));
|
|||
|
list.Add(HREmployeeDA.GetEmployeeMaleAgeStat46_55(tc));
|
|||
|
list.Add(HREmployeeDA.GetEmployeeMaleAgeStat56_(tc));
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
return list;
|
|||
|
}
|
|||
|
|
|||
|
public List<int> GetEmployeeFemaleStatByAge()
|
|||
|
{
|
|||
|
List<int> list = new List<int>();
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
list.Add(HREmployeeDA.GetEmployeeFemaleAgeStat18_25(tc));
|
|||
|
list.Add(HREmployeeDA.GetEmployeeFemaleAgeStat26_35(tc));
|
|||
|
list.Add(HREmployeeDA.GetEmployeeFemaleAgeStat36_45(tc));
|
|||
|
list.Add(HREmployeeDA.GetEmployeeFemaleAgeStat46_55(tc));
|
|||
|
list.Add(HREmployeeDA.GetEmployeeFemaleAgeStat56_(tc));
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
return list;
|
|||
|
}
|
|||
|
|
|||
|
#region EmpHRQuestionAnswer service implementation
|
|||
|
|
|||
|
public List<EmpHRQuestionAnswer> GetEmpHRQuestionAnswers(TransactionContext tc, int id)
|
|||
|
{
|
|||
|
List<EmpHRQuestionAnswer> oHRQuestionAnswers = new List<EmpHRQuestionAnswer>();
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpHRQuestionAnswers(tc, id));
|
|||
|
oHRQuestionAnswers = this.CreateEmpHRQuestionAnswerObjects(dr);
|
|||
|
dr.Close();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oHRQuestionAnswers;
|
|||
|
}
|
|||
|
|
|||
|
public List<EmpHRQuestionAnswer> GetEmpHRQuestionAnswers(int id)
|
|||
|
{
|
|||
|
List<EmpHRQuestionAnswer> oHRQuestionAnswers = new List<EmpHRQuestionAnswer>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader dr = new DataReader(HREmployeeDA.GetEmpHRQuestionAnswers(tc, id));
|
|||
|
oHRQuestionAnswers = this.CreateEmpHRQuestionAnswerObjects(dr);
|
|||
|
dr.Close();
|
|||
|
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
return oHRQuestionAnswers;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|