EchoTex_Payroll/HRM.BO/Employee/Employee.cs

662 lines
26 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00
using System;
using System.Linq;
using System.Data;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Ease.Core.Model;
using Ease.Core.DataAccess;
using Ease.Core;
namespace HRM.BO
{
#region Employee
// do not change following class (Employee) without discuss Shamim
public class Employee : AuditTrailBase
{
#region Constructor
public Employee()
{
GlobalID = string.Empty;
EmployeeNo = string.Empty;
Name = string.Empty;
Gender = EnumGender.Male;
BirthDate = DateTime.MinValue;
JoiningDate = DateTime.MinValue;
EndOfContractDate = null;
EmailAddress = string.Empty;
MobileNo = string.Empty;
TinNo = string.Empty;
ForeignExPat = false;
ContinueGratuity = 0;
TaxCircle = EnumTaxCircle.CityCorporation;
IsConfirmed = false;
Status = EnumEmployeeStatus.Live;
IsShownInTaxSheet = false;
PFMemberType = EnumPFMembershipType.NotYetLive;
PFMemberShiptDate = DateTime.MinValue;
BranchID = null;
AccountNo = string.Empty;
OutPayBranchID = null;
OutPayAccountNo = string.Empty;
DepartmentID = null;
LocationID = null;
MaritalStatus = EnumMaritalStatus.UnMarried;
DesignationID = null;
GradeID = null;
BasicSalary = 0;
PrevBasic = 0;
PaymentMode = EnumPaymentMode.CashPayment;
OutPayPaymentMode = EnumPaymentMode.CashPayment;
FatherName = string.Empty;
IsEligibleOT = false;
DescriptionText = string.Empty;
DesktopUserPass = string.Empty;
IsAutoProcess = false;
CardID = null;
GrossSalary = 0;
PhotoPath = string.Empty;
PayScaleId = null;
TaxAmount = 0;
ConfirDate = null;
DiscontinueDate = null;
CurrentHistoryID = null;
//Branch = null;
//Category = null;
////_costCenter = null;
//Department = null;
Designation = null;
//Grade = null;
//Location = null;
////_outPayBranch = null;
//Religion = null;
PFMemberShiptDate = null;
EndOfContractDate = null;
InclusionDate = null;
MonthStatusUpdate = EnumEmployeeStatus.Live;
VendorCode = string.Empty;
Role = EnumRoleType.Admin;
PersonType = EnumPersonType.None;
LineManagerID = null;
SecondLineManagerID = null;
this.IsSalaryWithHeld = false;
}
#endregion
#region Properties
// do not change following class (Employee) without discuss Shamim
public string FirstName { get; set; }
public string LastName { get; set; }
public string GlobalID { get; set; }
public string EmployeeNo { get; set; }
public string Name { get; set; }
public EnumGender Gender { get; set; }
public DateTime BirthDate { get; set; }
public DateTime JoiningDate { get; set; }
//public DateTime? RetirementDate { get; set; }
public DateTime? EndOfContractDate { get; set; }
public DateTime? CardDate { get; set; }
public string EmailAddress { get; set; }
public string MobileNo { get; set; }
public string TinNo { get; set; }
public int CategoryID { get; set; }
public bool ForeignExPat { get; set; }
public EnumPersonType PersonType { get; set; }
public EnumProfileStatus ProfileStatus { get; set; }
public string DesignationName { get; set; }
public string DepartmentName { get; set; }
public string GradeName { get; set; }
public string LocationName { get; set; }
//public string SBU { get; set; }
// do not change following class (Employee) without discuss Shamim
public double ContinueGratuity { get; set; } // R
public EnumTaxCircle TaxCircle { get; set; }
public bool IsConfirmed { get; set; }
public virtual EnumEmployeeStatus Status { get; set; }
public bool IsShownInTaxSheet { get; set; } // R
public EnumPFMembershipType PFMemberType { get; set; }
public DateTime? PFMemberShiptDate { get; set; }
public int? BranchID { get; set; }
public string AccountNo { get; set; }
public int? OutPayBranchID { get; set; }
public string OutPayAccountNo { get; set; }
public int? DepartmentID { get; set; }
public int? LocationID { get; set; }
public int ReligionID { get; set; }
public EnumMaritalStatus MaritalStatus { get; set; }
public int? DesignationID { get; set; }
public int? GradeID { get; set; }
public double BasicSalary { get; set; }
public int? CurrentHistoryID { get; set; }
// do not change following class (Employee) without discuss Shamim
public double PrevBasic { get; set; }
public EnumPaymentMode PaymentMode { get; set; }
public EnumPaymentMode OutPayPaymentMode { get; set; }
public string FatherName { get; set; }
public int FatherOccupationId { get; set; }
public string MotherName { get; set; }
public int MotherOccupationId { get; set; }
public bool IsEligibleOT { get; set; }
public string DescriptionText { get; set; }
public string DesktopUserPass { get; set; } //R
public int PayrollTypeID { get; set; }
public bool IsAutoProcess { get; set; } // R
public EnumRoleType Role { get; set; } //R
public int? CardID { get; set; }
public double GrossSalary { get; set; }
public string PhotoPath { get; set; } //R
public int? PayScaleId { get; set; }
public double TaxAmount { get; set; }
public DateTime? ConfirDate { get; set; }
public DateTime? DiscontinueDate { get; set; }
public string ArrearFrom { get; set; } //R
public double SalaryFractionate { get; set; }
public EnumEmployeeStatus MonthStatusUpdate { get; set; }
public Branch Branch { get; set; }
public Category Category { get; set; }
public Department Department { get; set; }
public Designation Designation { get; set; }
public Grade Grade { get; set; }
// do not change following class (Employee) without discuss Shamim
public int? NationalityID { get; set; }
public Nationality Nationality { get; set; }
public Location Location { get; set; }
public Religion Religion { get; set; }
public int? LineManagerID { get; set; }
public string LineManager { get; set; }
public string LineManagerDeg { get; set; }//// template
public string LineManagerDept { get; set; }// template
public EnumGender LMGender { get; set; }// template
public string LineManagerEmail { get; set; }// template
public int? SecondLineManagerID { get; set; }
List<EmployeeCostCenter> EmployeeCostCenters { get; set; }
public string VendorCode { get; set; }
public bool IsFixedLocation { get; set; }
public bool IsSalaryWithHeld { get; set; }
// do not change employee class without discuss Shamim
public DateTime? LastWorkingDate { get; set; }//resignationrequest
public DateTime? ResignationDate { get; set; }//resignationrequest
private EmployeeGradeSalary _employeeGradeSalary;
public EmployeeGradeSalary EmployeeGradeSalary
{
get
{
return _employeeGradeSalary;
}
set { _employeeGradeSalary = value; }
}
// do not change employee class without discuss Shamim
private EmployeePosting _employeePosting;
public EmployeePosting EmployeePosting
{
get
{
return _employeePosting;
}
set { _employeePosting = value; }
}
private EmployeeBankAccount _employeeBankAccount;
public EmployeeBankAccount EmployeeBankAccount
{
get { return _employeeBankAccount; }
set { _employeeBankAccount = value; }
}
private EmployeeBankAccount _employeeOPIBankAccount;
public EmployeeBankAccount EmployeeOPIBankAccount
{
get
{
return _employeeOPIBankAccount;
}
set { _employeeOPIBankAccount = value; }
}
private EmpLifeCycle _EmpLifeCycle;
public EmpLifeCycle EmpLifeCycle
{
get
{
return _EmpLifeCycle;
}
set { _EmpLifeCycle = value; }
}
public string LineManagerNo { get; set; }
public string GeId { get; set; }
public string ExtraField1 { get; set; }
public EnumBaseStation ExtraField2 { get; set; }
public string ExtraField3 { get; set; }
public string ExtraField4 { get; set; }
public string ExtraField5 { get; set; }
public int? CrgId { get; set; }
public int? ProfileCompletionPercent { get; set; }
public string InsuranceId { get; set; }
public DateTime? InclusionDate { get; set; }
public bool HasDisableChildren { get; set; }
public EnumResidence Residence { get; set; }
public string HomeDistrict { get; set; }
public string SpecialIdentificationMark { get; set; }
public string NationalId { get; set; }
public string PassportNo { get; set; }
public string CategoryName { get; set; }
public string Address { get; set; }
// do not change employee class without discuss Shamim
public static string getEmpID(List<Employee> emps)
{
string str = "";
emps.ForEach(x =>
{
if (x != null)
str = str + x.ID + ",";
});
if (str.Length > 0) str = str.Substring(0, str.Length - 1);
return str;
}
public static List<SearchEmployee> getSearchEmp(List<Employee> emps)
{
List<SearchEmployee> items = new List<SearchEmployee>();
emps.ForEach(x =>
{
SearchEmployee item = new SearchEmployee();
item.ID = x.ID;
item.EmployeeID = x.ID;
item.EmployeeNo = x.EmployeeNo;
item.Name = x.Name;
item.designationID = x.DepartmentID == null ? 0 : (int)x.DepartmentID;
item.LocationID = x.LocationID == null ? 0 : (int)x.DepartmentID;
item.GradeID = x.GradeID == null ? 0 : (int)x.DepartmentID;
items.Add(item);
});
return items;
}
//#region SearchEmployee : SearchEmployee
public SearchEmployee getSearchEmployee()
{
SearchEmployee semp = new SearchEmployee();
semp.EmployeeID = this.ID;
semp.DepartmentID = this.DepartmentID ==null? 0: (int) this.DepartmentID;
semp.CategoryID = this.CategoryID;
semp.LocationID = this.LocationID == null ? 0 : (int)this.LocationID ;
semp.GradeID = this.GradeID == null ? 0 : (int)this.GradeID;
semp.EmployeeNo = this.EmployeeNo;
semp.Name = this.Name;
return semp;
}
//#endregion
//#region branch : Branch
//private Branch _branch;
//public Branch Branch
//{
// get
// {
// if (_branch == null && _branchID != null && _branchID.IsUnassigned == false && _branchID.Integer > 0)
// {
// _branch = new Branch();
// _branch = Branch.Get(_branchID);
// }
// return this._branch;
// }
// set
// {
// _branch = value;
// }
//}
//#endregion
//#region category : Category
//private Category _category;
//public Category Category
//{
// get
// {
// if (_categoryID != null && !_categoryID.IsUnassigned)
// {
// if (_categoryID.Integer > 0 && _category == null)
// {
// _category = new Category();
// _category = _category.Get(_categoryID);
// }
// }
// return this._category;
// }
// set
// {
// _category = value;
// }
//}
//#endregion
//#region department : Department
//private Department _department;
//public Department Department
//{
// get
// {
// if (_departmentID != null && _departmentID.IsUnassigned == false && _departmentID.Integer > 0 && _department == null)
// {
// _department = new Department();
// _department = Department.Get(_departmentID);
// }
// return this._department;
// }
// set
// {
// _department = value;
// }
//}
//#endregion
//#region designation : Designation
//private Designation _designation;
//public Designation Designation
//{
// get
// {
// if (_designationID != null && _designationID.IsUnassigned == false && _designationID.Integer > 0 && _designation == null)
// {
// _designation = new Designation();
// _designation = Designation.Get(_designationID);
// }
// return this._designation;
// }
// set
// {
// _designation = value;
// }
//}
//#endregion
//#region grade : Grade
//private Grade _grade;
//public Grade Grade
//{
// get
// {
// if (_gradeID != null && !_gradeID.IsUnassigned)
// {
// if (_gradeID.Integer > 0 && _grade == null)
// {
// _grade = new Grade();
// _grade = Grade.Get(_gradeID);
// }
// }
// return this._grade;
// }
// set
// {
// _grade = value;
// }
//}
//#endregion
//#region location : Location
//private Location _location;
//public Location Location
//{
// get
// {
// if (_locationID != null && _locationID.IsUnassigned == false && _locationID.Integer > 0 && _location == null)
// {
// _location = new Location();
// _location = Location.Get(_locationID);
// }
// return this._location;
// }
// set
// {
// _location = value;
// }
//}
//#endregion
//#region religion : Religion
//private Religion _religion;
//public Religion Religion
//{
// get
// {
// if (_religionID.Integer > 0 && _religion == null)
// {
// _religion = new Religion();
// _religion = Religion.Get(_religionID);
// }
// return this._religion;
// }
// set
// {
// _religion = value;
// }
//}
//#endregion
#endregion
//private List<EmployeeCostCenter> _employeeCostCenters;
//public List<EmployeeCostCenter> EmployeeCostCenters
//{
// get
// {
// if (this.ID != null && !this.ID.IsUnassigned && _employeeCostCenters == null)
// {
// _employeeCostCenters = EmployeeCostCenter.GetByEmpID(this.ID);
// }
// return _employeeCostCenters;
// }
// set
// {
// _employeeCostCenters = value;
// }
//}
#region Service Factory IEmployeeService : IEmployeeService
#endregion
}
#endregion
#region IEmployee Service
public interface IEmployeeService
{
DataTable GetDepartmentName(int empID, bool banglaDescriptionExits);
DataSet GetAllEmpBasicInfo(string empIDs);
List<Employee> GetMaternityLeaveEmployee(DateTime formDate, DateTime toDate);
DataSet GetEmpBasicInfoForPSlip(string sEmpIDs, DateTime dMonth);
DataSet GetEmpDashBoardInfo(int empID);
List<Employee> GetAllSubordinatesNew(int employeeID);
Employee Get(int id);
List<Employee> GetForSuperUser();
Employee GetByCardID(int id);
Employee Get(string emloyeeNo, int payrollTypeID);
Employee GetFromAll(string emloyeeNo, int payrollTypeID);
Employee GetwitoutchekPayrolltype(String employeeNo);
Employee GetParentEmployee(int employeeID);
Employee GetDepartmentHead(EnumOGPositionType type, int departmentID);
Employee GetLineManager(int empId);
List<Employee> GetWithPayrollType(int payrollTypeID);
List<Employee> GetAllEmps();
void UpdateLM2(List<Employee> emps);
List<Employee> GetWithDiscontinue(int payrollTypeID);
List<Employee> GetSubordinates(int employeeID);
//List<Employee> GetAllSubordinates(int nodeID);
List<Employee> GetByDeptShiftGFType(string deptIDs, int shiftID, string GFType, int payrollTypeID);
List<Employee> GetMonthlyAttnEmployee(DateTime fromDate, DateTime toDate, int payrollTypeID);
List<Employee> GetAbsentEmp(DateTime attnDate, EnumWorkPlanGroup wpGroup, int payrollTypeID);//for Attendance Process
List<Employee> GetAttendaceEmp(EnumWorkPlanGroup wpGroup, int payrollTypeID);//for Attendance Process
List<Employee> GetEmpExceptAutoWP(DateTime attnDate, int payrollTypeID);//for Attendance Process
List<Employee> GetDiscontinueEmp(DateTime attnDate, DateTime currentDate, int payrollTypeID);//for Attendance Process
List<Employee> Get(int status, DateTime lastDateOfYear);
List<Employee> Get(EnumEmployeeStatus status, int payrollTypeID);
DataTable GetEmpIDsOfManager(int status, DateTime lastDateOfYear);
void DoConfirm(int employeeID, DateTime confirmDate, DateTime pfMShipDate, bool IsConfirm, bool IsPFMember);
void UndoConfirm(int employeeID, bool IsPFMember);
void UpdateStatus(int employeeID, int HistoryID, DateTime effectDate, EnumEmployeeStatus status);
void UpdatePFMemship(int empID, EnumPFMembershipType PFType, DateTime dPFEffectDate);
void UpdateTaxAmount(int empID, double TaxAmount);
void UpdateEmpRole(Employee oEmp);
List<Employee> GetNew(DateTime dt, int payrollTypeID);
void UpdatePayrollType(int empID, int payrollTypeID, DateTime dEffectDate);
//void SaveIntegration(List<HREmployee> oEmps);
int Save(Employee item);
//void Delete(int id);
//void DeleteAll();
//string GenerateLoanNo(Employee oEmp, string sLoanName);
void UpdateCardInformation(int employeeID, int CardID, bool IsAutoProcess);
void UpdateEmpCardHistory(int employeeID, int CardID, DateTime cardDate, string cardNumber);
//List<Employee> Get(List<SearchEmployee> searchEmployees, int payrollTypeID);
DataSet GetEmpBasicInfo(string sEmpID);
DataSet GetEmpBasicInfoForReport(string sEmpID);
DataSet GetEmpDetails(string sEmpID);
//DataSet GetEmployeeCV(string sEmpID);
/*DataSet GetLineManager(int sEmpID);*/
DataSet GetEmpForLetterOfIntroDuction(string sEmpID, DateTime month);
DataSet GetEmpPosting(string sEmpID);
DataSet GetEmpJoining(DateTime dEffectDate, DateTime dEffectDate2);
DataSet GetEmpConfirmHis(DateTime dEffectDate, DateTime dEffectDate2, int payrollTypeID);
DataSet GetEmpPFHis(DateTime dEffectDate);
int GetDays(int nPayrollTypeID);
//void SaveBasicInfo(Employee item);
List<Employee> GetByEmpIDs(string empIDs, int payrollTypeID);
List<Employee> GetByEmpIDs(string empIDs);
List<Employee> GetFssEmp(string empIDs, int payrollTypeID);
List<Employee> GetEmpsWithDiscontinue(string empIDs, int payrollTypeID);
DataSet GetEmpJoining4Novartis(DateTime dEffectDate, int payrollTypeID);
List<Employee> GetEmployeesYetNotAssigned();
List<Employee> GetEmployeesByJoiningMonth(DateTime fromDate, DateTime toDate);
List<Employee> GetByDeptIDs(string sIDs, int payrollTypeID);
DataSet GetByMonthStartMonthEndForContinueFromDiscontinue(DateTime startmonth, DateTime endmonth, int payrollTypeID);
DataSet GetITAndBasic(DateTime startdate, DateTime endDate);
List<Employee> GetJoiningData(DateTime formDate);
DataTable GetDesignationWiseEmployeeCountsByDepartmentID(int departmentID);
DataTable GetGradeWiseEmployeeCountsByDepartmentID(int departmentID);
DataTable GetGradeWiseEmployeeCounts();
Employee Get4Web(string employeeNo);
DataSet GetCashAdvice(string sEmpIDs, string dSalDate);
//string GenerateLoanNo(Employee employee, Loan oLonan);
List<Employee> GetTopMostEmployees();
List<Employee> GetAssignedEmployees(int nPMPYearID, int nEmpID);
List<Employee> GetGrandChilds(int employeeID);
List<Employee> GetGrandChilds(string sEmpIds);
void UpdateLineManager(List<Employee> employees);
DataSet GetAllGeneralInfo(string sEmpIDs);
DataSet GetAllContactInfo(string sEmpIDs);
DataSet GetSpouseInfo(string sEmpIDs);
DataSet GetChildInfo(string sEmpIDs);
DataSet GetEmpExperienceInfo(string sEmpIDs);
DataSet GetEmpTrainingInfo(string sEmpIDs);
DataSet GetEmpAcademicInfo(string sEmpIDs);
DataSet GetEmpReferenceInfo(string sEmpIDs);
DataSet GetEmpPublicationInfo(string sEmpIDs);
DataSet GetEmpNomineeInfo(string sEmpIDs);
DataSet GetEmployeeGeneralData();
DataSet GetEmployeeSpouseData();
DataSet GetEmployeeContactData();
DataSet GetEmployeeChildrenData();
DataSet GetEmployeeAcademicData();
DataSet GetEmployeeTrainingData();
DataSet GetEmployeeExperienceData();
//void GetLoggedUserCredentials(out Employee emp, out SystemInformation sysInfo, out DataSet dsNotiAndPendi, string logInID);
DataTable GetEmpFromView(string empNo);
DataTable GetShortInformation(string empIDs);
DataTable GetDFSL();
DataSet GetEmpDetailsView(string sEmpID);
DataSet GetEmpDetailsView();
int GetCurrentHeadCount(int departmentId, int designationId, int gradeId);
List<Employee> GetbyDepartment(int deptId);
List<Employee> NotYetAssigned(int payrollTypeID);
DataSet GetEmployeeGenderRatio();
DataSet GetEmployeeSummaryData();
DataSet GetEmployeeAttritionData();
List<Employee> GetByPrimaryLMID(int employeeID);
List<Employee> GetAllLive();
DataSet GetEmployeeSummaryDataByDepartment(Employee emp);
Employee GetByName(string EmpName);
List<Employee> GetFirstLMTeamMembers(int employeeID);
List<Employee> GetSubordinatesByLineManager(int employeeID);
DataSet GetDashBoardGraphData();
List<Employee> GetAllHREmpsWorkAniversary(string payrollTypeId);
List<Employee> GetAllHREmpsBirthday(string payrollTypeId);
List<Employee> GetAllAbsentOnYesterdayEmps(string payrollTypeId);
DataSet GetEstimatedConfirmationReport();
DataSet GetEstimatedRetirementReport();
DataSet GetListOfPromotion();
DataSet GetListOfTransfer();
DataSet GetJobSeparationList();
DataSet GetConfirmedEmployeeList();
DataSet GetSelfServiceBasicData(int employeeId);
DataSet GetSelfServiceContactData(int employeeId);
List<Employee> GetEmployeesRequisitionID(int requisitionID);
DataSet GetLandingPageData(int isEmployee, int isLeave, int isAttendance, int payrollTypeId);
DataSet GetHolidayInfoForDashboard();
DataTable GetOtEligibleEmployees(int payrolltypeid);
DataTable GetEmployeeForDashboard(int ID);
DataTable GetUserForLandingPage(int userId);
DataSet GetEncashmentReport(string sEmpIDs, string leaveYear);
DataSet GetBankAdviceReport(string sEmpIDs, string leaveYear);
DataSet GetEncashPayslip(string sEmpIDs, string leaveYear);
DataSet GetLeaveCashAdvice(string sEmpIDs, string leaveYear);
//Mobile Profile
DataSet GetMobileProfile(int employeeId);
DataSet GetMobileProfileNew(int employeeId);
bool IsCCApplicable(int empid, string companyCode, string salesEmail);
DataTable GetMyTeam(Employee oEmp);
DataTable GetCordinatorTeam(Employee oEmp);
DataTable GetEmployeeCount(Employee oEmp);
DataTable GetEmpOrganogramInfo(Employee oEmp);
DataTable getEmpInfoForGateman(int id);
List<Employee> GetEmployeeByCoordinator(int empID);
DataSet GetEmployeeIncrement(string empIDs);
string GetNextCode(int payrollTypeId);
int SaveHnmEmployee(List<object> employeeData);
Employee GetEmployeeForHnm(int id);
void SaveIntegration(List<Employee> oEmps, int currentUserId, DateTime NextPayProcessDate, DateTime LastPayProcessDate);
}
#endregion
}