9608 lines
492 KiB
C#
9608 lines
492 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Data;
|
|||
|
using Ease.CoreV35.Model;
|
|||
|
using SpreadsheetGear;
|
|||
|
using Ease.CoreV35.Utility;
|
|||
|
using System.Windows.Forms;
|
|||
|
|
|||
|
namespace Payroll.BO
|
|||
|
{
|
|||
|
[Serializable]
|
|||
|
public class RegularDataUpload : ImportFileBase
|
|||
|
{
|
|||
|
#region Private Declarations And Constructors
|
|||
|
private List<UploadErrorOrSuccess> _errorOrSuccessList;
|
|||
|
private DataTable _uplodedData;
|
|||
|
private DataSet _uploadHRData;
|
|||
|
private DataSet _upLoadCVData;
|
|||
|
private BonusProcess _BonusProcess = null;
|
|||
|
private HREmployee _HREmployee = new HREmployee();
|
|||
|
private CV _CV = new CV();
|
|||
|
private DataTable dtWPPFClaim = null;
|
|||
|
private ObjectsTemplate<HREmployee> _HREmployees = null;
|
|||
|
private ObjectsTemplate<Religion> _Religions = null;
|
|||
|
private ObjectsTemplate<Category> _Categories = null;
|
|||
|
private ObjectsTemplate<Occupation> _Occupations = null;
|
|||
|
private ObjectsTemplate<Nationality> _Nationalites = null;
|
|||
|
private ObjectsTemplate<District> _Districts = null;
|
|||
|
private ObjectsTemplate<Thana> _Thanas = null;
|
|||
|
private ObjectsTemplate<Relation> _Relations = null;
|
|||
|
private ObjectsTemplate<EducationLevel> _EducationLevels = null;
|
|||
|
private ObjectsTemplate<NatureOfTraining> _NatureOfTrainings = null;
|
|||
|
private ObjectsTemplate<Institution> _Institutions = null;
|
|||
|
private ObjectsTemplate<Country> _Contries = null;
|
|||
|
private ObjectsTemplate<EducationType> _EducationTypes = null;
|
|||
|
private ObjectsTemplate<Discipline> _Disciplines = null;
|
|||
|
private ObjectsTemplate<ResultType> _ResultTypes = null;
|
|||
|
private ObjectsTemplate<NominationPurpose> _NominationPurposes = null;
|
|||
|
private ObjectsTemplate<GuarantorDocumentType> _GuarantorDocumentTypes = null;
|
|||
|
private ObjectsTemplate<TrainingType> _TrainingTypes = null;
|
|||
|
private ObjectsTemplate<HRJoiningQuestionary> _HRJoiningQuestionaries = null;
|
|||
|
private ObjectsTemplate<EmployeeTaxInvestment> _EmployeeTaxInvestments = null;
|
|||
|
private ObjectsTemplate<TaxChallan> _TaxChallans = null;
|
|||
|
private ObjectsTemplate<Designation> _Designations = null;
|
|||
|
private ObjectsTemplate<OrganogramBasic> _organograms = null;
|
|||
|
private ObjectsTemplate<OrganogramEmployee> _organEmps = null;
|
|||
|
ObjectsTemplate<HREmployee> _CheckHREmployees = null;
|
|||
|
private List<PFTransaction> _PFTransactions = null;
|
|||
|
private EnumEmployeeStatus _enumStatus = EnumEmployeeStatus.Live;
|
|||
|
private int _nTypeID = 0;
|
|||
|
int _nEventID = 0;
|
|||
|
public event ProgressStatus ProgressStatus;
|
|||
|
public event ProcessStatus ProcessStatus;
|
|||
|
private ObjectsTemplate<EmpLifeCycle> _oEmpLifeCycles = new ObjectsTemplate<EmpLifeCycle>();
|
|||
|
|
|||
|
#region New Declaration
|
|||
|
private ObjectsTemplate<Category> _categorys = new ObjectsTemplate<Category>();
|
|||
|
private ObjectsTemplate<Grade> _grades = new ObjectsTemplate<Grade>();
|
|||
|
private ObjectsTemplate<Department> _departments = new ObjectsTemplate<Department>();
|
|||
|
private ObjectsTemplate<Location> _locations = new ObjectsTemplate<Location>();
|
|||
|
private ObjectsTemplate<Religion> _religions = new ObjectsTemplate<Religion>();
|
|||
|
private ObjectsTemplate<Designation> _designations = new ObjectsTemplate<Designation>();
|
|||
|
private ObjectsTemplate<Bank> _banks = new ObjectsTemplate<Bank>();
|
|||
|
private ObjectsTemplate<Branch> _branches = new ObjectsTemplate<Branch>();
|
|||
|
|
|||
|
|
|||
|
private ObjectsTemplate<Employee> _employees = new ObjectsTemplate<Employee>();
|
|||
|
private ObjectsTemplate<IncomeTax> _incomeTaxs = new ObjectsTemplate<IncomeTax>();
|
|||
|
private ObjectsTemplate<AccessCard> _accessCards = new ObjectsTemplate<AccessCard>();
|
|||
|
#endregion Class variable
|
|||
|
|
|||
|
private int _departmentid = 0;
|
|||
|
private int _locationid = 0;
|
|||
|
private int _categoryID = 0;
|
|||
|
private int _religionID = 0;
|
|||
|
private int _designationid = 0;
|
|||
|
private int _gradeid = 0;
|
|||
|
private int _branchid = 0;
|
|||
|
private int _bankid = 0;
|
|||
|
private int _emloyeeId = 0;
|
|||
|
private int _accessCardID = 0;
|
|||
|
|
|||
|
#endregion
|
|||
|
private void UpdateProgressStatus(EnumProcessStatus status)
|
|||
|
{
|
|||
|
if (ProgressStatus != null) ProgressStatus(status);
|
|||
|
}
|
|||
|
private void UpdateprocessStatus(string statusString)
|
|||
|
{
|
|||
|
if (ProcessStatus != null) ProcessStatus(statusString);
|
|||
|
}
|
|||
|
|
|||
|
public RegularDataUpload()
|
|||
|
{
|
|||
|
_organograms = new ObjectsTemplate<OrganogramBasic>();
|
|||
|
_organEmps = new ObjectsTemplate<OrganogramEmployee>();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#region Properties
|
|||
|
public BonusProcess UploadedBonus
|
|||
|
{
|
|||
|
get { return _BonusProcess; }
|
|||
|
set { _BonusProcess = value; }
|
|||
|
}
|
|||
|
|
|||
|
public ObjectsTemplate<Employee> Employees
|
|||
|
{
|
|||
|
get { return _employees; }
|
|||
|
set { _employees = value; }
|
|||
|
}
|
|||
|
|
|||
|
private ObjectsTemplate<AllowanceDeduction> _allowanceDeductions;
|
|||
|
public ObjectsTemplate<AllowanceDeduction> AllowanceDeductions
|
|||
|
{
|
|||
|
get { return _allowanceDeductions; }
|
|||
|
set { _allowanceDeductions = value; }
|
|||
|
}
|
|||
|
|
|||
|
//added by Hasib
|
|||
|
|
|||
|
public ObjectsTemplate<AccessCard> AccessCards
|
|||
|
{
|
|||
|
get { return _accessCards; }
|
|||
|
set { _accessCards = value; }
|
|||
|
}
|
|||
|
|
|||
|
private ObjectsTemplate<AccessCard> _accessCardsErrorList;
|
|||
|
public ObjectsTemplate<AccessCard> AccessCardsErrorList
|
|||
|
{
|
|||
|
get { return _accessCardsErrorList; }
|
|||
|
set { _accessCardsErrorList = value; }
|
|||
|
}
|
|||
|
|
|||
|
public List<UploadErrorOrSuccess> ErrorOrSuccessList
|
|||
|
{
|
|||
|
get { return _errorOrSuccessList; }
|
|||
|
set { _errorOrSuccessList = value; }
|
|||
|
}
|
|||
|
|
|||
|
private BasicDataUploadProcess _basicwithEmployee;
|
|||
|
private DataUploadException _uploadException;
|
|||
|
private List<EmployeeGradeSalary> oempgradesalarys;
|
|||
|
private List<ADParameterEmployee> oadparamemployees;
|
|||
|
|
|||
|
private ObjectsTemplate<ADParameterEmployee> oAdparameterEmployees;
|
|||
|
private ObjectsTemplate<EmployeeUnAuthorizeLeave> _empUnAuthoLeaves;
|
|||
|
|
|||
|
private ObjectsTemplate<ChildrenEducation> ChildrenEducations;
|
|||
|
private ObjectsTemplate<EmployeeOverTime> _EmployeeOverTimes;
|
|||
|
private List<OpiParameterIndividual> oOpiParameterIndividuals;
|
|||
|
private List<EmployeeBankAccount> oempbankaccounts;
|
|||
|
private ObjectsTemplate<EmployeeCostCenter> oempCostCenters;
|
|||
|
private ObjectsTemplate<EmpContact> _empContacts;
|
|||
|
private List<LoanIssue> loanissues;
|
|||
|
private List<LoanSchedule> loanschs;
|
|||
|
private ObjectsTemplate<SalaryMonthlyDetail> _salaryDetails;
|
|||
|
private ObjectsTemplate<OPIProcessDetailItem> _oPIProcessDetailItem;
|
|||
|
private ObjectsTemplate<OpiParameterIndividual> _oPIParameterIndividual;
|
|||
|
private ObjectsTemplate<CarFuelProcessDetailItem> _CarFuelProcessDetailItem;
|
|||
|
private ObjectsTemplate<CarFuelParameterIndividual> _CarFuelParameterIndividual;
|
|||
|
|
|||
|
private ObjectsTemplate<IncomeTax> _incomeTaxes;
|
|||
|
private ObjectsTemplate<Employee> _TempEmployees;
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Service Factory
|
|||
|
internal static IRegularDataUploadService Service
|
|||
|
{
|
|||
|
get { return Services.Factory.CreateService<IRegularDataUploadService>(typeof(IRegularDataUploadService)); }
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Export
|
|||
|
public void Export(DataTable data, string fileName, ObjectsTemplate<Term> oTerms)
|
|||
|
{
|
|||
|
|
|||
|
IWorkbookSet wbSet = Factory.GetWorkbookSet();
|
|||
|
IWorkbook wb = wbSet.Workbooks.Add();
|
|||
|
IWorksheet ws = wb.Worksheets["Sheet1"];
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
int rowIdx = 0, colIdx = 2;
|
|||
|
ws.Cells[rowIdx, 0].FormulaR1C1 = "EmpNo";
|
|||
|
ws.Cells[rowIdx, 1].FormulaR1C1 = "EmpName";
|
|||
|
//ws.Cells[rowIdx, 2].FormulaR1C1 = "MonthDate";
|
|||
|
|
|||
|
foreach (Term oTerm in oTerms)
|
|||
|
{
|
|||
|
ws.Cells[rowIdx, colIdx].FormulaR1C1 = oTerm.Name;
|
|||
|
colIdx++;
|
|||
|
}
|
|||
|
int Count = 0;
|
|||
|
colIdx = 0;
|
|||
|
rowIdx = 1;
|
|||
|
foreach (DataRow row in data.Rows)
|
|||
|
{
|
|||
|
ws.Cells[rowIdx, colIdx].FormulaR1C1 = row["EmpNo"].ToString();
|
|||
|
ws.Cells[rowIdx, colIdx + 1].FormulaR1C1 = row["EmpName"].ToString();
|
|||
|
ws.Cells[rowIdx, colIdx + 2].FormulaR1C1 ="0";
|
|||
|
ws.Cells[rowIdx, colIdx + 3].FormulaR1C1 = "0";
|
|||
|
rowIdx++;
|
|||
|
}
|
|||
|
wb.SaveAs(fileName, FileFormat.XLS97);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
finally
|
|||
|
{
|
|||
|
//Release resources
|
|||
|
wbSet.Dispose();
|
|||
|
wb = null;
|
|||
|
ws = null;
|
|||
|
wbSet = null;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
//public List<UploadErrorOrSuccess> UploadBonusData(int uploadId, DataUploadColumnDefinition oColumnDefination, string path)
|
|||
|
//{
|
|||
|
// _uplodedData = Service.LoadExcelData(path, oColumnDefination.SheetName);
|
|||
|
// _errorOrSuccessList = oColumnDefination.ValidateUploadedData(_uplodedData);
|
|||
|
// if (_errorOrSuccessList.Count > 0) return _errorOrSuccessList;
|
|||
|
|
|||
|
// switch (uploadId)
|
|||
|
// {
|
|||
|
// case (int)EnumRegularDataUpload.Bonus:
|
|||
|
// {
|
|||
|
// _BonusProcess = this.ImportEmpBonus(oColumnDefination);
|
|||
|
|
|||
|
// break;
|
|||
|
// }
|
|||
|
// default:
|
|||
|
// {
|
|||
|
// this.ImportException(uploadId, oColumnDefination);
|
|||
|
// }
|
|||
|
|
|||
|
// break;
|
|||
|
|
|||
|
// }
|
|||
|
// return _errorOrSuccessList;
|
|||
|
//}
|
|||
|
|
|||
|
public List<UploadErrorOrSuccess> UploadData(int uploadId, DataUploadColumnDefinition oColumnDefination, string path)
|
|||
|
{
|
|||
|
|
|||
|
_uplodedData = Service.LoadExcelData(path, oColumnDefination.SheetName);
|
|||
|
//_uplodedData = Service.LoadData(path);
|
|||
|
_errorOrSuccessList = oColumnDefination.ValidateUploadedData(_uplodedData);
|
|||
|
if (_errorOrSuccessList.Count > 0) return _errorOrSuccessList;
|
|||
|
|
|||
|
switch (uploadId)
|
|||
|
{
|
|||
|
case (int)EnumRegularDataUpload.EmployeeWithBasic:
|
|||
|
|
|||
|
this.ImportEmpBasicInfo();
|
|||
|
break;
|
|||
|
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.Allowance:
|
|||
|
|
|||
|
this.ImportEmpIndividualAllowance(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.TaxChallan:
|
|||
|
|
|||
|
this.ImportITChallan(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.Deduction:
|
|||
|
|
|||
|
this.ImportEmpIndividualDeduction(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpDiscontinue:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmployeeBankAccount:
|
|||
|
|
|||
|
this.ImportEmpBankAccount(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmployeeConfirmation:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.ESB:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.ITInvestment:
|
|||
|
|
|||
|
this.ImportITInvestment(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.Leave:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.OPI:
|
|||
|
|
|||
|
//this.ImportOPIDataAfterProcess(oColumnDefination);
|
|||
|
this.ImportOPIDataNew(oColumnDefination);
|
|||
|
//this.ImportOPIParamInividual(oColumnDefination);
|
|||
|
//this.ImportOPIDataNew(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.SalaryData:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.SalaryRemarks:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.TaxAdjustCurrYear:
|
|||
|
|
|||
|
this.ImportTaxAdjustmentData(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.TC:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpGradeSalary:
|
|||
|
|
|||
|
this.ImportEmpGradeSalaryAssignment(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmployeeAttendance:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.TaxData:
|
|||
|
|
|||
|
this.ImportTaxData();
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmployeeLoan:
|
|||
|
|
|||
|
this.ImportEmpLoanInformation(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmployeeLoanSetup:
|
|||
|
|
|||
|
this.ImportEmpLoanSetup(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpSalaryComponent:
|
|||
|
|
|||
|
this.ImportSalaryComponet(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpCC:
|
|||
|
|
|||
|
this.ImportEmpCC(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.PFOpening:
|
|||
|
this.PFOpening(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpVendorCode:
|
|||
|
this.ImportEmpVendorCode(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.OPI_Parameter_Individual:
|
|||
|
//this.ImportOPIData(oColumnDefination);
|
|||
|
this.ImportOPIParamInividual(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpAddressData:
|
|||
|
//this.ImportOPIData(oColumnDefination);
|
|||
|
//this.ImportOPIParamInividual(oColumnDefination);
|
|||
|
this.ImportAllEmpContactInfo(oColumnDefination);
|
|||
|
break;
|
|||
|
default:
|
|||
|
this.ImportException(uploadId, oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
return _errorOrSuccessList;
|
|||
|
}
|
|||
|
|
|||
|
public List<UploadErrorOrSuccess> UploadData(int uploadId, EnumEmployeeStatus enumStatus, DataUploadColumnDefinition oColumnDefination, string path, int nEventID)
|
|||
|
{
|
|||
|
_nEventID = nEventID;
|
|||
|
_enumStatus = enumStatus;
|
|||
|
_nTypeID = uploadId;
|
|||
|
_uplodedData = Service.LoadExcelData(path, oColumnDefination.SheetName);
|
|||
|
//_uplodedData = Service.LoadData(path);
|
|||
|
if ((int)EnumRegularDataUpload.EmpShortInfo == uploadId)
|
|||
|
_errorOrSuccessList = oColumnDefination.ValidateUploadedData2(_uplodedData);
|
|||
|
else
|
|||
|
_errorOrSuccessList = oColumnDefination.ValidateUploadedData(_uplodedData);
|
|||
|
if (_errorOrSuccessList.Count > 0) return _errorOrSuccessList;
|
|||
|
|
|||
|
switch (uploadId)
|
|||
|
{
|
|||
|
case (int)EnumRegularDataUpload.EmpShortInfo:
|
|||
|
{
|
|||
|
this.ImportEmpShortInfo(oColumnDefination);
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmployeeWithBasic:
|
|||
|
this.ImportEmpBasicInfo();
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmployeeWithRegularly:
|
|||
|
this.ImportEmpBasicInfoRegularly();
|
|||
|
break;
|
|||
|
case (int)EnumRegularDataUpload.Allowance:
|
|||
|
|
|||
|
this.ImportEmpIndividualAllowance(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.Children_Eduation_Allowances:
|
|||
|
|
|||
|
this.ImportChildrenEducationAllowances(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.WPPFClaim:
|
|||
|
|
|||
|
this.ImportWPPFClaim(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.WPPF:
|
|||
|
|
|||
|
this.ImportWPPFClaim(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.WWF:
|
|||
|
|
|||
|
this.ImportWPPFClaim(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.OverTime:
|
|||
|
|
|||
|
this.ImportOverTimeData(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.UnAuthorized_Leave:
|
|||
|
|
|||
|
this.ImportUnAuthorizedLeaveData(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.TaxChallan:
|
|||
|
|
|||
|
this.ImportITChallan(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.OrganogramPosition:
|
|||
|
this.ImportOrganogramPosition(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.Deduction:
|
|||
|
|
|||
|
this.ImportEmpIndividualDeduction(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpDiscontinue:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmployeeBankAccount:
|
|||
|
|
|||
|
this.ImportEmpBankAccount(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmployeeConfirmation:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.ESB:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.ITInvestment:
|
|||
|
|
|||
|
this.ImportITInvestment(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.Leave:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.OPI:
|
|||
|
|
|||
|
//this.ImportOPIDataAfterProcess(oColumnDefination);
|
|||
|
this.ImportOPIDataNew(oColumnDefination);
|
|||
|
//this.ImportOPIParamInividual(oColumnDefination);
|
|||
|
//this.ImportOPIDataNew(oColumnDefination);
|
|||
|
break;
|
|||
|
case (int)EnumRegularDataUpload.CarFuel:
|
|||
|
|
|||
|
//this.ImportOPIDataAfterProcess(oColumnDefination);
|
|||
|
this.ImportCarFuelDataNew(oColumnDefination);
|
|||
|
//this.ImportOPIParamInividual(oColumnDefination);
|
|||
|
//this.ImportOPIDataNew(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.SalaryData:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.SalaryRemarks:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.TaxAdjustCurrYear:
|
|||
|
|
|||
|
this.ImportTaxAdjustmentData(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.TC:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpGradeSalary:
|
|||
|
|
|||
|
this.ImportEmpGradeSalaryAssignment(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmployeeAttendance:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.TaxData:
|
|||
|
|
|||
|
this.ImportTaxData();
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmployeeLoan:
|
|||
|
|
|||
|
this.ImportEmpLoanInformation(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmployeeLoanSetup:
|
|||
|
|
|||
|
this.ImportEmpLoanSetup(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpSalaryComponent:
|
|||
|
|
|||
|
this.ImportSalaryComponet(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpCC:
|
|||
|
|
|||
|
this.ImportEmpCC(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.PFOpening:
|
|||
|
this.PFOpening(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpVendorCode:
|
|||
|
this.ImportEmpVendorCode(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.OPI_Parameter_Individual:
|
|||
|
//this.ImportOPIData(oColumnDefination);
|
|||
|
this.ImportOPIParamInividual(oColumnDefination);
|
|||
|
break;
|
|||
|
case (int)EnumRegularDataUpload.CarFuel_Parameter_Individual:
|
|||
|
//this.ImportOPIData(oColumnDefination);
|
|||
|
this.ImportCarFuelParamInividual(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpAddressData:
|
|||
|
//this.ImportOPIData(oColumnDefination);
|
|||
|
//this.ImportOPIParamInividual(oColumnDefination);
|
|||
|
this.ImportAllEmpContactInfo(oColumnDefination);
|
|||
|
break;
|
|||
|
default:
|
|||
|
this.ImportException(uploadId, oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
return _errorOrSuccessList;
|
|||
|
}
|
|||
|
public List<UploadErrorOrSuccess> UploadData2(int uploadId, EnumEmployeeStatus enumStatus, DataUploadColumnDefinition oColumnDefination, string path, int nEventID)
|
|||
|
{
|
|||
|
_nEventID = nEventID;
|
|||
|
_enumStatus = enumStatus;
|
|||
|
_nTypeID = uploadId;
|
|||
|
_uplodedData = Service.LoadExcelData(path, oColumnDefination.SheetName);
|
|||
|
//_uplodedData = Service.LoadData(path);
|
|||
|
//if ((int)EnumRegularDataUpload.EmpShortInfo == uploadId)
|
|||
|
_errorOrSuccessList = oColumnDefination.ValidateUploadedData2(_uplodedData);
|
|||
|
//else
|
|||
|
// _errorOrSuccessList = oColumnDefination.ValidateUploadedData(_uplodedData);
|
|||
|
if (_errorOrSuccessList.Count > 0) return _errorOrSuccessList;
|
|||
|
|
|||
|
switch (uploadId)
|
|||
|
{
|
|||
|
case (int)EnumRegularDataUpload.EmployeeWithBasic:
|
|||
|
this.ImportEmpBasicInfo2();
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.LifeCycle:
|
|||
|
this.ImportCareerHistory();
|
|||
|
break;
|
|||
|
case (int)EnumRegularDataUpload.Allowance:
|
|||
|
|
|||
|
this.ImportEmpIndividualAllowance(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.TaxChallan:
|
|||
|
|
|||
|
this.ImportITChallan(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.OrganogramPosition:
|
|||
|
this.ImportOrganogramPosition(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.Deduction:
|
|||
|
|
|||
|
this.ImportEmpIndividualDeduction(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpDiscontinue:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmployeeBankAccount:
|
|||
|
|
|||
|
this.ImportEmpBankAccount(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmployeeConfirmation:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.ESB:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.ITInvestment:
|
|||
|
|
|||
|
this.ImportITInvestment(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.Leave:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.OPI:
|
|||
|
|
|||
|
//this.ImportOPIDataAfterProcess(oColumnDefination);
|
|||
|
this.ImportOPIDataNew(oColumnDefination);
|
|||
|
//this.ImportOPIParamInividual(oColumnDefination);
|
|||
|
//this.ImportOPIDataNew(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.SalaryData:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.SalaryRemarks:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.TaxAdjustCurrYear:
|
|||
|
|
|||
|
this.ImportTaxAdjustmentData(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.TC:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpGradeSalary:
|
|||
|
|
|||
|
this.ImportEmpGradeSalaryAssignment(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmployeeAttendance:
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.TaxData:
|
|||
|
|
|||
|
this.ImportTaxData();
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmployeeLoan:
|
|||
|
|
|||
|
this.ImportEmpLoanInformation(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmployeeLoanSetup:
|
|||
|
|
|||
|
this.ImportEmpLoanSetup(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpSalaryComponent:
|
|||
|
|
|||
|
this.ImportSalaryComponet(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpCC:
|
|||
|
|
|||
|
this.ImportEmpCC(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.PFOpening:
|
|||
|
this.PFOpening(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpVendorCode:
|
|||
|
this.ImportEmpVendorCode(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.OPI_Parameter_Individual:
|
|||
|
//this.ImportOPIData(oColumnDefination);
|
|||
|
this.ImportOPIParamInividual(oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpAddressData:
|
|||
|
//this.ImportOPIData(oColumnDefination);
|
|||
|
//this.ImportOPIParamInividual(oColumnDefination);
|
|||
|
this.ImportAllEmpContactInfo(oColumnDefination);
|
|||
|
break;
|
|||
|
default:
|
|||
|
this.ImportException(uploadId, oColumnDefination);
|
|||
|
break;
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
return _errorOrSuccessList;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
public List<UploadErrorOrSuccess> UploadBonusData(int allowance, int uploadId, ID bonusID, DataUploadColumnDefinition oColumnDefination, string path, bool IsDisbursWithSalary, bool IsTaxProcess, double UsedProcess, DateTime dCutofDate, DateTime dPayDate, int _nReligionID)
|
|||
|
{
|
|||
|
_uplodedData = Service.LoadExcelData(path, oColumnDefination.SheetName);
|
|||
|
//_uplodedData = Service.LoadData(path);
|
|||
|
_errorOrSuccessList = oColumnDefination.ValidateUploadedData(_uplodedData);
|
|||
|
if (_errorOrSuccessList.Count > 0) return _errorOrSuccessList;
|
|||
|
|
|||
|
switch (uploadId)
|
|||
|
{
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.Bonus:
|
|||
|
{
|
|||
|
if (allowance == 3)
|
|||
|
_BonusProcess = this.ImportEmpIndividualBonus(oColumnDefination, IsDisbursWithSalary, IsTaxProcess, UsedProcess, bonusID, dCutofDate, dPayDate, _nReligionID);
|
|||
|
else
|
|||
|
_BonusProcess = this.ImportEmpBonus(oColumnDefination, IsDisbursWithSalary, IsTaxProcess, UsedProcess, bonusID, dPayDate, _nReligionID);
|
|||
|
break;
|
|||
|
}
|
|||
|
default:
|
|||
|
{
|
|||
|
this.ImportException(uploadId, oColumnDefination);
|
|||
|
}
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
}
|
|||
|
return _errorOrSuccessList;
|
|||
|
}
|
|||
|
|
|||
|
#region Upload HR Employee Data
|
|||
|
public List<UploadErrorOrSuccess> UploadHRData(int uploadId, DataUploadColumnDefinition oColumnDefination, string path)
|
|||
|
{
|
|||
|
|
|||
|
List<UploadErrorOrSuccess> oelist = new List<UploadErrorOrSuccess>();
|
|||
|
DataUploadColumnDefinition columnDefination = null;
|
|||
|
_errorOrSuccessList = new List<UploadErrorOrSuccess>();
|
|||
|
if (uploadId == (int)EnumRegularDataUpload.EmpHRData)
|
|||
|
{
|
|||
|
_uploadHRData = new DataSet();
|
|||
|
|
|||
|
foreach (string oSt in oColumnDefination.SheetCollection)
|
|||
|
{
|
|||
|
_uplodedData = Service.LoadExcelData(path, oSt);
|
|||
|
columnDefination = null;
|
|||
|
switch (oSt)
|
|||
|
{
|
|||
|
case "General":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HREmpGeneralInfo();
|
|||
|
break;
|
|||
|
case "Contacts":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HREmpContactInfo();
|
|||
|
break;
|
|||
|
case "Spouse":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HREmpSpouseInfo();
|
|||
|
break;
|
|||
|
case "Children":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HREmpChildrenInfo();
|
|||
|
break;
|
|||
|
case "Experience":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HREmpExperienceInfo();
|
|||
|
break;
|
|||
|
case "Training":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HREmpTrainingInfo();
|
|||
|
break;
|
|||
|
case "Academic":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HREmpAcademicInfo();
|
|||
|
break;
|
|||
|
case "Reference":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HREmpReferenceInfo();
|
|||
|
break;
|
|||
|
case "Publication":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HREmpPublicationInfo();
|
|||
|
break;
|
|||
|
case "Nominee":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HREmpNomineeInfo();
|
|||
|
break;
|
|||
|
case "Hospitalization":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HREmpHospitalizationInfo();
|
|||
|
break;
|
|||
|
//case "Guarantor":
|
|||
|
// columnDefination = new DataUploadColumnDefinition();
|
|||
|
// columnDefination.HREmpGuarantorInfo();
|
|||
|
// break;
|
|||
|
case "Language":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HREmpLanguageInfo();
|
|||
|
break;
|
|||
|
case "Relative in this Company":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HREmpRelativeInfo();
|
|||
|
break;
|
|||
|
case "Membership":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HREmpMemberShipInfo();
|
|||
|
break;
|
|||
|
case "Immedite Family":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HREmpRelationInfo();
|
|||
|
break;
|
|||
|
case "Questionnarie":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HREmpQuestionInfo();
|
|||
|
break;
|
|||
|
|
|||
|
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
//_errorOrSuccessList = oColumnDefination.ValidateUploadedData(_uplodedData);
|
|||
|
if (columnDefination == null) continue;
|
|||
|
//DataUploadValidation ovalidation = new DataUploadValidation();
|
|||
|
//ovalidation.ColumnNameValidation(columnDefination, _uplodedData);
|
|||
|
//ovalidation.ValidateInput(columnDefination, _uplodedData);
|
|||
|
_uploadHRData.Tables.Add(_uplodedData);
|
|||
|
//foreach (UploadErrorOrSuccess item in ovalidation.ErrorOrSuccessList)
|
|||
|
//{
|
|||
|
// _errorOrSuccessList.Add(item);
|
|||
|
//}
|
|||
|
}
|
|||
|
|
|||
|
//foreach (DataTable oDTable in _uploadHRData.Tables)
|
|||
|
//{
|
|||
|
// _errorOrSuccessList = oColumnDefination.ValidateUploadedData(oDTable);
|
|||
|
// if (_errorOrSuccessList.Count > 0) return _errorOrSuccessList;
|
|||
|
//}
|
|||
|
}
|
|||
|
|
|||
|
return _errorOrSuccessList;
|
|||
|
}
|
|||
|
|
|||
|
public List<UploadErrorOrSuccess> UploadErrorHRData(int uploadId, DataUploadColumnDefinition oColumnDefination, string path)
|
|||
|
{
|
|||
|
|
|||
|
//if (uploadId == (int)EnumRegularDataUpload.EmpHRData)
|
|||
|
//{
|
|||
|
// _uploadHRData = new DataSet();
|
|||
|
// foreach (string oSt in oColumnDefination.SheetCollection)
|
|||
|
// {
|
|||
|
// _uplodedData = Service.LoadExcelData(path, oSt);
|
|||
|
// _uploadHRData.Tables.Add(_uplodedData);
|
|||
|
// }
|
|||
|
|
|||
|
// //foreach (DataTable oDTable in _uploadHRData.Tables)
|
|||
|
// //{
|
|||
|
// // _errorOrSuccessList = oColumnDefination.ValidateUploadedData(oDTable);
|
|||
|
// // if (_errorOrSuccessList.Count > 0) return _errorOrSuccessList;
|
|||
|
// //}
|
|||
|
//}
|
|||
|
|
|||
|
return _errorOrSuccessList;
|
|||
|
}
|
|||
|
|
|||
|
public HREmployee UploadHRData(int uploadId)
|
|||
|
{
|
|||
|
|
|||
|
switch (uploadId)
|
|||
|
{
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpHRData:
|
|||
|
{
|
|||
|
_Religions = Religion.Get();
|
|||
|
_Categories = Category.Get();
|
|||
|
_Occupations = Occupation.Get();
|
|||
|
_Nationalites = Nationality.Get();
|
|||
|
_Districts = District.Get();
|
|||
|
_Thanas = Thana.Get();
|
|||
|
_Relations = Relation.Get();
|
|||
|
_EducationLevels = EducationLevel.Get();
|
|||
|
_NatureOfTrainings = NatureOfTraining.Get();
|
|||
|
_Institutions = Institution.Get();
|
|||
|
_Contries = Country.Get();
|
|||
|
_EducationTypes = EducationType.Get();
|
|||
|
_Disciplines = Discipline.Get();
|
|||
|
_ResultTypes = ResultType.Get();
|
|||
|
_NominationPurposes = NominationPurpose.Get();
|
|||
|
_GuarantorDocumentTypes = GuarantorDocumentType.Get();
|
|||
|
_TrainingTypes = TrainingType.Get();
|
|||
|
_HRJoiningQuestionaries = HRJoiningQuestionary.Get(EnumStatus.Active);
|
|||
|
|
|||
|
foreach (DataTable oDT in _uploadHRData.Tables)
|
|||
|
{
|
|||
|
if (oDT.TableName == "General")
|
|||
|
{
|
|||
|
_HREmployee = this.ImportEmpGeneralInfo(oDT);
|
|||
|
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Contacts")
|
|||
|
{
|
|||
|
_HREmployee.Contacts = this.ImportEmpContactInfo(oDT);
|
|||
|
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Spouse")
|
|||
|
{
|
|||
|
_HREmployee.Spouses = this.ImportEmpSpouseInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Children")
|
|||
|
{
|
|||
|
_HREmployee.Childrens = this.ImportEmpChildInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Experience")
|
|||
|
{
|
|||
|
_HREmployee.Experiences = this.ImportEmpExperienceInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Training")
|
|||
|
{
|
|||
|
_HREmployee.Trainings = this.ImportEmpTrainingInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Academic")
|
|||
|
{
|
|||
|
_HREmployee.Academics = this.ImportEmpAcademicInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Reference")
|
|||
|
{
|
|||
|
_HREmployee.References = this.ImportEmpReferenceInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Publication")
|
|||
|
{
|
|||
|
_HREmployee.Publications = this.ImportEmpPublicationInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Nominee")
|
|||
|
{
|
|||
|
_HREmployee.Nominees = this.ImportEmpNomineeInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Hospitalization")
|
|||
|
{
|
|||
|
_HREmployee.Hospitalizations = this.ImportEmpHospitalizationInfo(oDT);
|
|||
|
}
|
|||
|
//else if (oDT.TableName == "Guarantor")
|
|||
|
//{
|
|||
|
// _HREmployee.Guarantors = this.ImportEmpGuarantorInfo(oDT);
|
|||
|
//}
|
|||
|
else if (oDT.TableName == "Language")
|
|||
|
{
|
|||
|
_HREmployee.EmpLanguages = this.ImportEmpLanguageInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Relative in this Company")
|
|||
|
{
|
|||
|
_HREmployee.EmpRelatives = this.ImportEmpRelativeInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Membership")
|
|||
|
{
|
|||
|
_HREmployee.EmpMemberships = this.ImportEmpMembershipInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Immedite Family")
|
|||
|
{
|
|||
|
_HREmployee.EmpRelations = this.ImportEmpRelationInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Questionnarie")
|
|||
|
{
|
|||
|
_HREmployee.EmpHRQuestionAnswers = this.ImportEmpHRQuestionAnswerInfo(oDT);
|
|||
|
}
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
default:
|
|||
|
break;
|
|||
|
|
|||
|
}
|
|||
|
return _HREmployee;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Uplaod CV Document
|
|||
|
public static DataTable LoadExcelData(string path, string sheetname)
|
|||
|
{
|
|||
|
return Service.LoadExcelData(path, sheetname);
|
|||
|
}
|
|||
|
public List<UploadErrorOrSuccess> UploadCVData(int uploadId, DataUploadColumnDefinition oColumnDefination, string path)
|
|||
|
{
|
|||
|
|
|||
|
List<UploadErrorOrSuccess> oelist = new List<UploadErrorOrSuccess>();
|
|||
|
DataUploadColumnDefinition columnDefination = null;
|
|||
|
_errorOrSuccessList = new List<UploadErrorOrSuccess>();
|
|||
|
if (uploadId == (int)EnumRegularDataUpload.CVDocument)
|
|||
|
{
|
|||
|
_upLoadCVData = new DataSet();
|
|||
|
|
|||
|
foreach (string oSt in oColumnDefination.SheetCollection)
|
|||
|
{
|
|||
|
_uplodedData = Service.LoadExcelData(path, oSt);
|
|||
|
columnDefination = null;
|
|||
|
switch (oSt)
|
|||
|
{
|
|||
|
case "CVMain":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.CVMainData();
|
|||
|
break;
|
|||
|
case "CVExperience":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.CVExperienceData();
|
|||
|
break;
|
|||
|
case "CVReferredBy":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.CVReferredByData();
|
|||
|
break;
|
|||
|
case "CVEductionalQualification":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.CVEductionalQualificationData();
|
|||
|
break;
|
|||
|
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
if (columnDefination == null) continue;
|
|||
|
_upLoadCVData.Tables.Add(_uplodedData);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return _errorOrSuccessList;
|
|||
|
}
|
|||
|
|
|||
|
public List<UploadErrorOrSuccess> UploadErrorCVData(int uploadId, DataUploadColumnDefinition oColumnDefination, string path)
|
|||
|
{
|
|||
|
|
|||
|
//if (uploadId == (int)EnumRegularDataUpload.EmpHRData)
|
|||
|
//{
|
|||
|
// _uploadHRData = new DataSet();
|
|||
|
// foreach (string oSt in oColumnDefination.SheetCollection)
|
|||
|
// {
|
|||
|
// _uplodedData = Service.LoadExcelData(path, oSt);
|
|||
|
// _uploadHRData.Tables.Add(_uplodedData);
|
|||
|
// }
|
|||
|
|
|||
|
// //foreach (DataTable oDTable in _uploadHRData.Tables)
|
|||
|
// //{
|
|||
|
// // _errorOrSuccessList = oColumnDefination.ValidateUploadedData(oDTable);
|
|||
|
// // if (_errorOrSuccessList.Count > 0) return _errorOrSuccessList;
|
|||
|
// //}
|
|||
|
//}
|
|||
|
|
|||
|
return _errorOrSuccessList;
|
|||
|
}
|
|||
|
|
|||
|
public CV UploadCVData(int uploadId)
|
|||
|
{
|
|||
|
|
|||
|
switch (uploadId)
|
|||
|
{
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.CVDocument:
|
|||
|
{
|
|||
|
|
|||
|
_EducationLevels = EducationLevel.Get();
|
|||
|
_Institutions = Institution.Get();
|
|||
|
_EducationTypes = EducationType.Get();
|
|||
|
_Disciplines = Discipline.Get();
|
|||
|
_ResultTypes = ResultType.Get();
|
|||
|
_Designations = Designation.Get(EnumStatus.Active);
|
|||
|
|
|||
|
foreach (DataTable oDT in _upLoadCVData.Tables)
|
|||
|
{
|
|||
|
if (oDT.TableName == "CVMain")
|
|||
|
{
|
|||
|
_CV = this.ImportCVMainData(oDT);
|
|||
|
|
|||
|
}
|
|||
|
else if (oDT.TableName == "CVExperience")
|
|||
|
{
|
|||
|
_CV.AllExperiences = this.ImportCVExperienceData(oDT);
|
|||
|
|
|||
|
}
|
|||
|
else if (oDT.TableName == "CVReferredBy")
|
|||
|
{
|
|||
|
_CV.AllReferences = this.ImportCVReferredByData(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "CVEductionalQualification")
|
|||
|
{
|
|||
|
_CV.AllEduQualifications = this.ImportCVEductionalQualificationData(oDT);
|
|||
|
}
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
default:
|
|||
|
break;
|
|||
|
|
|||
|
}
|
|||
|
return _CV;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Upload All HR Employee Data
|
|||
|
|
|||
|
public List<UploadErrorOrSuccess> UploadAllHRData(int uploadId, DataUploadColumnDefinition oColumnDefination, string path)
|
|||
|
{
|
|||
|
List<UploadErrorOrSuccess> oelist = new List<UploadErrorOrSuccess>();
|
|||
|
DataUploadColumnDefinition columnDefination = null;
|
|||
|
_errorOrSuccessList = new List<UploadErrorOrSuccess>();
|
|||
|
if (uploadId == (int)EnumRegularDataUpload.EmpAllHRData)
|
|||
|
{
|
|||
|
_uploadHRData = new DataSet();
|
|||
|
foreach (string oSt in oColumnDefination.SheetCollection)
|
|||
|
{
|
|||
|
_uplodedData = Service.LoadExcelData(path, oSt);
|
|||
|
columnDefination = null;
|
|||
|
switch (oSt)
|
|||
|
{
|
|||
|
case "General":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HRAllEmpGeneralInfo();
|
|||
|
break;
|
|||
|
|
|||
|
case "Contacts":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HRAllEmpContactInfo();
|
|||
|
break;
|
|||
|
|
|||
|
case "Spouse":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HRAllEmpSpouseInfo();
|
|||
|
break;
|
|||
|
|
|||
|
case "Children":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HRAllEmpChildrenInfo();
|
|||
|
break;
|
|||
|
|
|||
|
case "Experience":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HRAllEmpExperienceInfo();
|
|||
|
break;
|
|||
|
|
|||
|
case "Training":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HRAllEmpTrainingInfo();
|
|||
|
break;
|
|||
|
|
|||
|
case "Academic":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HRAllEmpAcademicInfo();
|
|||
|
break;
|
|||
|
|
|||
|
case "Reference":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HRAllEmpReferenceInfo();
|
|||
|
break;
|
|||
|
|
|||
|
case "Publication":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HRAllEmpPublicationInfo();
|
|||
|
break;
|
|||
|
|
|||
|
case "Nominee":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HRAllEmpNomineeInfo();
|
|||
|
break;
|
|||
|
|
|||
|
case "Hospitalization":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HRAllEmpHospitalizationInfo();
|
|||
|
break;
|
|||
|
|
|||
|
case "Language":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HRAllEmpLanguageInfo();
|
|||
|
break;
|
|||
|
|
|||
|
case "Relative in this Company":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HRAllEmpRelativeInfo();
|
|||
|
break;
|
|||
|
|
|||
|
case "Membership":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HRAllEmpMemberShipInfo();
|
|||
|
break;
|
|||
|
|
|||
|
case "Immedite Family":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HRAllEmpRelationInfo();
|
|||
|
break;
|
|||
|
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
if (columnDefination == null) continue;
|
|||
|
_uploadHRData.Tables.Add(_uplodedData);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return _errorOrSuccessList;
|
|||
|
}
|
|||
|
|
|||
|
public List<UploadErrorOrSuccess> UploadErrorAllHRData(int uploadId, DataUploadColumnDefinition oColumnDefination, string path)
|
|||
|
{
|
|||
|
|
|||
|
//if (uploadId == (int)EnumRegularDataUpload.EmpHRData)
|
|||
|
//{
|
|||
|
// _uploadHRData = new DataSet();
|
|||
|
// foreach (string oSt in oColumnDefination.SheetCollection)
|
|||
|
// {
|
|||
|
// _uplodedData = Service.LoadExcelData(path, oSt);
|
|||
|
// _uploadHRData.Tables.Add(_uplodedData);
|
|||
|
// }
|
|||
|
|
|||
|
// //foreach (DataTable oDTable in _uploadHRData.Tables)
|
|||
|
// //{
|
|||
|
// // _errorOrSuccessList = oColumnDefination.ValidateUploadedData(oDTable);
|
|||
|
// // if (_errorOrSuccessList.Count > 0) return _errorOrSuccessList;
|
|||
|
// //}
|
|||
|
//}
|
|||
|
|
|||
|
return _errorOrSuccessList;
|
|||
|
}
|
|||
|
|
|||
|
public ObjectsTemplate<HREmployee> UploadAllHRData(int uploadId)
|
|||
|
{
|
|||
|
|
|||
|
switch (uploadId)
|
|||
|
{
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpAllHRData:
|
|||
|
{
|
|||
|
_Religions = Religion.Get();
|
|||
|
_Categories = Category.Get();
|
|||
|
_Occupations = Occupation.Get();
|
|||
|
_Nationalites = Nationality.Get();
|
|||
|
_Districts = District.Get();
|
|||
|
_Thanas = Thana.Get();
|
|||
|
_Relations = Relation.Get();
|
|||
|
_EducationLevels = EducationLevel.Get();
|
|||
|
_NatureOfTrainings = NatureOfTraining.Get();
|
|||
|
_Institutions = Institution.Get();
|
|||
|
_Contries = Country.Get();
|
|||
|
_EducationTypes = EducationType.Get();
|
|||
|
_Disciplines = Discipline.Get();
|
|||
|
_ResultTypes = ResultType.Get();
|
|||
|
_NominationPurposes = NominationPurpose.Get();
|
|||
|
_GuarantorDocumentTypes = GuarantorDocumentType.Get();
|
|||
|
_TrainingTypes = TrainingType.Get();
|
|||
|
_HRJoiningQuestionaries = HRJoiningQuestionary.Get(EnumStatus.Active);
|
|||
|
|
|||
|
foreach (DataTable oDT in _uploadHRData.Tables)
|
|||
|
{
|
|||
|
if (oDT.TableName == "General")
|
|||
|
{
|
|||
|
_HREmployees = this.ImportAllEmpGeneralInfo(oDT);
|
|||
|
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Contacts")
|
|||
|
{
|
|||
|
this.ImportAllEmpContactInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Spouse")
|
|||
|
{
|
|||
|
this.ImportAllEmpSpouseInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Children")
|
|||
|
{
|
|||
|
this.ImportAllEmpChildInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Experience")
|
|||
|
{
|
|||
|
this.ImportAllEmpExperienceInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Training")
|
|||
|
{
|
|||
|
this.ImportAllEmpTrainingInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Academic")
|
|||
|
{
|
|||
|
this.ImportAllEmpAcademicInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Reference")
|
|||
|
{
|
|||
|
this.ImportAllEmpReferenceInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Publication")
|
|||
|
{
|
|||
|
this.ImportAllEmpPublicationInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Nominee")
|
|||
|
{
|
|||
|
this.ImportAllEmpNomineeInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Hospitalization")
|
|||
|
{
|
|||
|
this.ImportAllEmpHospitalizationInfo(oDT);
|
|||
|
}
|
|||
|
//else if (oDT.TableName == "Guarantor")
|
|||
|
//{
|
|||
|
// _HREmployee.Guarantors = this.ImportEmpGuarantorInfo(oDT);
|
|||
|
//}
|
|||
|
else if (oDT.TableName == "Language")
|
|||
|
{
|
|||
|
this.ImportAllEmpLanguageInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Relative in this Company")
|
|||
|
{
|
|||
|
this.ImportAllEmpRelativeInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Membership")
|
|||
|
{
|
|||
|
this.ImportAllEmpMembershipInfo(oDT);
|
|||
|
}
|
|||
|
else if (oDT.TableName == "Immedite Family")
|
|||
|
{
|
|||
|
this.ImportAllEmpRelationInfo(oDT);
|
|||
|
}
|
|||
|
//else if (oDT.TableName == "Questionnarie")
|
|||
|
//{
|
|||
|
// _HREmployee.EmpHRQuestionAnswers = this.ImportEmpHRQuestionAnswerInfo(oDT);
|
|||
|
//}
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
default:
|
|||
|
break;
|
|||
|
|
|||
|
}
|
|||
|
return _HREmployees;
|
|||
|
}
|
|||
|
|
|||
|
public List<UploadErrorOrSuccess> UploadErrorAllHRDataForIDLC(int uploadId, DataUploadColumnDefinition oColumnDefination, string path)
|
|||
|
{
|
|||
|
|
|||
|
//if (uploadId == (int)EnumRegularDataUpload.EmpHRData)
|
|||
|
//{
|
|||
|
// _uploadHRData = new DataSet();
|
|||
|
// foreach (string oSt in oColumnDefination.SheetCollection)
|
|||
|
// {
|
|||
|
// _uplodedData = Service.LoadExcelData(path, oSt);
|
|||
|
// _uploadHRData.Tables.Add(_uplodedData);
|
|||
|
// }
|
|||
|
|
|||
|
// //foreach (DataTable oDTable in _uploadHRData.Tables)
|
|||
|
// //{
|
|||
|
// // _errorOrSuccessList = oColumnDefination.ValidateUploadedData(oDTable);
|
|||
|
// // if (_errorOrSuccessList.Count > 0) return _errorOrSuccessList;
|
|||
|
// //}
|
|||
|
//}
|
|||
|
|
|||
|
return _errorOrSuccessList;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Upload All HR Employee Data
|
|||
|
|
|||
|
public ObjectsTemplate<HREmployee> UploadAllHRDataForIDLC(int uploadId)
|
|||
|
{
|
|||
|
|
|||
|
switch (uploadId)
|
|||
|
{
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpAllHRData:
|
|||
|
{
|
|||
|
_Religions = Religion.Get();
|
|||
|
_Categories = Category.Get();
|
|||
|
_Occupations = Occupation.Get();
|
|||
|
_Nationalites = Nationality.Get();
|
|||
|
_Districts = District.Get();
|
|||
|
_Thanas = Thana.Get();
|
|||
|
_Relations = Relation.Get();
|
|||
|
_EducationLevels = EducationLevel.Get();
|
|||
|
_NatureOfTrainings = NatureOfTraining.Get();
|
|||
|
_Institutions = Institution.Get();
|
|||
|
_Contries = Country.Get();
|
|||
|
_EducationTypes = EducationType.Get();
|
|||
|
_Disciplines = Discipline.Get();
|
|||
|
_ResultTypes = ResultType.Get();
|
|||
|
_NominationPurposes = NominationPurpose.Get();
|
|||
|
_GuarantorDocumentTypes = GuarantorDocumentType.Get();
|
|||
|
_TrainingTypes = TrainingType.Get();
|
|||
|
_HRJoiningQuestionaries = HRJoiningQuestionary.Get(EnumStatus.Active);
|
|||
|
|
|||
|
foreach (DataTable oDT in _uploadHRData.Tables)
|
|||
|
{
|
|||
|
if (oDT.TableName == "General")
|
|||
|
{
|
|||
|
_HREmployees = this.ImportAllEmpGeneralInfoIDLC(oDT);
|
|||
|
|
|||
|
}
|
|||
|
//else if (oDT.TableName == "Contacts")
|
|||
|
//{
|
|||
|
// this.ImportAllEmpContactInfo(oDT);
|
|||
|
//}
|
|||
|
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
default:
|
|||
|
break;
|
|||
|
|
|||
|
}
|
|||
|
return _HREmployees;
|
|||
|
}
|
|||
|
|
|||
|
public List<UploadErrorOrSuccess> UploadAllHRDataForIDLC(int uploadId, DataUploadColumnDefinition oColumnDefination, string path)
|
|||
|
{
|
|||
|
int rowCount = 0;
|
|||
|
int slNo = 0;
|
|||
|
List<UploadErrorOrSuccess> oelist = new List<UploadErrorOrSuccess>();
|
|||
|
DataUploadColumnDefinition columnDefination = null;
|
|||
|
_errorOrSuccessList = new List<UploadErrorOrSuccess>();
|
|||
|
if (uploadId == (int)EnumRegularDataUpload.EmpAllHRData)
|
|||
|
{
|
|||
|
_uploadHRData = new DataSet();
|
|||
|
foreach (string oSt in oColumnDefination.SheetCollection)
|
|||
|
{
|
|||
|
_uplodedData = Service.LoadExcelData(path, oSt);
|
|||
|
columnDefination = null;
|
|||
|
switch (oSt)
|
|||
|
{
|
|||
|
case "General":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HRAllEmpGeneralInfoIDLC();
|
|||
|
rowCount = 2;
|
|||
|
slNo = 1;
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
if (dr["EmployeeID"].ToString() == "")
|
|||
|
{
|
|||
|
UploadErrorOrSuccess err = new UploadErrorOrSuccess();
|
|||
|
err.ColumName = "EmployeeID";
|
|||
|
err.EmpName = dr["First Name"].ToString();
|
|||
|
err.Message = "EmployeeID should not empty.";
|
|||
|
err.RowNo = rowCount;
|
|||
|
err.SL = slNo;
|
|||
|
_errorOrSuccessList.Add(err);
|
|||
|
slNo++;
|
|||
|
}
|
|||
|
rowCount++;
|
|||
|
}
|
|||
|
break;
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
if (columnDefination == null) continue;
|
|||
|
_uploadHRData.Tables.Add(_uplodedData);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return _errorOrSuccessList;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public List<UploadErrorOrSuccess> UploadAllHRDataForNavana(int uploadId, DataUploadColumnDefinition oColumnDefination, string path)
|
|||
|
{
|
|||
|
int rowCount = 0;
|
|||
|
int slNo = 0;
|
|||
|
|
|||
|
List<UploadErrorOrSuccess> oelist = new List<UploadErrorOrSuccess>();
|
|||
|
DataUploadColumnDefinition columnDefination = null;
|
|||
|
_errorOrSuccessList = new List<UploadErrorOrSuccess>();
|
|||
|
if (uploadId == (int)EnumRegularDataUpload.EmpAllHRData)
|
|||
|
{
|
|||
|
_uploadHRData = new DataSet();
|
|||
|
foreach (string oSt in oColumnDefination.SheetCollection)
|
|||
|
{
|
|||
|
_uplodedData = Service.LoadExcelData(path, oSt);
|
|||
|
columnDefination = null;
|
|||
|
switch (oSt)
|
|||
|
{
|
|||
|
case "General":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.HRAllEmpGeneralInfo();
|
|||
|
|
|||
|
rowCount = 2;
|
|||
|
slNo = 1;
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
if (dr["EmployeeID"].ToString() == "")
|
|||
|
{
|
|||
|
UploadErrorOrSuccess err = new UploadErrorOrSuccess();
|
|||
|
err.ColumName = "EmployeeID";
|
|||
|
err.EmpName = dr["First Name"].ToString();
|
|||
|
err.Message = "EmployeeID should not empty.";
|
|||
|
err.RowNo = rowCount;
|
|||
|
err.SL = slNo;
|
|||
|
_errorOrSuccessList.Add(err);
|
|||
|
slNo++;
|
|||
|
}
|
|||
|
rowCount++;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
if (columnDefination == null) continue;
|
|||
|
_uploadHRData.Tables.Add(_uplodedData);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return _errorOrSuccessList;
|
|||
|
}
|
|||
|
|
|||
|
public List<UploadErrorOrSuccess> UploadErrorAllHRDataForNavana(int uploadId, DataUploadColumnDefinition oColumnDefination, string path)
|
|||
|
{
|
|||
|
|
|||
|
//if (uploadId == (int)EnumRegularDataUpload.EmpHRData)
|
|||
|
//{
|
|||
|
// _uploadHRData = new DataSet();
|
|||
|
// foreach (string oSt in oColumnDefination.SheetCollection)
|
|||
|
// {
|
|||
|
// _uplodedData = Service.LoadExcelData(path, oSt);
|
|||
|
// _uploadHRData.Tables.Add(_uplodedData);
|
|||
|
// }
|
|||
|
|
|||
|
// //foreach (DataTable oDTable in _uploadHRData.Tables)
|
|||
|
// //{
|
|||
|
// // _errorOrSuccessList = oColumnDefination.ValidateUploadedData(oDTable);
|
|||
|
// // if (_errorOrSuccessList.Count > 0) return _errorOrSuccessList;
|
|||
|
// //}
|
|||
|
//}
|
|||
|
|
|||
|
return _errorOrSuccessList;
|
|||
|
}
|
|||
|
|
|||
|
public ObjectsTemplate<HREmployee> UploadAllHRDataForNavana(int uploadId)
|
|||
|
{
|
|||
|
|
|||
|
switch (uploadId)
|
|||
|
{
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpAllHRData:
|
|||
|
{
|
|||
|
_Religions = Religion.Get();
|
|||
|
_Categories = Category.Get();
|
|||
|
_Occupations = Occupation.Get();
|
|||
|
_Nationalites = Nationality.Get();
|
|||
|
_Districts = District.Get();
|
|||
|
_Thanas = Thana.Get();
|
|||
|
_Relations = Relation.Get();
|
|||
|
_EducationLevels = EducationLevel.Get();
|
|||
|
_NatureOfTrainings = NatureOfTraining.Get();
|
|||
|
_Institutions = Institution.Get();
|
|||
|
_Contries = Country.Get();
|
|||
|
_EducationTypes = EducationType.Get();
|
|||
|
_Disciplines = Discipline.Get();
|
|||
|
_ResultTypes = ResultType.Get();
|
|||
|
_NominationPurposes = NominationPurpose.Get();
|
|||
|
_GuarantorDocumentTypes = GuarantorDocumentType.Get();
|
|||
|
_TrainingTypes = TrainingType.Get();
|
|||
|
_HRJoiningQuestionaries = HRJoiningQuestionary.Get(EnumStatus.Active);
|
|||
|
|
|||
|
foreach (DataTable oDT in _uploadHRData.Tables)
|
|||
|
{
|
|||
|
if (oDT.TableName == "General")
|
|||
|
{
|
|||
|
_HREmployees = this.ImportAllEmpGeneralInForNavana(oDT);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
default:
|
|||
|
break;
|
|||
|
|
|||
|
}
|
|||
|
return _HREmployees;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Upload All HR Employee Data
|
|||
|
public List<UploadErrorOrSuccess> UploadAllSingleData(int uploadId, DataUploadColumnDefinition oColumnDefination, string path)
|
|||
|
{
|
|||
|
int rowCount = 0;
|
|||
|
int slNo = 0;
|
|||
|
|
|||
|
List<UploadErrorOrSuccess> oelist = new List<UploadErrorOrSuccess>();
|
|||
|
DataUploadColumnDefinition columnDefination = null;
|
|||
|
_errorOrSuccessList = new List<UploadErrorOrSuccess>();
|
|||
|
if (uploadId == (int)EnumRegularDataUpload.EmpSingle)
|
|||
|
{
|
|||
|
_uploadHRData = new DataSet();
|
|||
|
foreach (string oSt in oColumnDefination.SheetCollection)
|
|||
|
{
|
|||
|
_uplodedData = Service.LoadExcelData(path, oSt);
|
|||
|
columnDefination = null;
|
|||
|
switch (oSt)
|
|||
|
{
|
|||
|
case "EmployeeInfo":
|
|||
|
columnDefination = new DataUploadColumnDefinition();
|
|||
|
columnDefination.SetUpEmpSingle();
|
|||
|
|
|||
|
rowCount = 2;
|
|||
|
slNo = 1;
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
if (dr["EmployeeID"].ToString() == "")
|
|||
|
{
|
|||
|
UploadErrorOrSuccess err = new UploadErrorOrSuccess();
|
|||
|
err.ColumName = "EmployeeID";
|
|||
|
err.EmpName = dr["First Name"].ToString();
|
|||
|
err.Message = "EmployeeID should not empty.";
|
|||
|
err.RowNo = rowCount;
|
|||
|
err.SL = slNo;
|
|||
|
_errorOrSuccessList.Add(err);
|
|||
|
slNo++;
|
|||
|
}
|
|||
|
rowCount++;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
if (columnDefination == null) continue;
|
|||
|
_uploadHRData.Tables.Add(_uplodedData);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return _errorOrSuccessList;
|
|||
|
}
|
|||
|
|
|||
|
public List<UploadErrorOrSuccess> UploadErrorAllSingleData(int uploadId, DataUploadColumnDefinition oColumnDefination, string path)
|
|||
|
{
|
|||
|
|
|||
|
//if (uploadId == (int)EnumRegularDataUpload.EmpHRData)
|
|||
|
//{
|
|||
|
// _uploadHRData = new DataSet();
|
|||
|
// foreach (string oSt in oColumnDefination.SheetCollection)
|
|||
|
// {
|
|||
|
// _uplodedData = Service.LoadExcelData(path, oSt);
|
|||
|
// _uploadHRData.Tables.Add(_uplodedData);
|
|||
|
// }
|
|||
|
|
|||
|
// //foreach (DataTable oDTable in _uploadHRData.Tables)
|
|||
|
// //{
|
|||
|
// // _errorOrSuccessList = oColumnDefination.ValidateUploadedData(oDTable);
|
|||
|
// // if (_errorOrSuccessList.Count > 0) return _errorOrSuccessList;
|
|||
|
// //}
|
|||
|
//}
|
|||
|
|
|||
|
return _errorOrSuccessList;
|
|||
|
}
|
|||
|
|
|||
|
public ObjectsTemplate<HREmployee> UploadAllSingleData(int uploadId)
|
|||
|
{
|
|||
|
switch (uploadId)
|
|||
|
{
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpSingle:
|
|||
|
{
|
|||
|
_Religions = Religion.Get();
|
|||
|
_Categories = Category.Get();
|
|||
|
_Occupations = Occupation.Get();
|
|||
|
_Nationalites = Nationality.Get();
|
|||
|
_Districts = District.Get();
|
|||
|
_Thanas = Thana.Get();
|
|||
|
_Relations = Relation.Get();
|
|||
|
_EducationLevels = EducationLevel.Get();
|
|||
|
_NatureOfTrainings = NatureOfTraining.Get();
|
|||
|
_Institutions = Institution.Get();
|
|||
|
_Contries = Country.Get();
|
|||
|
_EducationTypes = EducationType.Get();
|
|||
|
_Disciplines = Discipline.Get();
|
|||
|
_ResultTypes = ResultType.Get();
|
|||
|
_NominationPurposes = NominationPurpose.Get();
|
|||
|
//_GuarantorDocumentTypes = GuarantorDocumentType.Get();
|
|||
|
_TrainingTypes = TrainingType.Get();
|
|||
|
_HRJoiningQuestionaries = HRJoiningQuestionary.Get(EnumStatus.Active);
|
|||
|
|
|||
|
foreach (DataTable oDT in _uploadHRData.Tables)
|
|||
|
{
|
|||
|
if (oDT.TableName == "EmployeeInfo")
|
|||
|
{
|
|||
|
_HREmployees = this.ImportSingleEmpInForNavana(oDT);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
default:
|
|||
|
break;
|
|||
|
|
|||
|
}
|
|||
|
return _HREmployees;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
public void Save(int uploadId)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
switch (uploadId)
|
|||
|
{
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpShortInfo:
|
|||
|
{
|
|||
|
this.SaveShortInfo();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.Allowance:
|
|||
|
{
|
|||
|
this.SaveEmpIndividualAllowance();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.OverTime:
|
|||
|
{
|
|||
|
this.SaveEmployeeOverTime();
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.Children_Eduation_Allowances:
|
|||
|
{
|
|||
|
this.SaveChildEduAllowance();
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.WPPFClaim:
|
|||
|
{
|
|||
|
this.SaveWPPFClaim(dtWPPFClaim);
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.WPPF:
|
|||
|
{
|
|||
|
this.SaveWPPF(dtWPPFClaim);
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.WWF:
|
|||
|
{
|
|||
|
this.SaveWWF(dtWPPFClaim);
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.UnAuthorized_Leave:
|
|||
|
{
|
|||
|
this.SaveUnAuthorizedLeave();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmployeeWithBasic:
|
|||
|
case (int)EnumRegularDataUpload.EmployeeWithRegularly:
|
|||
|
{
|
|||
|
this.SaveEmpBasicInformation();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.Bonus:
|
|||
|
{
|
|||
|
this.SaveBonusInformation();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.OrganogramPosition:
|
|||
|
{
|
|||
|
this.SaveOrganPosition();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.TaxChallan:
|
|||
|
{
|
|||
|
this.SaveITChallanData(_TaxChallans);
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.Deduction:
|
|||
|
{
|
|||
|
this.SaveEmpIndividualDeduction();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmpDiscontinue:
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmployeeBankAccount:
|
|||
|
{
|
|||
|
this.SaveEmpBankAccount();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmployeeConfirmation:
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.ESB:
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.ITInvestment:
|
|||
|
{
|
|||
|
this.SaveITInvestmentData(_EmployeeTaxInvestments);
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.Leave:
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.OPI:
|
|||
|
{
|
|||
|
// this.SaveOPIData();
|
|||
|
this.SaveAllOPIParamIndividual();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.CarFuel:
|
|||
|
{
|
|||
|
// this.SaveOPIData();
|
|||
|
this.SaveAllCarFuelParamIndividual();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.SalaryData:
|
|||
|
{
|
|||
|
this.SaveOPIData();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.SalaryRemarks:
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.TaxAdjustCurrYear:
|
|||
|
{
|
|||
|
_basicwithEmployee.SaveTaxData();
|
|||
|
//this.SaveEmpTaxData(_incomeTaxes,EnumIncomeTaxDataFrom.ProcessTempData);
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.TC:
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmpGradeSalary:
|
|||
|
{
|
|||
|
this.SaveEmpGradeSalaryAssignment();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmployeeAttendance:
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.TaxData:
|
|||
|
{
|
|||
|
_basicwithEmployee.SaveTaxData();
|
|||
|
//this.SaveEmpTaxData();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmployeeLoan:
|
|||
|
{
|
|||
|
this.SaveLoanInformation();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmployeeLoanSetup:
|
|||
|
{
|
|||
|
this.SaveLoanInformationSetup();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmpSalaryComponent:
|
|||
|
{
|
|||
|
this.SaveSalaryComponent();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmpCC:
|
|||
|
{
|
|||
|
this.SaveEmpCCData();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.PFOpening:
|
|||
|
{
|
|||
|
this.SavePFOpeningData();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmpVendorCode:
|
|||
|
{
|
|||
|
this.SaveEmpVendorCode();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmpAllHRData:
|
|||
|
{
|
|||
|
this.SaveAllHREmpData(_HREmployees);
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmpSingle:
|
|||
|
{
|
|||
|
this.SaveAllHREmpData(_HREmployees);
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.CVDocument:
|
|||
|
{
|
|||
|
_CV.Save();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.OPI_Parameter_Individual:
|
|||
|
{
|
|||
|
this.SaveAllOPIParamIndividual();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.CarFuel_Parameter_Individual:
|
|||
|
{
|
|||
|
this.SaveAllCarFuelParamIndividual();
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpAddressData:
|
|||
|
{
|
|||
|
this.SaveHREmpContactData(_empContacts);
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
default:
|
|||
|
_uploadException.SaveException(uploadId);
|
|||
|
break;
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
public void Save2(int uploadId)
|
|||
|
{
|
|||
|
UpdateprocessStatus("Saving data.It takes several minutes.");
|
|||
|
try
|
|||
|
{
|
|||
|
switch (uploadId)
|
|||
|
{
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpShortInfo:
|
|||
|
{
|
|||
|
this.SaveShortInfo();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.Allowance:
|
|||
|
{
|
|||
|
this.SaveEmpIndividualAllowance();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmployeeWithBasic:
|
|||
|
case (int)EnumRegularDataUpload.EmployeeWithRegularly:
|
|||
|
{
|
|||
|
this.SaveEmpBasicInformation2();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.Bonus:
|
|||
|
{
|
|||
|
this.SaveBonusInformation();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.OrganogramPosition:
|
|||
|
{
|
|||
|
this.SaveOrganPosition();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.TaxChallan:
|
|||
|
{
|
|||
|
this.SaveITChallanData(_TaxChallans);
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.Deduction:
|
|||
|
{
|
|||
|
this.SaveEmpIndividualDeduction();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmpDiscontinue:
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmployeeBankAccount:
|
|||
|
{
|
|||
|
this.SaveEmpBankAccount();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmployeeConfirmation:
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.ESB:
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.ITInvestment:
|
|||
|
{
|
|||
|
this.SaveITInvestmentData(_EmployeeTaxInvestments);
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.Leave:
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.OPI:
|
|||
|
{
|
|||
|
// this.SaveOPIData();
|
|||
|
this.SaveAllOPIParamIndividual();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.SalaryData:
|
|||
|
{
|
|||
|
this.SaveOPIData();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.SalaryRemarks:
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.TaxAdjustCurrYear:
|
|||
|
{
|
|||
|
_basicwithEmployee.SaveTaxData();
|
|||
|
//this.SaveEmpTaxData(_incomeTaxes,EnumIncomeTaxDataFrom.ProcessTempData);
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.TC:
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmpGradeSalary:
|
|||
|
{
|
|||
|
this.SaveEmpGradeSalaryAssignment();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmployeeAttendance:
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.TaxData:
|
|||
|
{
|
|||
|
_basicwithEmployee.SaveTaxData();
|
|||
|
//this.SaveEmpTaxData();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmployeeLoan:
|
|||
|
{
|
|||
|
this.SaveLoanInformation();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmployeeLoanSetup:
|
|||
|
{
|
|||
|
this.SaveLoanInformationSetup();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmpSalaryComponent:
|
|||
|
{
|
|||
|
this.SaveSalaryComponent();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmpCC:
|
|||
|
{
|
|||
|
this.SaveEmpCCData();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.PFOpening:
|
|||
|
{
|
|||
|
this.SavePFOpeningData();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmpVendorCode:
|
|||
|
{
|
|||
|
this.SaveEmpVendorCode();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmpAllHRData:
|
|||
|
{
|
|||
|
this.SaveAllHREmpData(_HREmployees);
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.EmpSingle:
|
|||
|
{
|
|||
|
this.SaveAllHREmpData(_HREmployees);
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.CVDocument:
|
|||
|
{
|
|||
|
_CV.Save();
|
|||
|
break;
|
|||
|
}
|
|||
|
case (int)EnumRegularDataUpload.OPI_Parameter_Individual:
|
|||
|
{
|
|||
|
this.SaveAllOPIParamIndividual();
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
case (int)EnumRegularDataUpload.EmpAddressData:
|
|||
|
{
|
|||
|
this.SaveHREmpContactData(_empContacts);
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
default:
|
|||
|
_uploadException.SaveException(uploadId);
|
|||
|
break;
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#region Parse Date
|
|||
|
public static DateTime ParseDate(string value)
|
|||
|
{
|
|||
|
if (string.IsNullOrEmpty(value))
|
|||
|
return DateTime.MinValue;
|
|||
|
|
|||
|
DateTime parsedDate = DateTime.MinValue;
|
|||
|
|
|||
|
string dFormate = "dd MMM yyyy";
|
|||
|
try
|
|||
|
{
|
|||
|
parsedDate = DateTime.ParseExact(value, dFormate, System.Globalization.CultureInfo.InvariantCulture);
|
|||
|
}
|
|||
|
catch
|
|||
|
{
|
|||
|
string[] dps = value.Split('/', '-', ' ');
|
|||
|
string[] fps = dFormate.Split('/', '-', ' ');
|
|||
|
if (dps.Length != fps.Length)
|
|||
|
{
|
|||
|
double dv = Convert.ToDouble(value);
|
|||
|
parsedDate = DateTime.FromOADate(dv);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
int d = 0, m = 0, y = 0;
|
|||
|
for (int idx = 0; idx < dps.Length; idx++)
|
|||
|
{
|
|||
|
if (fps[idx].ToLower().StartsWith("d"))
|
|||
|
d = int.Parse(Global.StringFuncions.Left(dps[idx], 2));
|
|||
|
else if (fps[idx].ToLower().StartsWith("m"))
|
|||
|
m = int.Parse(Global.StringFuncions.Left(dps[idx], 2));
|
|||
|
else
|
|||
|
y = int.Parse(Global.StringFuncions.Left(dps[idx], 4));
|
|||
|
}
|
|||
|
parsedDate = new DateTime(y, m, d);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return parsedDate;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region GetBasicAndPromotion
|
|||
|
public static DataTable GetBasicAndPromotion(string filePath)
|
|||
|
{
|
|||
|
return Service.LoadData(filePath);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Individual Employee Allowances
|
|||
|
public void ImportEmpIndividualAllowance(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
List<Employee> oemployees = Employee.GetAllEmps();
|
|||
|
ObjectsTemplate<ADParameter> oadparameters = ADParameter.Get(EnumStatus.Active, EnumAllowOrDeduct.Allowance);
|
|||
|
ADParameter _adparam = null;
|
|||
|
Employee oemployee = null;
|
|||
|
oadparamemployees = new List<ADParameterEmployee>();
|
|||
|
ADParameterEmployee oadparamemp = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
oadparamemp = new ADParameterEmployee();
|
|||
|
oadparamemp.EmployeeID = oemployee.ID;
|
|||
|
//if (_columnDefinition.SelectedItemOneID)
|
|||
|
//oadparamemp.FormDate = Convert.ToDateTime(dr["From Date"]);
|
|||
|
//oadparamemp.TillDate = Convert.ToDateTime(dr["Till Date"]);
|
|||
|
oadparamemp.MonthlyAmount = dr["Amount"].ToString() != string.Empty ? Convert.ToDouble(dr["Amount"]) : 0.0;
|
|||
|
oadparamemp.AllowDeductID = _columnDefinition.SelectedItemOneID; //ID.FromInteger(Convert.ToInt32(EnumAllowOrDeduct.Deduction));
|
|||
|
|
|||
|
if (oemployee.GradeID == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Grade.", nRow, "(" + dr["Grade"].ToString() + ")" + "Grade Id not found in the current context"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
ObjectsTemplate<ADParameter> oparamters = ADParameter.Get(EnumStatus.Active, oadparamemp.AllowDeductID);
|
|||
|
ADParameter oparamter = ADParameter.GetApplicableParameter(oemployee, oemployee.GradeID, oadparameters, oadparamemp.AllowDeductID);
|
|||
|
if (oparamter == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No :" + dr["Employee No"].ToString() + " Row : ", nRow, "Employee applicable parameter not found."));
|
|||
|
continue;
|
|||
|
}
|
|||
|
|
|||
|
oadparamemp.ADParameterID = oparamter.ID;
|
|||
|
oadparamemp.Periodicity = oparamter.Periodicity;
|
|||
|
//if(oadparamemp.AllowDeductID!=ID.FromInteger(14))
|
|||
|
//{
|
|||
|
if (oadparamemp.Periodicity == EnumPeriodicity.OneOff)
|
|||
|
{
|
|||
|
oadparamemp.FormDate = Payroll.BO.GlobalFunctions.FirstDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
oadparamemp.TillDate = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
|
|||
|
}
|
|||
|
else if (oadparamemp.Periodicity == EnumPeriodicity.Monthly && oparamter.EntitleType == EnumEntitleType.Individual)
|
|||
|
{
|
|||
|
// from date can't prior to fist date of current month
|
|||
|
// till date can't be less to from date
|
|||
|
// from date can't be greater to last date of current month
|
|||
|
//if (dr["From Date"].ToString() != "" && Convert.ToDateTime(dr["From Date"]) < Payroll.BO.GlobalFunctions.FirstDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate))
|
|||
|
//{
|
|||
|
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("From Date :" + dr["From Date"].ToString() + " Row : ", nRow, "From date can not be less than first date of current month"));
|
|||
|
// continue;
|
|||
|
//}
|
|||
|
if (dr["From Date"].ToString() != "" && Convert.ToDateTime(dr["From Date"]) > Payroll.BO.GlobalFunctions.LastDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate))
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("From Date :" + dr["From Date"].ToString() + " Row : ", nRow, "From date can not be greater than last date of current month"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
if (dr["Till Date"].ToString() != "" && Convert.ToDateTime(dr["Till Date"]) < Convert.ToDateTime(dr["From Date"]))
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Till Date :" + dr["Till Date"].ToString() + " Row : ", nRow, "Till date can not be less than From date"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
oadparamemp.FormDate = dr["From Date"].ToString() != "" ? Convert.ToDateTime(dr["From Date"]) : Payroll.BO.GlobalFunctions.FirstDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
if (dr["Till Date"].ToString() != "")
|
|||
|
oadparamemp.TillDate = Convert.ToDateTime(dr["Till Date"]);
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No :" + dr["Employee No"].ToString() + " Row : ", nRow, "Employee applicable parameter is defined greade wise"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
//}
|
|||
|
|
|||
|
oadparamemp.ADEmpType = EnumADEmpType.AppliedToIndividual;
|
|||
|
oadparamemp.Arreartype = EnumArrearType.NotPresent;
|
|||
|
oadparamemployees.Add(oadparamemp);
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occurred on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import UnAuthorized Leave Data
|
|||
|
|
|||
|
|
|||
|
public void ImportUnAuthorizedLeaveData(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
Employee oemployee = null;
|
|||
|
int nRow = 0;
|
|||
|
ObjectsTemplate<Employee> oemployees = Employee.Get();
|
|||
|
ObjectsTemplate<UnAuthorizeLeave> oLeaveTypes = new ObjectsTemplate<UnAuthorizeLeave>();
|
|||
|
oLeaveTypes = UnAuthorizeLeave.Get();
|
|||
|
EmployeeSetupParameter setupParams = null;
|
|||
|
UnAuthorizeLeaveParam param = null;
|
|||
|
ObjectsTemplate<UnAuthorizeLeaveParam> _LeaveParams = null;
|
|||
|
EmployeeUnAuthorizeLeave leave = null;
|
|||
|
_empUnAuthoLeaves = new ObjectsTemplate<EmployeeUnAuthorizeLeave>();
|
|||
|
_LeaveParams = new ObjectsTemplate<UnAuthorizeLeaveParam>();
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
if (dr["From Date"].ToString() == "")
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("From Date :" + dr["From Date"].ToString() + " Row : ", nRow, "From Date Is Not Found", oemployee.EmployeeNo, oemployee.Name));
|
|||
|
continue;
|
|||
|
|
|||
|
}
|
|||
|
if (dr["To Date"].ToString() == "")
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("To Date :" + dr["To Date"].ToString() + " Row : ", nRow, "To Date Is Not Found", oemployee.EmployeeNo, oemployee.Name));
|
|||
|
continue;
|
|||
|
|
|||
|
}
|
|||
|
if (dr["Leave Month"].ToString() == "")
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Leave Month :" + dr["Leave Month"].ToString() + " Row : ", nRow, "Leave Month Is Not Found", oemployee.EmployeeNo, oemployee.Name));
|
|||
|
continue;
|
|||
|
|
|||
|
}
|
|||
|
if (dr["Days"].ToString() == "" || dr["Days"].ToString() == "0")
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Leave Month :" + dr["Leave Month"].ToString() + " Row : ", nRow, "Days Is Not Found", oemployee.EmployeeNo, oemployee.Name));
|
|||
|
continue;
|
|||
|
|
|||
|
}
|
|||
|
setupParams = new UnAuthorizeLeaveParam().ApplicableParameters(oemployee);
|
|||
|
for (int i = 0; i < setupParams.ParameterIDs.Count; i++)
|
|||
|
{
|
|||
|
param = UnAuthorizeLeaveParam.Get(ID.FromInteger(setupParams.ParameterIDs[i]));
|
|||
|
if (param != null)
|
|||
|
{
|
|||
|
_LeaveParams.Add(param);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
leave = new EmployeeUnAuthorizeLeave();
|
|||
|
leave.EmployeeID = oemployee.ID;
|
|||
|
leave.UnAuthorizeleaveID = _columnDefinition.SelectedItemOneID;
|
|||
|
param = _LeaveParams.Where(O => O.UnAhuthorizeLeaveID == _columnDefinition.SelectedItemOneID).FirstOrDefault();
|
|||
|
if (param == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Leave Parameter :" + "" + " Row : ", nRow, "Leave Parameter Is Not Found", oemployee.EmployeeNo, oemployee.Name));
|
|||
|
continue;
|
|||
|
|
|||
|
}
|
|||
|
leave.ParamID = _LeaveParams.Where(O => O.UnAhuthorizeLeaveID == _columnDefinition.SelectedItemOneID).FirstOrDefault().ID;
|
|||
|
leave.MonthDate = GlobalFunctions.LastDateOfMonth(Convert.ToDateTime(dr["Leave Month"]));
|
|||
|
leave.LeaveMonth = GlobalFunctions.LastDateOfMonth(Convert.ToDateTime(dr["Leave Month"]));
|
|||
|
leave.FromDate = Convert.ToDateTime(dr["From Date"]);
|
|||
|
leave.ToDate = Convert.ToDateTime(dr["To Date"]);
|
|||
|
leave.Type = EnumLeaveEntryType.Normal;
|
|||
|
leave.LeaveDays = Convert.ToInt32(dr["Days"]);
|
|||
|
_empUnAuthoLeaves.Add(leave);
|
|||
|
}
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occurred on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
#region Import OverTime Data
|
|||
|
|
|||
|
public void ImportOverTimeData(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
Term oTerm = null;
|
|||
|
ObjectsTemplate<Term> _Terms = Term.Get(EnumStatus.Regardless);
|
|||
|
TermParameter oTermParamerer = null;
|
|||
|
ObjectsTemplate<TermParameter> oTermParamerers = TermParameter.Get();
|
|||
|
int nRow = 0;
|
|||
|
string month = "";
|
|||
|
string year = "";
|
|||
|
string strDateStarted = "";
|
|||
|
DateTime entryDate = DateTime.MinValue;
|
|||
|
_EmployeeOverTimes = new ObjectsTemplate<EmployeeOverTime>();
|
|||
|
List<string> OTCodes = new List<string>();
|
|||
|
OTCodes.Add("Overtime Double Rate (up to 10 pm including weekend)");
|
|||
|
OTCodes.Add("Overtime Triple Rate (10 PM to 6 AM including weekend)");
|
|||
|
OTCodes.Add("Overtime Four Times Rate (Govt Holidays)");
|
|||
|
OTCodes.Add("Evening Shift");
|
|||
|
OTCodes.Add("Night Shift");
|
|||
|
OTCodes.Add("Standby Allowance (Working Day)");
|
|||
|
OTCodes.Add("Standby Allowance (Weekly holiday)");
|
|||
|
OTCodes.Add("Standby Allowance (General holiday)");
|
|||
|
OTCodes.Add("Standby Allowance (Festival holiday)");
|
|||
|
OTCodes.Add("Transport allowance One Way");
|
|||
|
OTCodes.Add("Transport Allowance Two Way");
|
|||
|
|
|||
|
double otHour = 0;
|
|||
|
ObjectsTemplate<Employee> oemployees = Employee.GetAllEmps();
|
|||
|
Employee oemployee = null;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
foreach (string otCode in OTCodes)
|
|||
|
{
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Local Emp ID"].ToString(); });
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
if (dr["Claiming Month"].ToString() == "")
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Month :" + dr["Claiming Month"].ToString() + " Row : ", nRow, "Month Can Not Be Empty", oemployee.EmployeeNo, oemployee.Name));
|
|||
|
continue;
|
|||
|
}
|
|||
|
month = dr["Claiming Month"].ToString();
|
|||
|
if (dr["Claiming Year"].ToString() == "")
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Year :" + dr["Claiming Year"].ToString() + " Row : ", nRow, "Year Can Not Be Empty", oemployee.EmployeeNo, oemployee.Name));
|
|||
|
continue;
|
|||
|
}
|
|||
|
year = dr["Claiming Year"].ToString();
|
|||
|
strDateStarted = month + " " + year;
|
|||
|
entryDate = DateTime.MinValue;
|
|||
|
DateTime.TryParseExact(strDateStarted, new string[] { "MMM yyyy" }, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out entryDate);
|
|||
|
if (entryDate == DateTime.MinValue)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No :" + dr["Local Emp ID"].ToString() + " Row : ", nRow, "Month or Year not in correct format", oemployee.EmployeeNo, oemployee.Name));
|
|||
|
continue;
|
|||
|
}
|
|||
|
EmployeeOverTime oEmpOverTime = new EmployeeOverTime();
|
|||
|
oTerm = _Terms.Find(delegate(Term oTM) { return oTM.Name.Trim().ToLower() == otCode.Trim().ToLower(); });
|
|||
|
if (oTerm == null) throw new ServiceException("Invalid Term:" + otCode + " , Term not exist in the System; Row:" + nRow.ToString());
|
|||
|
oTermParamerer = TermParameter.GetParameter(oTermParamerers, oemployee, oTerm.ID);
|
|||
|
if (oTermParamerer == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No :" + dr["Local Emp ID"].ToString() + " Row : ", nRow, "Employee applicable parameter is not Found"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
|
|||
|
if (otCode == "Overtime Double Rate (up to 10 pm including weekend)")
|
|||
|
otHour = dr[13].ToString() == "" ? 0 : Convert.ToDouble(dr[13]);
|
|||
|
else if (otCode == "Overtime Triple Rate (10 PM to 6 AM including weekend)")
|
|||
|
otHour = dr[14].ToString() == "" ? 0 : Convert.ToDouble(dr[14]);
|
|||
|
else if (otCode == "Overtime Four Times Rate (Govt Holidays)")
|
|||
|
otHour = dr[15].ToString() == "" ? 0 : Convert.ToDouble(dr[15]);
|
|||
|
else if (otCode == "Evening Shift")
|
|||
|
otHour = dr[17].ToString() == "" ? 0 : Convert.ToDouble(dr[17]);
|
|||
|
else if (otCode == "Night Shift")
|
|||
|
otHour = dr[18].ToString() == "" ? 0 : Convert.ToDouble(dr[18]);
|
|||
|
else if (otCode == "Standby Allowance (Working Day)")
|
|||
|
otHour = dr[20].ToString() == "" ? 0 : Convert.ToDouble(dr[20]);
|
|||
|
else if (otCode == "Standby Allowance (Weekly holiday)")
|
|||
|
otHour = dr[21].ToString() == "" ? 0 : Convert.ToDouble(dr[21]);
|
|||
|
else if (otCode == "Standby Allowance (General holiday)")
|
|||
|
otHour = dr[22].ToString() == "" ? 0 : Convert.ToDouble(dr[22]);
|
|||
|
else if (otCode == "Standby Allowance (Festival holiday)")
|
|||
|
otHour = dr[23].ToString() == "" ? 0 : Convert.ToDouble(dr[23]);
|
|||
|
else if (otCode == "Transport allowance One Way")
|
|||
|
otHour = dr[24].ToString() == "" ? 0 : Convert.ToDouble(dr[24]);
|
|||
|
else if (otCode == "Transport Allowance Two Way")
|
|||
|
otHour = dr[25].ToString() == "" ? 0 : Convert.ToDouble(dr[25]);
|
|||
|
|
|||
|
oEmpOverTime.TermID = oTermParamerer.TermID;
|
|||
|
oEmpOverTime.TermParameterID = oTermParamerer.ID;
|
|||
|
oEmpOverTime.OTHours = otHour;
|
|||
|
oEmpOverTime.OTMonthBasic = oemployee.BasicSalary;
|
|||
|
oEmpOverTime.EmployeeID = oemployee.ID;
|
|||
|
oEmpOverTime.Value = oTermParamerer.Amount;
|
|||
|
oEmpOverTime.OTMonth = GlobalFunctions.LastDateOfMonth(entryDate);
|
|||
|
oEmpOverTime.MonthDate = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
|
|||
|
oEmpOverTime.PayrollTypeID = Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID;
|
|||
|
if (oEmpOverTime.OTHours > 0)
|
|||
|
_EmployeeOverTimes.Add(oEmpOverTime);
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Local Emp ID"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occurred on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
#region Import Children Education Allowances
|
|||
|
|
|||
|
public void ImportChildrenEducationAllowances(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
ObjectsTemplate<Employee> oemployees = Employee.Get();
|
|||
|
ObjectsTemplate<Employee> employees = new ObjectsTemplate<Employee>();
|
|||
|
ObjectsTemplate<ChildrenEducation> _childrenEduAllows = ChildrenEducation.Get();
|
|||
|
ObjectsTemplate<ChildrenEducation> _childrenEduAllowforSingleEmp = new ObjectsTemplate<ChildrenEducation>();
|
|||
|
oAdparameterEmployees = new ObjectsTemplate<ADParameterEmployee>();
|
|||
|
Employee oemployee = null;
|
|||
|
ADParameterEmployee oadparamemp = null;
|
|||
|
ChildrenEducations = new ObjectsTemplate<ChildrenEducation>();
|
|||
|
ChildrenEducation childAllow = null;
|
|||
|
string sADparamID = ConfigurationManager.GetStringValue("childreneducation", "adparamid", EnumConfigurationType.Logic);
|
|||
|
if (sADparamID == "")
|
|||
|
{
|
|||
|
new ServiceException("No ADParameterID Found in Logic Configuration");
|
|||
|
}
|
|||
|
ADParameter _ADParam = ADParameter.Get(ID.FromInteger(Convert.ToInt16(sADparamID)));
|
|||
|
if (_ADParam == null)
|
|||
|
{
|
|||
|
new ServiceException("No ADParameter Found for Children Education Allowances");
|
|||
|
}
|
|||
|
|
|||
|
double noOfChild = 0;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
Employee emp = employees.Where(o => o.ID == oemployee.ID).FirstOrDefault();
|
|||
|
employees.Add(oemployee);
|
|||
|
|
|||
|
if (emp != null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create(emp.EmployeeNo + "" + " Row : ", nRow, "is Duplicate", emp.EmployeeNo, emp.Name));
|
|||
|
continue;
|
|||
|
}
|
|||
|
if (dr["From Date"].ToString() == "")
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("From Date :" + dr["From Date"].ToString() + " Row : ", nRow, "From Date Is Not Found", oemployee.EmployeeNo, oemployee.Name));
|
|||
|
continue;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if (dr["Amount"].ToString() == "")
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Amount :" + dr["Amount"].ToString() + " Row : ", nRow, "Amount Is Not Found", oemployee.EmployeeNo, oemployee.Name));
|
|||
|
continue;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if (dr["No Of Children"].ToString() == "")
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("No Of Children :" + dr["No Of Children"].ToString() + " Row : ", nRow, "No Of Children Is Not Found", oemployee.EmployeeNo, oemployee.Name));
|
|||
|
continue;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
childAllow = new ChildrenEducation();
|
|||
|
childAllow.EmployeeID = oemployee.ID;
|
|||
|
_childrenEduAllowforSingleEmp = _childrenEduAllows.Where(o => o.EmployeeID == oemployee.ID).ToObjectsTemplate();
|
|||
|
noOfChild = _childrenEduAllowforSingleEmp.Sum(o => o.NoOfChildren);
|
|||
|
childAllow.NoOfChildren = (int)noOfChild + Convert.ToInt32(dr["No Of Children"]);
|
|||
|
childAllow.FromMonth = Convert.ToDateTime(dr["From Date"]);
|
|||
|
childAllow.Amount = Convert.ToDouble(dr["Amount"]);
|
|||
|
ChildrenEducations.Add(childAllow);
|
|||
|
oadparamemp = new ADParameterEmployee();
|
|||
|
oadparamemp.EmployeeID = oemployee.ID;
|
|||
|
oadparamemp.MonthlyAmount = Convert.ToDouble(childAllow.NoOfChildren * childAllow.Amount);
|
|||
|
oadparamemp.AllowDeductID = _ADParam.AllowDeductID; //ID.FromInteger(Convert.ToInt32(EnumAllowOrDeduct.Deduction));
|
|||
|
oadparamemp.ADParameterID = _ADParam.ID;
|
|||
|
oadparamemp.Periodicity = _ADParam.Periodicity;
|
|||
|
oadparamemp.ADEmpType = EnumADEmpType.AppliedToIndividual;
|
|||
|
oadparamemp.ValueType = EnumValueType.Amount;
|
|||
|
oadparamemp.Arreartype = EnumArrearType.NotPresent;
|
|||
|
oadparamemp.FormDate = GlobalFunctions.FirstDateOfMonth(childAllow.FromMonth);
|
|||
|
//oadparamemp.TillDate = GlobalFunctions.LastDateOfMonth(childAllow.FromMonth);
|
|||
|
oadparamemp.CreatedBy = User.CurrentUser.ID;
|
|||
|
oadparamemp.CreatedDate = DateTime.Today;
|
|||
|
oadparamemp.ModifiedBy = User.CurrentUser.ID;
|
|||
|
oadparamemp.ModifiedDate = DateTime.Today;
|
|||
|
oAdparameterEmployees.Add(oadparamemp);
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occurred on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import WPPFClaim
|
|||
|
|
|||
|
public void ImportWPPFClaim(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
ObjectsTemplate<Employee> oemployees = Employee.Get();
|
|||
|
ObjectsTemplate<Employee> employees = new ObjectsTemplate<Employee>();
|
|||
|
Employee oemployee = null;
|
|||
|
int nRow = 0;
|
|||
|
dtWPPFClaim = new DataTable("WPPFClaim");
|
|||
|
dtWPPFClaim.Columns.Add(new DataColumn("EMPLOYEEID", typeof(int)));
|
|||
|
dtWPPFClaim.Columns.Add(new DataColumn("EffectYear", typeof(int)));
|
|||
|
dtWPPFClaim.Columns.Add(new DataColumn("Amount", typeof(double)));
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
Employee emp = employees.Where(o => o.ID == oemployee.ID).FirstOrDefault();
|
|||
|
employees.Add(oemployee);
|
|||
|
|
|||
|
if (emp != null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create(emp.EmployeeNo + "" + " Row : ", nRow, "is Duplicate", emp.EmployeeNo, emp.Name));
|
|||
|
continue;
|
|||
|
}
|
|||
|
if (dr["Effect Year"].ToString() == "")
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Effect Year :" + dr["Effect Year"].ToString() + " Row : ", nRow, "Effect Year Is Not Found", oemployee.EmployeeNo, oemployee.Name));
|
|||
|
continue;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if (dr["Amount"].ToString() == "")
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Amount :" + dr["Amount"].ToString() + " Row : ", nRow, "Amount Is Not Found", oemployee.EmployeeNo, oemployee.Name));
|
|||
|
continue;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
dtWPPFClaim.Rows.Add(oemployee.ID.Integer, Convert.ToInt32(dr["Effect Year"]), Convert.ToDouble(dr["Amount"]));
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occurred on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Individual Employee Deductions
|
|||
|
public void ImportEmpIndividualDeduction(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
List<Employee> oemployees = Employee.GetAllEmps();
|
|||
|
List<ADParameter> _adparams = ADParameter.Get(EnumStatus.Active, EnumAllowOrDeduct.Deduction);
|
|||
|
ADParameter _adparam = null;
|
|||
|
Employee oemployee = null;
|
|||
|
oadparamemployees = new List<ADParameterEmployee>();
|
|||
|
ADParameterEmployee oadparamemp = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
oadparamemp = new ADParameterEmployee();
|
|||
|
oadparamemp.EmployeeID = oemployee.ID;
|
|||
|
//oadparamemp.FormDate = Convert.ToDateTime(dr["From Date"]);
|
|||
|
//oadparamemp.TillDate = Convert.ToDateTime(dr["Till Date"]);
|
|||
|
oadparamemp.MonthlyAmount = dr["Amount"].ToString() != string.Empty ? Convert.ToDouble(dr["Amount"]) : 0.0;
|
|||
|
oadparamemp.AllowDeductID = _columnDefinition.SelectedItemOneID; //ID.FromInteger(Convert.ToInt32(EnumAllowOrDeduct.Deduction));
|
|||
|
if (oemployee.GradeID == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No :" + oemployee.EmployeeNo + " Row : ", nRow, "Employee grade id not found."));
|
|||
|
|
|||
|
|
|||
|
continue;
|
|||
|
}
|
|||
|
ObjectsTemplate<ADParameter> oparamters = ADParameter.Get(EnumStatus.Active, oadparamemp.AllowDeductID);
|
|||
|
ADParameter oparamter = ADParameter.GetApplicableParameter(oemployee, oemployee.GradeID, oparamters, oadparamemp.AllowDeductID);
|
|||
|
if (oparamter == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee applicable parameter not found."));
|
|||
|
continue;
|
|||
|
}
|
|||
|
oadparamemp.ADParameterID = oparamter.ID;
|
|||
|
oadparamemp.Periodicity = oparamter.Periodicity;
|
|||
|
|
|||
|
if (oadparamemp.Periodicity == EnumPeriodicity.OneOff)
|
|||
|
{
|
|||
|
oadparamemp.FormDate = Payroll.BO.GlobalFunctions.FirstDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
oadparamemp.TillDate = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
|
|||
|
}
|
|||
|
else if (oadparamemp.Periodicity == EnumPeriodicity.Monthly && oparamter.EntitleType == EnumEntitleType.Individual)
|
|||
|
{
|
|||
|
// from date can't prior to fist date of current month
|
|||
|
// till date can't be less to from date
|
|||
|
// from date can't be greater to last date of current month
|
|||
|
if (dr["From Date"].ToString() != "" && Convert.ToDateTime(dr["From Date"]) < Payroll.BO.GlobalFunctions.FirstDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate))
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("From Date :" + dr["From Date"].ToString() + " Row : ", nRow, "From date can not be less than first date of current month"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
if (dr["From Date"].ToString() != "" && Convert.ToDateTime(dr["From Date"]) > Payroll.BO.GlobalFunctions.LastDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate))
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("From Date :" + dr["From Date"].ToString() + " Row : ", nRow, "From date can not be greater than last date of current month"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
if (dr["Till Date"].ToString() != "" && Convert.ToDateTime(dr["Till Date"]) < Convert.ToDateTime(dr["From Date"]))
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Till Date :" + dr["Till Date"].ToString() + " Row : ", nRow, "Till date can not be less than From date"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
oadparamemp.FormDate = dr["From Date"].ToString() != "" ? Convert.ToDateTime(dr["From Date"]) : Payroll.BO.GlobalFunctions.FirstDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
if (dr["Till Date"].ToString() != "")
|
|||
|
oadparamemp.TillDate = Convert.ToDateTime(dr["Till Date"]);
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No :" + dr["Employee No"].ToString() + " Row : ", nRow, "Employee applicable parameter is defined greade wise"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
oadparamemp.ADEmpType = EnumADEmpType.AppliedToIndividual;
|
|||
|
oadparamemp.Arreartype = EnumArrearType.NotPresent;
|
|||
|
oadparamemployees.Add(oadparamemp);
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occurred on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Grade Salary Assignment
|
|||
|
public void ImportEmpGradeSalaryAssignment(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
List<Employee> oemployees = Employee.Get();
|
|||
|
Employee oemployee = null;
|
|||
|
List<Grade> ogrades = Grade.Get(EnumStatus.Regardless);
|
|||
|
Grade ograde = null;
|
|||
|
int nRow = 0;
|
|||
|
|
|||
|
oempgradesalarys = new List<EmployeeGradeSalary>();
|
|||
|
EmployeeGradeSalary oempgradesalary = null;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
oempgradesalary = new EmployeeGradeSalary();
|
|||
|
oempgradesalary.Employee = oemployee;
|
|||
|
oempgradesalary.EmployeeID = oemployee.ID;
|
|||
|
ograde = ogrades.Find(delegate(Grade grd) { return grd.Code == dr["Grade"].ToString(); });
|
|||
|
if (ograde != null)
|
|||
|
{
|
|||
|
oempgradesalary.GradeID = ograde.ID;
|
|||
|
if (ograde.HasGrossConcept == true)
|
|||
|
oempgradesalary.GrossSalary = dr["Gross"].ToString() != string.Empty ? Convert.ToDouble(dr["Gross"]) : 0.0;
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Grade.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee grade id not found."));
|
|||
|
|
|||
|
oempgradesalary.GradeSalaryTypeID = _columnDefinition.SelectedItemOneID;
|
|||
|
oempgradesalary.EffectDate = Convert.ToDateTime(dr["Effect Date"]);
|
|||
|
oempgradesalary.BasicSalary = dr["Basic"].ToString() != string.Empty ? Convert.ToDouble(dr["Basic"]) : 0.0;
|
|||
|
//Added by ashek for effect in life cycle
|
|||
|
oempgradesalary.EmpLifeCycle = new EmpLifeCycle();
|
|||
|
oempgradesalary.EmpLifeCycle.EmployeeID = oempgradesalary.EmployeeID;
|
|||
|
oempgradesalary.EmpLifeCycle.GradeID = oempgradesalary.GradeID;
|
|||
|
oempgradesalary.EmpLifeCycle.EffectDate = oempgradesalary.EffectDate;
|
|||
|
oempgradesalary.EmpLifeCycle.BasicSalary = oempgradesalary.BasicSalary;
|
|||
|
oempgradesalary.EmpLifeCycle.StatusDetailID = _columnDefinition.SelectedItemOneID;
|
|||
|
if (_columnDefinition.SelectedItemOneID == ID.FromInteger(3)) //Used Only For Confirmation Type
|
|||
|
{
|
|||
|
oempgradesalary.EmpLifeCycle.PFMemberType = EnumPFMembershipType.Live;
|
|||
|
}
|
|||
|
oempgradesalary.EmpLifeCycle.Description = "Increment";
|
|||
|
oempgradesalarys.Add(oempgradesalary);
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Upload Loan Information
|
|||
|
public void ImportEmpLoanInformation(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
List<Employee> oemployees = Employee.Get();
|
|||
|
Employee oemployee = null;
|
|||
|
loanissues = new List<LoanIssue>();
|
|||
|
List<Loan> loans = Loan.Get(EnumStatus.Active);
|
|||
|
Loan loan = null;
|
|||
|
EnumLoanFraction _Fractionate = EnumLoanFraction.WithFraction;
|
|||
|
string _Method = string.Empty;
|
|||
|
LoanIssue loanissue = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["EmployeeNo"].ToString(); });
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
loanissue = new LoanIssue();
|
|||
|
loanissue.EmployeeID = oemployee.ID;
|
|||
|
loanissue.InterestRate = Convert.ToDouble(dr["Interest"]);
|
|||
|
loanissue.IssueDate = Convert.ToDateTime(dr["Disburse from Month"]);
|
|||
|
loanissue.LoanAmount = Convert.ToDouble(dr["Loan Amount"]);
|
|||
|
|
|||
|
loan = new Loan();
|
|||
|
loan = loans.Find(delegate(Loan ln) { return ln.Name == dr["LoanType"].ToString(); });
|
|||
|
if (loan != null)
|
|||
|
{
|
|||
|
loanissue.LoanID = loan.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("LoanType", nRow, "Loan type not found in the existing loans"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
loanissue.LoanNo = dr["Loan Number"].ToString();
|
|||
|
loanissue.NoOfInstallments = Convert.ToInt32(dr["Schedule"]);
|
|||
|
loanissue.StartPaybackMonthDate = Ease.CoreV35.Utility.Global.DateFunctions.LastDateOfMonth(loanissue.IssueDate);
|
|||
|
|
|||
|
_Fractionate = EnumLoanFraction.WithFraction;
|
|||
|
string nvalue = ConfigurationManager.GetStringValue("loan", "adjustfractionmonth", EnumConfigurationType.Logic);
|
|||
|
switch (nvalue.ToUpper())
|
|||
|
{
|
|||
|
case "NONE": _Fractionate = EnumLoanFraction.WithFraction; break;
|
|||
|
case "FIRST": _Fractionate = EnumLoanFraction.FractionFirstMonth; break;
|
|||
|
case "LAST": _Fractionate = EnumLoanFraction.FractionLastMonth; break;
|
|||
|
default:
|
|||
|
_Fractionate = EnumLoanFraction.WithFraction; break;
|
|||
|
}
|
|||
|
_Method = ConfigurationManager.GetStringValue("loan", "method", EnumConfigurationType.Logic);
|
|||
|
switch (_Method.Trim().ToUpper())
|
|||
|
{
|
|||
|
case "EMI":
|
|||
|
loanissue.PrepareEMISchedule(loanissue.IssueDate, _Fractionate);
|
|||
|
break;
|
|||
|
case "SID":
|
|||
|
loanissue.PrepareSIDSchedule(loanissue.IssueDate, _Fractionate);
|
|||
|
break;
|
|||
|
case "BANK":
|
|||
|
loanissue.PrepareBankSchedule(loanissue.IssueDate, _Fractionate);
|
|||
|
break;
|
|||
|
case "LMID":
|
|||
|
loanissue.PrepareLMIDSchedule(loanissue.IssueDate, _Fractionate);
|
|||
|
break;
|
|||
|
case "HALFYEARLY":
|
|||
|
loanissue.PrepareHalfYearlySchedule(loanissue.IssueDate, _Fractionate);
|
|||
|
break;
|
|||
|
default:
|
|||
|
loanissue.PrepareSIDSchedule(loanissue.IssueDate, _Fractionate);
|
|||
|
break;
|
|||
|
}
|
|||
|
loanissues.Add(loanissue);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["EmployeeNo"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
public void ImportCareerHistory()
|
|||
|
{
|
|||
|
//DataTable dt = new DataTable();
|
|||
|
|
|||
|
//DataView dv = new DataView(_uplodedData);
|
|||
|
//dv.Sort = "Employee No, Effect Date ASC";
|
|||
|
//dt = dv.ToTable();
|
|||
|
|
|||
|
_uplodedData.DefaultView.RowFilter = "Employee No, Effect Date ASC";
|
|||
|
_uplodedData = _uplodedData.DefaultView.ToTable();
|
|||
|
|
|||
|
RefreshObject();
|
|||
|
_oEmpLifeCycles = new ObjectsTemplate<EmpLifeCycle>();
|
|||
|
List<Employee> oemployees = Employee.GetAllEmps();
|
|||
|
Employee oemployee = null;
|
|||
|
|
|||
|
int nTotal = _uplodedData.Rows.Count;
|
|||
|
GlobalFunctions.SetProgressbarMaxValue = nTotal;
|
|||
|
UpdateProgressStatus(EnumProcessStatus.Start);
|
|||
|
int _nCount = 1;
|
|||
|
int nRow = 0;
|
|||
|
string sEmployeeNo = "";
|
|||
|
if (_uplodedData != null && _uplodedData.Rows.Count > 0)
|
|||
|
{
|
|||
|
sEmployeeNo = (_uplodedData.Rows[0])["Employee No"].ToString();
|
|||
|
}
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
//if (dr["Employee No"].ToString() == "10024")
|
|||
|
// dr["Employee No"] = "10024";
|
|||
|
UpdateprocessStatus("Collecting data " + _nCount.ToString() + "/" + nTotal.ToString());
|
|||
|
EmpLifeCycle oItem = new EmpLifeCycle();
|
|||
|
Employee emp = oemployees.Find(ee => ee.EmployeeNo == dr["Employee No"].ToString());
|
|||
|
//Employee emp = Employee.Get(dr["Employee No"].ToString());
|
|||
|
if (emp == null)
|
|||
|
{
|
|||
|
nRow++;
|
|||
|
_nCount++;
|
|||
|
continue;
|
|||
|
}
|
|||
|
|
|||
|
//int nTypeID = Convert.ToInt16(dr["promotiontype"].ToString());
|
|||
|
oItem.EmployeeID = emp.ID;
|
|||
|
Grade ogrd = _grades.Find(gg => gg.Code == dr["Grade"].ToString());
|
|||
|
if (ogrd != null)
|
|||
|
{
|
|||
|
oItem.GradeID = ogrd.ID;
|
|||
|
emp.GradeID = oItem.GradeID;
|
|||
|
}
|
|||
|
Department dept = _departments.Find(gg => gg.Code == dr["Department"].ToString());
|
|||
|
if (dept != null)
|
|||
|
{
|
|||
|
oItem.DepartmentID = dept.ID;
|
|||
|
emp.DepartmentID = oItem.DepartmentID;
|
|||
|
}
|
|||
|
Location loc = _locations.Find(gg => gg.Code == dr["Location"].ToString());
|
|||
|
if (loc != null)
|
|||
|
{
|
|||
|
oItem.LocationID = loc.ID;
|
|||
|
emp.LocationID = oItem.LocationID;
|
|||
|
}
|
|||
|
oItem.Description = dr["Description"].ToString();
|
|||
|
oItem.BasicSalary = Convert.ToDouble(dr["Basic Salary"].ToString());
|
|||
|
emp.BasicSalary = Convert.ToDouble(oItem.BasicSalary);
|
|||
|
oItem.EffectDate = Convert.ToDateTime(dr["Effect Date"].ToString());
|
|||
|
oItem.CreatedBy = ID.FromInteger(1);
|
|||
|
oItem.CreatedDate = oItem.EffectDate.AddDays(-5);
|
|||
|
oItem.StatusDetailID = ID.FromInteger(1);//Event Should Created before
|
|||
|
if (oItem.BasicSalary != null && (double)oItem.BasicSalary > 0)
|
|||
|
{
|
|||
|
EmployeeGradeSalary ogs = new EmployeeGradeSalary();
|
|||
|
ogs.BasicSalary = (oItem.BasicSalary == null) ? 0 : (double)oItem.BasicSalary;
|
|||
|
ogs.GrossSalary = (oItem.GrossSalary == null) ? 0 : (double)oItem.GrossSalary;
|
|||
|
if (oItem.GradeID == null)
|
|||
|
{
|
|||
|
//if (oItem.GradeID == null)
|
|||
|
// throw new ServiceException("Grade not yet assigned to employee.");
|
|||
|
ogs.GradeID = emp.GradeID;
|
|||
|
//ogs.PayScaleDetailID = cbcGrade.SelectedSlab.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
ogs.GradeID = oItem.GradeID;
|
|||
|
//ogs.PayScaleDetailID = cbcGrade.SelectedSlab.ID;
|
|||
|
}
|
|||
|
//if (ogs.BasicSalary + ogs.GrossSalary == 0)
|
|||
|
//{
|
|||
|
// if (emp.BasicSalary + emp.GrossSalary == 0)
|
|||
|
// throw new ServiceException("Salary(Basic/Gross) can't be zero.");
|
|||
|
// else
|
|||
|
// {
|
|||
|
//ogs.BasicSalary = emp.BasicSalary;
|
|||
|
//ogs.GrossSalary = emp.GrossSalary;
|
|||
|
// }
|
|||
|
//}
|
|||
|
ogs.EmployeeID = oItem.EmployeeID;
|
|||
|
|
|||
|
ogs.GradeSalaryTypeID = oItem.StatusDetailID;
|
|||
|
// ogs.ArrearType = (EnumArrearType)Convert.ToInt16(dr["ArrearInfo"].ToString());
|
|||
|
ogs.EffectDate = oItem.EffectDate;
|
|||
|
if (sEmployeeNo != dr["Employee No"].ToString())
|
|||
|
{
|
|||
|
sEmployeeNo = dr["Employee No"].ToString();
|
|||
|
}
|
|||
|
//if (dr["TillDate"].ToString() != "")
|
|||
|
// ogs.TillDate = Convert.ToDateTime(dr["TillDate"].ToString());
|
|||
|
//else
|
|||
|
//{
|
|||
|
DataRow dr2 = null;
|
|||
|
if (nRow < _uplodedData.Rows.Count)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
dr2 = _uplodedData.Rows[nRow + 1];
|
|||
|
}
|
|||
|
catch { dr2 = null; }
|
|||
|
}
|
|||
|
if (dr2 != null)
|
|||
|
{
|
|||
|
if (sEmployeeNo == dr2["Employee No"].ToString())
|
|||
|
{
|
|||
|
|
|||
|
ogs.TillDate = Convert.ToDateTime(dr2["Effect Date"].ToString()).AddDays(-1);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
//}
|
|||
|
oItem.EmployeeGradeSalary = ogs;
|
|||
|
}
|
|||
|
|
|||
|
_oEmpLifeCycles.Add(oItem);
|
|||
|
UpdateProgressStatus(EnumProcessStatus.PerformStep);
|
|||
|
_nCount++;
|
|||
|
nRow++;
|
|||
|
}
|
|||
|
UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
public void ImportEmpLoanSetup(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
List<Employee> oemployees = Employee.Get();
|
|||
|
Employee oemployee = null;
|
|||
|
List<LoanSchedule> loanschedules = new List<LoanSchedule>();
|
|||
|
loanschedules = LoanSchedule.Get();
|
|||
|
|
|||
|
loanschs = new List<LoanSchedule>();
|
|||
|
LoanSchedule loanschedule = null;
|
|||
|
int nRow = 0;
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["EmployeeNo"].ToString(); });
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
if (dr["Month"].ToString() != string.Empty && (object)dr["Month"] != null)
|
|||
|
{
|
|||
|
loanschedule = loanschedules.Find(delegate(LoanSchedule loansch) { return loansch.EmployeeID.Integer == oemployee.ID.Integer && Ease.CoreV35.Utility.Global.DateFunctions.LastDateOfMonth(loansch.DueInstallmentDate).ToString("dd MMM yyyy") == Ease.CoreV35.Utility.Global.DateFunctions.LastDateOfMonth((Convert.ToDateTime(dr["Month"]))).ToString("dd MMM yyyy"); });
|
|||
|
if (loanschedule != null)
|
|||
|
{
|
|||
|
loanschedule.InstallmentPrincipal = Convert.ToDouble(dr["Principal"]);
|
|||
|
loanschedule.InstallmentInterest = Convert.ToDouble(dr["Interest"]);
|
|||
|
loanschs.Add(loanschedule);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Month.", nRow, "(" + Ease.CoreV35.Utility.Global.DateFunctions.LastDateOfMonth((Convert.ToDateTime(dr["Month"]))).ToString("dd MMM yyyy") + ")" + "Loan schedule not found for this date"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Month.", nRow, "(" + dr["Month"].ToString() + ")" + "Month can not be blank"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("EmployeeNo.", nRow, "(" + dr["EmployeeNo"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#region Import Employee Bank Account Information
|
|||
|
public void ImportEmpBankAccount(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
List<Employee> oemployees = Employee.Get();
|
|||
|
Employee oemployee = null;
|
|||
|
|
|||
|
List<Branch> obranches = Branch.Get(EnumStatus.Regardless);
|
|||
|
Branch obranch = null;
|
|||
|
oempbankaccounts = new List<EmployeeBankAccount>();
|
|||
|
EmployeeBankAccount oempbankaccount = null;
|
|||
|
int nRow = 0;
|
|||
|
ObjectsTemplate<Bank> banks = Bank.Get();
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
oempbankaccount = new EmployeeBankAccount();
|
|||
|
oempbankaccount.EmployeeID = oemployee.ID;
|
|||
|
|
|||
|
Bank obank = banks.Find(delegate(Bank item) { return item.Name == dr["Bank Name"].ToString(); });
|
|||
|
if (obank == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Bank Name", nRow, "Bank not found in the existing Banks"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
|
|||
|
obranch = obranches.Find(delegate(Branch item) { return item.Name == dr["Branch Name"].ToString() && item.Bank.ID.Integer == obank.ID.Integer; });
|
|||
|
if (obranch != null)
|
|||
|
{
|
|||
|
oempbankaccount.BranchID = obranch.ID;
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Branch Name", nRow, "Branch name not found in the existing branches"));
|
|||
|
|
|||
|
oempbankaccount.EffectDate = GlobalFunctions.FirstDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
|
|||
|
oempbankaccount.AccountNo = dr["Account No"].ToString();
|
|||
|
oempbankaccounts.Add(oempbankaccount);
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region SalryComponentDate
|
|||
|
public void ImportSalaryComponet(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
List<Employee> oemployees = Employee.Get();
|
|||
|
ObjectsTemplate<SalaryMonthlyDetail> osalaryDetails = new ObjectsTemplate<SalaryMonthlyDetail>();
|
|||
|
_incomeTaxes = new ObjectsTemplate<IncomeTax>();
|
|||
|
|
|||
|
Employee oemployee = null;
|
|||
|
int nRow = 0;
|
|||
|
double tempAmount = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["EmployeeNo"].ToString(); });
|
|||
|
|
|||
|
EnumSalaryItemCode itemCode = (EnumSalaryItemCode)Convert.ToInt32(dr["ItemCode"]);
|
|||
|
EnumSalaryGroup groupCode = (EnumSalaryGroup)Convert.ToInt32(dr["ItemGroup"]);
|
|||
|
int ItemID = (int)Convert.ToInt32(dr["ItemID"]);
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
SalaryMonthly oMonthly;
|
|||
|
oMonthly = SalaryMonthly.Get(oemployee.ID, Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
if (oMonthly == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["EmployeeNo"].ToString() + ")" + " salary not yet processed."));
|
|||
|
}
|
|||
|
SalaryMonthlyDetail oDetail = oMonthly.Details.Find(delegate(SalaryMonthlyDetail oSMD) { return oSMD.ItemCode == itemCode && oSMD.itemGroupCode == groupCode && oSMD.ItemID == ItemID; });
|
|||
|
if (oDetail == null)
|
|||
|
{
|
|||
|
oDetail = new SalaryMonthlyDetail();
|
|||
|
oDetail.SalaryMonthlyID = oMonthly.Details[0].SalaryMonthlyID;
|
|||
|
oDetail.itemGroupCode = groupCode;
|
|||
|
oDetail.ItemID = ItemID;
|
|||
|
oDetail.ItemCode = itemCode;
|
|||
|
oDetail.CalculatedAmount = 0;
|
|||
|
|
|||
|
//oDetail.Description
|
|||
|
SalaryMonthlyDetail gitem = oMonthly.Details.Find(delegate(SalaryMonthlyDetail oSMD) { return oSMD.ItemCode == itemCode && oSMD.ItemID == ItemID; });
|
|||
|
if (gitem == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["EmployeeNo"].ToString() + ")" + " salary component not foun"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
oDetail.Description = gitem.Description;
|
|||
|
oDetail.Position = gitem.Position;
|
|||
|
oDetail.SupportID = gitem.SupportID;
|
|||
|
oDetail.ChangedAmount = Convert.ToDouble(dr["Amount"]);
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
tempAmount = oDetail.ChangedAmount;
|
|||
|
oDetail.ChangedAmount = Convert.ToDouble(dr["Amount"]);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
osalaryDetails.Add(oDetail);
|
|||
|
|
|||
|
SalaryMonthlyDetail onetpaydetail = oMonthly.Details.Find(delegate(SalaryMonthlyDetail oSMD) { return oSMD.ItemCode == EnumSalaryItemCode.Net_Payable && oSMD.itemGroupCode == EnumSalaryGroup.OtherItem && oSMD.ItemID == (int)EnumSalaryItemCode.Net_Payable; });
|
|||
|
|
|||
|
if (onetpaydetail == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["EmployeeNo"].ToString() + ")" + "net pay item not found"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
|
|||
|
// if detail not found, generate an errror and continue
|
|||
|
// same way, get the net pay
|
|||
|
// if net pay item not found, generate an error
|
|||
|
//SalaryMonthlyDetail onetpaydetail = _SalaryMonthly.Details.Find(
|
|||
|
// if net pay goes negative, generate an error
|
|||
|
|
|||
|
if (groupCode == EnumSalaryGroup.Gross || groupCode == EnumSalaryGroup.Arrear)
|
|||
|
{
|
|||
|
onetpaydetail.ChangedAmount = onetpaydetail.ChangedAmount - tempAmount + oDetail.ChangedAmount;
|
|||
|
osalaryDetails.Add(onetpaydetail);
|
|||
|
}
|
|||
|
else if (groupCode == EnumSalaryGroup.Deductions || groupCode == EnumSalaryGroup.UnauthLeave)
|
|||
|
{
|
|||
|
onetpaydetail.ChangedAmount = onetpaydetail.ChangedAmount + tempAmount - oDetail.ChangedAmount;
|
|||
|
osalaryDetails.Add(onetpaydetail);
|
|||
|
}
|
|||
|
|
|||
|
if (onetpaydetail.ChangedAmount <= 0)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["EmployeeNo"].ToString() + ")" + "net pay can't be less then zero"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
// if the item is tax item, update tax card deducted column.
|
|||
|
if (itemCode == EnumSalaryItemCode.Inc_Tax_Deduction)
|
|||
|
{
|
|||
|
IncomeTax otaxItem = new IncomeTax();
|
|||
|
otaxItem.EmployeeID = oemployee.ID;
|
|||
|
otaxItem.ThisMonthAmount = oDetail.ChangedAmount;
|
|||
|
_incomeTaxes.Add(otaxItem);
|
|||
|
}
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["EmployeeNo"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
_salaryDetails = osalaryDetails;
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Email Address
|
|||
|
public void ImportEmpShortInfo(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
List<Employee> oemployees = Employee.Get();
|
|||
|
Employee oemployee = null;
|
|||
|
_TempEmployees = new ObjectsTemplate<Employee>();
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
Employee oEmp = new Employee();
|
|||
|
oEmp.EmployeeNo = oemployee.EmployeeNo;
|
|||
|
oEmp.EmailAddress = dr["Email Address"].ToString();
|
|||
|
oEmp.JoiningDate = dr["Joining Date"].ToString() == "" ? DateTime.MinValue : Convert.ToDateTime(dr["Joining Date"].ToString());
|
|||
|
if (dr["Confirmation Date"].ToString() != "")
|
|||
|
{
|
|||
|
oEmp.IsConfirmed = true;
|
|||
|
oEmp.ConfirDate = dr["Confirmation Date"].ToString() == "" ? DateTime.MinValue : Convert.ToDateTime(dr["Confirmation Date"].ToString());
|
|||
|
}
|
|||
|
_TempEmployees.Add(oEmp);
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
#region Import Employee Basic Information
|
|||
|
public void ImportEmpBasicInfo()
|
|||
|
{
|
|||
|
_basicwithEmployee = new BasicDataUploadProcess();
|
|||
|
_basicwithEmployee.ImportEmpBasicInfo(_uplodedData);
|
|||
|
_errorOrSuccessList = _basicwithEmployee.ErrorOrSuccessList;
|
|||
|
}
|
|||
|
public void ImportEmpBasicInfo2()
|
|||
|
{
|
|||
|
//_basicwithEmployee = new BasicDataUploadProcess();
|
|||
|
//_basicwithEmployee.ImportEmpBasicInfo(_uplodedData);
|
|||
|
//_errorOrSuccessList = _basicwithEmployee.ErrorOrSuccessList;
|
|||
|
this.ImportEmpBasicInfo2(_uplodedData);
|
|||
|
}
|
|||
|
public void ImportEmpBasicInfoRegularly()
|
|||
|
{
|
|||
|
_basicwithEmployee = new BasicDataUploadProcess();
|
|||
|
_basicwithEmployee.ImportEmpBasicInfoRegularly(_uplodedData);
|
|||
|
_errorOrSuccessList = _basicwithEmployee.ErrorOrSuccessList;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
public ObjectsTemplate<HREmployee> ImportAllEmpGeneralInfoIDLC(DataTable oDTable)
|
|||
|
{
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
|
|||
|
//ObjectsTemplate<EmpContact> oEmployee
|
|||
|
_CheckHREmployees = HREmployee.Get();
|
|||
|
EmpContact oEmpContact = null;
|
|||
|
ObjectsTemplate<Thana> oParmanentsThanas = null;
|
|||
|
ObjectsTemplate<Thana> oPresentThanas = null;
|
|||
|
//HREmployee oHREmployee=null;
|
|||
|
ObjectsTemplate<EmpContact> oEmpContacts = new ObjectsTemplate<EmpContact>();
|
|||
|
|
|||
|
_HREmployees = new ObjectsTemplate<HREmployee>();
|
|||
|
if (_errorOrSuccessList == null)
|
|||
|
_errorOrSuccessList = new List<UploadErrorOrSuccess>();
|
|||
|
|
|||
|
_HREmployee.Contacts = new ObjectsTemplate<EmpContact>();
|
|||
|
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["First Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployee oHREmp = _CheckHREmployees.Find(delegate(HREmployee oItem) { return oItem.EmployeeNo == oDr["EmployeeID"].ToString().ToUpper().Trim(); });
|
|||
|
|
|||
|
oHREmp.Contacts = new ObjectsTemplate<EmpContact>();
|
|||
|
oHREmp.Childrens = new ObjectsTemplate<EmpChildren>();
|
|||
|
oHREmp.Experiences = new ObjectsTemplate<EmpExperience>();
|
|||
|
oHREmp.Spouses = new ObjectsTemplate<EmpSpouse>();
|
|||
|
oHREmp.Experiences = new ObjectsTemplate<EmpExperience>();
|
|||
|
oHREmp.Trainings = new ObjectsTemplate<EmpTraining>();
|
|||
|
oHREmp.Academics = new ObjectsTemplate<EmpAcademic>();
|
|||
|
|
|||
|
oHREmp.Achievement = new ObjectsTemplate<EmpAchievement>();
|
|||
|
oHREmp.OtherTalents = new ObjectsTemplate<EmpOtherTalent>();
|
|||
|
oHREmp.CurricularActivities = new ObjectsTemplate<EmpCurricularActivity>();
|
|||
|
oHREmp.Hobbys = new ObjectsTemplate<EmpHobby>();
|
|||
|
oHREmp.References = new ObjectsTemplate<EmpReference>();
|
|||
|
oHREmp.Allergies = new ObjectsTemplate<EmpAllergy>();
|
|||
|
oHREmp.Publications = new ObjectsTemplate<EmpPublication>();
|
|||
|
oHREmp.Nominees = new ObjectsTemplate<EmpNominee>();
|
|||
|
oHREmp.Hospitalizations = new ObjectsTemplate<EmpHospitalization>();
|
|||
|
oHREmp.Guarantors = new ObjectsTemplate<EmpGuarantor>();
|
|||
|
oHREmp.WorkPlanSetup = new EmpWorkPlanSetup();
|
|||
|
|
|||
|
oHREmp.EmpLanguages = new ObjectsTemplate<EmpLanguage>();
|
|||
|
oHREmp.EmpRelatives = new ObjectsTemplate<EmpRelative>();
|
|||
|
oHREmp.EmpMemberships = new ObjectsTemplate<EmpMembership>();
|
|||
|
oHREmp.EmpRelations = new ObjectsTemplate<EmpRelation>();
|
|||
|
oHREmp.EmpHRQuestionAnswers = new ObjectsTemplate<EmpHRQuestionAnswer>();
|
|||
|
oHREmp.CreditCards = new ObjectsTemplate<EmpCreditCard>();
|
|||
|
|
|||
|
if (oHREmp != null)
|
|||
|
{
|
|||
|
_HREmployee = oHREmp;
|
|||
|
_HREmployee.Contacts = new ObjectsTemplate<EmpContact>();
|
|||
|
//if(_HREmployee.Contacts.Count>0)
|
|||
|
//{
|
|||
|
//_HREmployee.Contacts = new ObjectsTemplate<EmpContact>();
|
|||
|
//}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("EmployeeID", nRow, "EmployeeID : " + oDr["EmployeeID"].ToString() + " Not found in the database"));
|
|||
|
continue;
|
|||
|
_HREmployee = new HREmployee();
|
|||
|
}
|
|||
|
nRow = nRow + 1;
|
|||
|
_HREmployee.PayrollTypeID = Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID;
|
|||
|
_HREmployee.EmployeeNo = oDr["EmployeeID"].ToString();
|
|||
|
_HREmployee.GlobalID = oDr["GEID"].ToString();
|
|||
|
_HREmployee.BirthPlace = oDr["Place Of Birth"].ToString();
|
|||
|
//_HREmployee.NickName = oDr["Nick Name"].ToString();
|
|||
|
_HREmployee.FirstName = oDr["First Name"].ToString();
|
|||
|
_HREmployee.MiddleName = oDr["Middle Name"].ToString();
|
|||
|
_HREmployee.LastName = oDr["Last Name"].ToString();
|
|||
|
_HREmployee.Name = _HREmployee.FirstName + " " + _HREmployee.MiddleName + " " + _HREmployee.LastName;
|
|||
|
_HREmployee.Gender = (oDr["Gender"].ToString().Trim().ToUpper().Trim() == "Male".ToUpper().Trim()) ? EnumGender.Male : EnumGender.Female;
|
|||
|
|
|||
|
|
|||
|
Religion oReligion = _Religions.Find(delegate(Religion oItem) { return oItem.Name.ToUpper().Trim() == oDr["Religion"].ToString().ToUpper().Trim(); });
|
|||
|
if (oReligion != null)
|
|||
|
_HREmployee.ReligionID = oReligion.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Religion", nRow, "Religion is not valid for employee from " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
|
|||
|
if (oDr["Blood Group"].ToString().ToUpper() == "B+".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.BPos;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "B-".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.BNeg;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "A+".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.APos;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "A-".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.ANeg;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "O+".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.OPos;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "O-".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.ONeg;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "AB+".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.ABPos;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "AB-".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.ABNeg;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
_HREmployee.PassportNo = oDr["Passport No"].ToString();
|
|||
|
|
|||
|
_HREmployee.PassportIssuePlace = oDr["Passport Issue Place"].ToString();
|
|||
|
|
|||
|
DateTime dTemPassIssueDate;
|
|||
|
if (DateTime.TryParse(oDr["Passport Issue Date"].ToString(), out dTemPassIssueDate))
|
|||
|
_HREmployee.PassportIssueDate = dTemPassIssueDate;//Convert.ToDateTime(oDr["Employed From Date"].ToString());
|
|||
|
else
|
|||
|
_HREmployee.PassportIssueDate = DateTime.MinValue;
|
|||
|
|
|||
|
DateTime dTemPassExpireDate;
|
|||
|
if (DateTime.TryParse(oDr["Passport Expire Date"].ToString(), out dTemPassExpireDate))
|
|||
|
_HREmployee.PassportExpDate = dTemPassExpireDate;//Convert.ToDateTime(oDr["Employed From Date"].ToString());
|
|||
|
else
|
|||
|
_HREmployee.PassportExpDate = DateTime.MinValue;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
_HREmployee.TinNo = oDr["Tax Identification No"].ToString();
|
|||
|
|
|||
|
Nationality oNationality = _Nationalites.Find(delegate(Nationality oItem) { return oItem.Description.ToUpper().Trim() == oDr["Nationality"].ToString().ToUpper().Trim(); });
|
|||
|
if (oNationality != null)
|
|||
|
_HREmployee.NationalityID = oNationality.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Nationality", nRow, "Nationality is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
_HREmployee.NationalID = oDr["National ID"].ToString();
|
|||
|
|
|||
|
DateTime dTemFDate;
|
|||
|
if (DateTime.TryParse(oDr["Joining Date"].ToString(), out dTemFDate))
|
|||
|
_HREmployee.JoiningDate = dTemFDate;//Convert.ToDateTime(oDr["Employed From Date"].ToString());
|
|||
|
else
|
|||
|
_HREmployee.JoiningDate = DateTime.MinValue;
|
|||
|
|
|||
|
//_HREmployee.JoiningDate = Convert.ToDateTime(oDr["Joining Date"]);
|
|||
|
DateTime dTemBDate;
|
|||
|
if (DateTime.TryParse(oDr["Birth Date"].ToString(), out dTemBDate))
|
|||
|
_HREmployee.BirthDate = dTemBDate;//Convert.ToDateTime(oDr["Date of Birth"]);
|
|||
|
else
|
|||
|
//_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Joining Date", nRow, "Please enter employee joining date " + oDTable.TableName + " Information."));
|
|||
|
_HREmployee.BirthDate = DateTime.MinValue;
|
|||
|
|
|||
|
|
|||
|
Category oCategory = _Categories.Find(delegate(Category oItem) { return oItem.Name.ToUpper().Trim() == oDr["Category"].ToString().ToUpper().Trim(); });
|
|||
|
if (oCategory != null)
|
|||
|
_HREmployee.CategoryID = oCategory.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Category", nRow, "Category is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
_HREmployee.DrivingLicenceNo = oDr["Driving Licence No"].ToString();
|
|||
|
_HREmployee.FatherName = oDr["Father's Name"].ToString();
|
|||
|
_HREmployee.MotherName = oDr["Mother's Name"].ToString();
|
|||
|
Occupation oFOccupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Father's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oFOccupation != null)
|
|||
|
_HREmployee.FatherOccupationID = oFOccupation.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Occupation", nRow, "Father occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
Occupation oMOccupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Mother's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oMOccupation != null)
|
|||
|
_HREmployee.MotherOccupationID = oMOccupation.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Occupation", nRow, "Mother occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#region Employee Contact
|
|||
|
oEmpContact = new EmpContact();
|
|||
|
oEmpContact.ParmanentAddress = oDr["Permanent Address"].ToString();
|
|||
|
District oDisPar = _Districts.Find(delegate(District oItem) { return oItem.Name.ToUpper() == oDr["Permanent District"].ToString().ToUpper(); });
|
|||
|
oParmanentsThanas = Thana.GetByDistID(oDisPar.ID);
|
|||
|
if (oDisPar != null)
|
|||
|
oEmpContact.ParmanentDistrictID = oDisPar.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("District", nRow, "Permanent District is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
Thana oThanaPar = oParmanentsThanas.Find(delegate(Thana oItem) { return oItem.Name.ToUpper().Trim() == oDr["Permanent Thana"].ToString().ToUpper().Trim(); });
|
|||
|
if (oThanaPar != null)
|
|||
|
oEmpContact.ParmanentThanaID = oThanaPar.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Thana", nRow, "Permanent Thana is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpContact.ParmanentTelephone = oDr["Permanent Telephone No"].ToString();
|
|||
|
oEmpContact.ParmanentMobile = oDr["PerMobile No"].ToString();
|
|||
|
|
|||
|
oEmpContact.PresentAddress = oDr["Present Address"].ToString();
|
|||
|
|
|||
|
District oPerDis = _Districts.Find(delegate(District oItem) { return oItem.Name.ToUpper().Trim() == oDr["Present District"].ToString().ToUpper().Trim(); });
|
|||
|
oPresentThanas = Thana.GetByDistID(oPerDis.ID);
|
|||
|
if (oPerDis != null)
|
|||
|
oEmpContact.PresentDistrictID = oPerDis.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("District", nRow, "Present District is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
Thana oThanaPre = oPresentThanas.Find(delegate(Thana oItem) { return oItem.Name.ToUpper().Trim() == oDr["Present Thana"].ToString().ToUpper().Trim(); });
|
|||
|
if (oThanaPre != null)
|
|||
|
oEmpContact.PresentThanaID = oThanaPre.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Thana", nRow, "Present Thana is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpContact.PresentTelephone = oDr["Present Telephone No"].ToString();
|
|||
|
oEmpContact.PresentMobile = oDr["PreMobile No"].ToString();
|
|||
|
|
|||
|
oEmpContact.PersonalTelephone = oDr["Personal Land Phone No"].ToString();
|
|||
|
oEmpContact.Mobile = oDr["Personal Mobile No"].ToString();
|
|||
|
oEmpContact.PersonalEMail = oDr["Personal E-Mail"].ToString();
|
|||
|
oEmpContact.OfficalEMail = oDr["Official E-Mail"].ToString();
|
|||
|
oEmpContact.Fax = oDr["Fax"].ToString();
|
|||
|
|
|||
|
oEmpContact.EmergencyContactAddress = oDr["Emergency Contact Address"].ToString();
|
|||
|
oEmpContact.EmergencyContactPerson = oDr["Emergency Contact Person"].ToString();
|
|||
|
oEmpContact.EmergencyTelephone = oDr["Emergency Telephone No"].ToString();
|
|||
|
oEmpContact.EmergencyMobile = oDr["EmeMobile No"].ToString();
|
|||
|
|
|||
|
Relation oRel = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Relation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRel != null)
|
|||
|
oEmpContact.ContactPersonRelationId = oRel.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Relation", nRow, "Emergency Relation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
_HREmployee.Contacts.Add(oEmpContact);
|
|||
|
_HREmployees.Add(_HREmployee);
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return _HREmployees;
|
|||
|
}
|
|||
|
|
|||
|
private void ImportAllEmpContactInfo(DataUploadColumnDefinition oColumnDefination)
|
|||
|
{
|
|||
|
List<Employee> oemployees = Employee.GetAllEmps();
|
|||
|
Employee oemployee = null;
|
|||
|
|
|||
|
ObjectsTemplate<EmpContact> oContacts = null;
|
|||
|
|
|||
|
oContacts = HREmployee.GetEmpContacts();
|
|||
|
|
|||
|
_Districts = District.Get();
|
|||
|
_Thanas = Thana.Get();
|
|||
|
_Relations = Relation.Get();
|
|||
|
|
|||
|
_empContacts = new ObjectsTemplate<EmpContact>();
|
|||
|
EmpContact oEmpContact = null;
|
|||
|
int nRow = 0;
|
|||
|
foreach (DataRow oDr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
|
|||
|
oemployee = oemployees.SingleOrDefault(x => x.EmployeeNo.Trim().ToUpper() == oDr["Employee No"].ToString().Trim().ToUpper());
|
|||
|
if (oemployee == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No", nRow, "Employee not found in database " + _uplodedData.TableName + " Information."));
|
|||
|
continue;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
if (oContacts.Any(x => x.EmployeeID.Integer == oemployee.ID.Integer))
|
|||
|
{
|
|||
|
oEmpContact = oContacts.First(x => x.EmployeeID.Integer == oemployee.ID.Integer);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oEmpContact = new EmpContact();
|
|||
|
oEmpContact.EmployeeID = oemployee.ID;
|
|||
|
}
|
|||
|
|
|||
|
oEmpContact.ParmanentAddress = oDr["Permanent Address"].ToString();
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(oDr["Permanent District"].ToString().Trim()))
|
|||
|
{
|
|||
|
District oDisPar = _Districts.Find(delegate(District oItem) { return oItem.Name.ToUpper() == oDr["Permanent District"].ToString().ToUpper(); });
|
|||
|
ObjectsTemplate<Thana> oParmanentsThanas = Thana.GetByDistID(oDisPar.ID);
|
|||
|
if (oDisPar != null)
|
|||
|
oEmpContact.ParmanentDistrictID = oDisPar.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("District", nRow, "Permanent District is not valid for employee " + _uplodedData.TableName + " Information."));
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(oDr["Permanent Thana"].ToString().Trim()))
|
|||
|
{
|
|||
|
Thana oThanaPar = oParmanentsThanas.Find(delegate(Thana oItem) { return oItem.Name.ToUpper().Trim() == oDr["Permanent Thana"].ToString().ToUpper().Trim(); });
|
|||
|
if (oThanaPar != null)
|
|||
|
oEmpContact.ParmanentThanaID = oThanaPar.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Thana", nRow, "Permanent Thana is not valid for employee " + _uplodedData.TableName + " Information."));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
oEmpContact.ParmanentTelephone = string.IsNullOrEmpty(oDr["Permanent Telephone No"].ToString().Trim()) ? oEmpContact.ParmanentTelephone : oDr["Permanent Telephone No"].ToString().Trim();
|
|||
|
oEmpContact.ParmanentMobile = string.IsNullOrEmpty(oDr["PerMobile No"].ToString().Trim()) ? oEmpContact.ParmanentMobile : oDr["PerMobile No"].ToString().Trim();
|
|||
|
|
|||
|
oEmpContact.PresentAddress = string.IsNullOrEmpty(oDr["Present Address"].ToString().Trim()) ? oEmpContact.PresentAddress : oDr["Present Address"].ToString().Trim(); ;
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(oDr["Present District"].ToString().Trim()))
|
|||
|
{
|
|||
|
District oDisPre = _Districts.Find(delegate(District oItem) { return oItem.Name.ToUpper() == oDr["Present District"].ToString().ToUpper(); });
|
|||
|
ObjectsTemplate<Thana> oParmanentsThanas = Thana.GetByDistID(oDisPre.ID);
|
|||
|
if (oDisPre != null)
|
|||
|
oEmpContact.ParmanentDistrictID = oDisPre.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("District", nRow, "Present District is not valid for employee " + _uplodedData.TableName + " Information."));
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(oDr["Present Thana"].ToString().Trim()))
|
|||
|
{
|
|||
|
Thana oThanaPre = oParmanentsThanas.Find(delegate(Thana oItem) { return oItem.Name.ToUpper().Trim() == oDr["Present Thana"].ToString().ToUpper().Trim(); });
|
|||
|
if (oThanaPre != null)
|
|||
|
oEmpContact.ParmanentThanaID = oThanaPre.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Thana", nRow, "Present Thana is not valid for employee " + _uplodedData.TableName + " Information."));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
oEmpContact.PresentTelephone = string.IsNullOrEmpty(oDr["Present Telephone No"].ToString().Trim()) ? oEmpContact.PresentTelephone : oDr["Present Telephone No"].ToString().Trim();
|
|||
|
oEmpContact.PresentMobile = string.IsNullOrEmpty(oDr["PreMobile No"].ToString().ToString().Trim()) ? oEmpContact.PresentMobile : oDr["PreMobile No"].ToString().ToString().Trim();
|
|||
|
|
|||
|
oEmpContact.PersonalTelephone = string.IsNullOrEmpty(oDr["Personal Land Phone No"].ToString().Trim()) ? oEmpContact.PersonalTelephone : oDr["Personal Land Phone No"].ToString().Trim();
|
|||
|
oEmpContact.Mobile = string.IsNullOrEmpty(oDr["Personal Mobile No"].ToString().Trim()) ? oEmpContact.Mobile : oDr["Personal Mobile No"].ToString().Trim();
|
|||
|
oEmpContact.PersonalEMail = string.IsNullOrEmpty(oDr["Personal E-Mail"].ToString().Trim()) ? oEmpContact.PersonalEMail : oDr["Personal E-Mail"].ToString().Trim();
|
|||
|
oEmpContact.OfficalEMail = string.IsNullOrEmpty(oDr["Official E-Mail"].ToString().Trim()) ? oEmpContact.OfficalEMail : oDr["Official E-Mail"].ToString().Trim();
|
|||
|
oEmpContact.Fax = string.IsNullOrEmpty(oDr["Fax"].ToString().Trim()) ? oEmpContact.Fax : oDr["Fax"].ToString().Trim();
|
|||
|
|
|||
|
oEmpContact.EmergencyContactAddress = string.IsNullOrEmpty(oDr["Emergency Contact Address"].ToString().Trim()) ? oEmpContact.EmergencyContactAddress : oDr["Emergency Contact Address"].ToString().Trim();
|
|||
|
oEmpContact.EmergencyContactPerson = string.IsNullOrEmpty(oDr["Emergency Contact Person"].ToString().Trim()) ? oEmpContact.EmergencyContactPerson : oDr["Emergency Contact Person"].ToString().Trim();
|
|||
|
oEmpContact.EmergencyTelephone = string.IsNullOrEmpty(oDr["Emergency Telephone No"].ToString().Trim()) ? oEmpContact.EmergencyTelephone : oDr["Emergency Telephone No"].ToString().Trim();
|
|||
|
oEmpContact.EmergencyMobile = string.IsNullOrEmpty(oDr["EmeMobile No"].ToString().Trim()) ? oEmpContact.EmergencyMobile : oDr["EmeMobile No"].ToString().Trim();
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(oDr["Relation"].ToString().Trim()))
|
|||
|
{
|
|||
|
Relation oRel = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Relation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRel != null)
|
|||
|
oEmpContact.ContactPersonRelationId = oRel.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Relation", nRow, "Emergency Relation is not valid for employee " + _uplodedData.TableName + " Information."));
|
|||
|
}
|
|||
|
//_HREmployee.Contacts.Add(oEmpContact);
|
|||
|
// _HREmployees.Add(_HREmployee);
|
|||
|
|
|||
|
_empContacts.Add(oEmpContact);
|
|||
|
}
|
|||
|
#region Employee Contact
|
|||
|
oEmpContact = new EmpContact();
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
#region Import Exception Data
|
|||
|
public void ImportException(int uploadId, DataUploadColumnDefinition oColumnDefinition)
|
|||
|
{
|
|||
|
_uploadException = new DataUploadException();
|
|||
|
_uploadException.UploadException(uploadId, _uplodedData, oColumnDefinition);
|
|||
|
_errorOrSuccessList = _uploadException.ErrorOrSuccessList;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Tax Data
|
|||
|
public void ImportTaxData()
|
|||
|
{
|
|||
|
_basicwithEmployee = new BasicDataUploadProcess();
|
|||
|
_basicwithEmployee.ImportTaxDataInfo(_uplodedData);
|
|||
|
_errorOrSuccessList = _basicwithEmployee.ErrorOrSuccessList;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Tax Adjustment Data
|
|||
|
public void ImportTaxAdjustmentData(DataUploadColumnDefinition columnDefinition)
|
|||
|
{
|
|||
|
_basicwithEmployee = new BasicDataUploadProcess();
|
|||
|
_basicwithEmployee.ImportTaxAdjustmentData(_uplodedData, columnDefinition);
|
|||
|
|
|||
|
_errorOrSuccessList = _basicwithEmployee.ErrorOrSuccessList;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Bonus Information
|
|||
|
public BonusProcess ImportEmpBonus(DataUploadColumnDefinition _columnDefinition, bool IsDisburshWithSalry, bool IsTaxProcess, double UsedProcess, ID bonusID, DateTime dPayDate, int _nReligionID)
|
|||
|
{
|
|||
|
double BonusAdjustAmount;
|
|||
|
double BonusSalaryItemAmount;
|
|||
|
double nBasicSalary = 0;
|
|||
|
double nGrossSalary = 0;
|
|||
|
|
|||
|
List<Employee> oemployees = Employee.Get();
|
|||
|
Employee oemployee = null;
|
|||
|
BonusProcess oProssBonus = new BonusProcess();
|
|||
|
oProssBonus.BonusProcessDetails = new ObjectsTemplate<BonusProcess.BonusProcessDetail>();
|
|||
|
|
|||
|
List<EnmSetupManagerTranType> setupTypes = SetupDetail.GetTypes(EnumParameterSetup.Bonus);
|
|||
|
ObjectsTemplate<SetupDetail> setupDetails = SetupDetail.GetParameters(EnumParameterSetup.Bonus);
|
|||
|
ObjectsTemplate<BonusParameter> bonusParameters = BonusParameter.Get(EnumStatus.Regardless);
|
|||
|
//List<EmployeeGradeSalary> grdSals = EmployeeGradeSalary.Get();
|
|||
|
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
BonusAdjustAmount = 0.0;
|
|||
|
BonusSalaryItemAmount = 0.0;
|
|||
|
if (nRow == 2250)
|
|||
|
nRow = 2250;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
ObjectsTemplate<BonusParameter> oParams = BonusParameter.ApplicableParameters3(oemployee, bonusID, setupTypes, setupDetails, bonusParameters);
|
|||
|
if (oParams != null)
|
|||
|
{
|
|||
|
foreach (BonusParameter oBonusParm in oParams)
|
|||
|
{
|
|||
|
oProssBonus.BonusID = oBonusParm.BonusID;
|
|||
|
oProssBonus.BasicOnMonth = GlobalFunctions.LastDateOfMonth(SystemInformation.CurrentSysInfo.LastPayProcessDate);
|
|||
|
oProssBonus.BonusMonth = GlobalFunctions.LastDateOfMonth(dPayDate);// Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
|
|||
|
oProssBonus.DisburseDate = dPayDate;// Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
|
|||
|
oProssBonus.IsDisburseWithSalary = IsDisburshWithSalry;
|
|||
|
oProssBonus.IsTaxProcess = IsTaxProcess;
|
|||
|
oProssBonus.UsedProcess = UsedProcess;
|
|||
|
oProssBonus.ReligionID = ID.FromInteger(_nReligionID);
|
|||
|
EmployeeGradeSalary ogs = null;
|
|||
|
// var nMaxID = (grdSals.FindAll(x => x.EmployeeID == oemployee.ID && x.EffectDate <= GlobalFunctions.LastDateOfMonth(SystemInformation.CurrentSysInfo.LastPayProcessDate))).Max(y => y.ID.Integer);
|
|||
|
// if (nMaxID != 0) ogs = grdSals.Find(x => x.ID.Integer == nMaxID);
|
|||
|
//// EmployeeGradeSalary ogs = EmployeeGradeSalary.GetBasicOnDate(oemployee.ID, GlobalFunctions.LastDateOfMonth(SystemInformation.CurrentSysInfo.LastPayProcessDate));
|
|||
|
// oemployee.GradeID = ogs == null ? oemployee.GradeID : ogs.GradeID;
|
|||
|
// if (ogs == null)
|
|||
|
// {
|
|||
|
nBasicSalary = oemployee.BasicSalary;
|
|||
|
nGrossSalary = oemployee.GrossSalary;
|
|||
|
//}
|
|||
|
//else
|
|||
|
//{
|
|||
|
// nBasicSalary = ogs.BasicSalary;
|
|||
|
// nGrossSalary = ogs.GrossSalary;
|
|||
|
//}
|
|||
|
|
|||
|
BonusProcess.BonusProcessDetail oBPDetail = new BonusProcess.BonusProcessDetail();
|
|||
|
oBPDetail.BonusID = oBonusParm.BonusID;
|
|||
|
oBPDetail.EmployeeID = oemployee.ID;
|
|||
|
oBPDetail.BasicSalary = nBasicSalary;
|
|||
|
oBPDetail.BonusMonth = GlobalFunctions.LastDateOfMonth(dPayDate);//Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
|
|||
|
if (_columnDefinition.SelectedItemOneID == ID.FromInteger(0))
|
|||
|
{
|
|||
|
oBPDetail.BonusAmount = Convert.ToDouble(dr["Value"]);
|
|||
|
}
|
|||
|
else if (_columnDefinition.SelectedItemOneID == ID.FromInteger(1))
|
|||
|
{
|
|||
|
oBPDetail.BonusAmount = (nBasicSalary * Convert.ToDouble(dr["Value"])) / 100;
|
|||
|
}
|
|||
|
else if (_columnDefinition.SelectedItemOneID == ID.FromInteger(2))
|
|||
|
{
|
|||
|
BonusCalculator ob = new BonusCalculator();
|
|||
|
double dailyAmount = ob.ConvertToDailyRate(nBasicSalary, oBPDetail.BonusMonth);
|
|||
|
oBPDetail.BonusAmount = dailyAmount * Convert.ToDouble(dr["Value"]);
|
|||
|
}
|
|||
|
oBPDetail.ChangeBonusAmount = GlobalFunctions.Round(oBPDetail.BonusAmount);
|
|||
|
oBPDetail.CalculatedAdjustAmount = BonusAdjustAmount;
|
|||
|
oBPDetail.CalculatedSalaryItemAmount = BonusSalaryItemAmount;
|
|||
|
oBPDetail.ChangeAdjustAmount = BonusAdjustAmount;
|
|||
|
oBPDetail.ChangeSalaryItemAmount = BonusSalaryItemAmount;
|
|||
|
BonusProcess.BonusProcessDetail.BonusProcessAdjustItem bai = new BonusProcess.BonusProcessDetail.BonusProcessAdjustItem();
|
|||
|
bai.BonusAdjustID = oBPDetail.BonusID.Integer;
|
|||
|
bai.AdjustAmount = Convert.ToDouble(dr["Value"]);
|
|||
|
oBPDetail.BonusProcessAdjustItems = new ObjectsTemplate<BonusProcess.BonusProcessDetail.BonusProcessAdjustItem>();
|
|||
|
oBPDetail.BonusProcessAdjustItems.Add(bai);
|
|||
|
oProssBonus.BonusProcessDetails.Add(oBPDetail);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "Parameter not found for the employee"));
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
if (_errorOrSuccessList.Count > 0)
|
|||
|
return new BonusProcess();
|
|||
|
BonusCalculator oBonusCalculator = new BonusCalculator();
|
|||
|
ObjectsTemplate<Employee> oEmployees = new ObjectsTemplate<Employee>();
|
|||
|
foreach (BonusProcess.BonusProcessDetail BProcess in oProssBonus.BonusProcessDetails)
|
|||
|
{
|
|||
|
Employee emp = oemployees.Find(x => x.ID == BProcess.EmployeeID);
|
|||
|
if (emp != null) oEmployees.Add(emp);
|
|||
|
}
|
|||
|
if (IsTaxProcess == true)
|
|||
|
{
|
|||
|
Bonus oItem = Bonus.Get(bonusID);
|
|||
|
|
|||
|
oBonusCalculator.CalculateTax(oProssBonus, oEmployees, oItem);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return oProssBonus;
|
|||
|
}
|
|||
|
public BonusProcess ImportEmpIndividualBonus(DataUploadColumnDefinition _columnDefinition, bool IsDisburshWithSalry, bool IsTaxProcess, double UsedProcess, ID bonusID, DateTime dCuttOfDate, DateTime dPaydate, int _nReligionID)
|
|||
|
{
|
|||
|
double BonusAdjustAmount;
|
|||
|
double BonusSalaryItemAmount;
|
|||
|
double nBasicSalary = 0;
|
|||
|
double nGrossSalary = 0;
|
|||
|
|
|||
|
List<Employee> oemployees = Employee.Get();
|
|||
|
Employee oemployee = null;
|
|||
|
BonusProcess oProssBonus = new BonusProcess();
|
|||
|
oProssBonus.BonusProcessDetails = new ObjectsTemplate<BonusProcess.BonusProcessDetail>();
|
|||
|
|
|||
|
List<EnmSetupManagerTranType> setupTypes = SetupDetail.GetTypes(EnumParameterSetup.Bonus);
|
|||
|
ObjectsTemplate<SetupDetail> setupDetails = SetupDetail.GetParameters(EnumParameterSetup.Bonus);
|
|||
|
List<BonusParameter> bonusParameters = BonusParameter.Get(EnumStatus.Regardless);
|
|||
|
|
|||
|
ObjectsTemplate<ADParameter> adParams = ADParameter.Get(EnumStatus.Active);
|
|||
|
ObjectsTemplate<ADParameterEmployee> adParamEmps = ADParameterEmployee.Get(EnumStatus.Active);
|
|||
|
ObjectsTemplate<GrossDefination> grossDefinitions = GrossDefination.Get();
|
|||
|
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
BonusAdjustAmount = 0.0;
|
|||
|
BonusSalaryItemAmount = 0.0;
|
|||
|
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });
|
|||
|
EmployeeGradeSalary oEmpGradeSal = EmployeeGradeSalary.GetBasicOnDate(oemployee.ID, dCuttOfDate);
|
|||
|
oemployee.GrossSalary = BonusCalculator.GetGrossAmount(oemployee, adParams, adParamEmps, grossDefinitions, dCuttOfDate, oEmpGradeSal);
|
|||
|
oemployee.GradeID = oEmpGradeSal.GradeID;
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
ObjectsTemplate<BonusParameter> oParams = BonusParameter.ApplicableParameters(oemployee, bonusID, setupTypes, setupDetails, bonusParameters);
|
|||
|
if (oParams != null)
|
|||
|
{
|
|||
|
foreach (BonusParameter oBonusParm in oParams)
|
|||
|
{
|
|||
|
oProssBonus.BonusID = oBonusParm.BonusID;
|
|||
|
oProssBonus.BasicOnMonth = GlobalFunctions.LastDateOfMonth(dCuttOfDate);
|
|||
|
oProssBonus.BonusMonth = GlobalFunctions.LastDateOfMonth(dPaydate); ;
|
|||
|
oProssBonus.DisburseDate = GlobalFunctions.LastDateOfMonth(dPaydate);
|
|||
|
|
|||
|
oProssBonus.IsDisburseWithSalary = IsDisburshWithSalry;
|
|||
|
oProssBonus.IsTaxProcess = IsTaxProcess;
|
|||
|
oProssBonus.UsedProcess = UsedProcess;
|
|||
|
oProssBonus.ReligionID = ID.FromInteger(_nReligionID);
|
|||
|
//EmployeeGradeSalary ogs = EmployeeGradeSalary.GetBasicOnDate(oemployee.ID, GlobalFunctions.LastDateOfMonth(SystemInformation.CurrentSysInfo.LastPayProcessDate));
|
|||
|
|
|||
|
//if (ogs == null)
|
|||
|
//{
|
|||
|
nBasicSalary = oemployee.BasicSalary;
|
|||
|
// nGrossSalary = oEmp.GrossSalary;
|
|||
|
//}
|
|||
|
//else
|
|||
|
//{
|
|||
|
// nBasicSalary = ogs.BasicSalary;
|
|||
|
// // nGrossSalary = ogs.GrossSalary;
|
|||
|
//}
|
|||
|
|
|||
|
BonusProcess.BonusProcessDetail oBPDetail = new BonusProcess.BonusProcessDetail();
|
|||
|
oBPDetail.BonusID = oBonusParm.BonusID;
|
|||
|
oBPDetail.EmployeeID = oemployee.ID;
|
|||
|
oBPDetail.BonusMonth = dPaydate;
|
|||
|
oBPDetail.BasicSalary = nBasicSalary;
|
|||
|
oBPDetail.GrossSalary = oemployee.GrossSalary;
|
|||
|
oBPDetail.BonusMonth = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
|
|||
|
|
|||
|
if (_columnDefinition.SelectedItemOneID == ID.FromInteger(0))
|
|||
|
{
|
|||
|
oBPDetail.BonusAmount = Convert.ToDouble(dr["Value"]);
|
|||
|
}
|
|||
|
else if (_columnDefinition.SelectedItemOneID == ID.FromInteger(1))
|
|||
|
{
|
|||
|
oBPDetail.BonusAmount = (nBasicSalary * Convert.ToDouble(dr["Value"])) / 100;
|
|||
|
}
|
|||
|
else if (_columnDefinition.SelectedItemOneID == ID.FromInteger(2))
|
|||
|
{
|
|||
|
BonusCalculator ob = new BonusCalculator();
|
|||
|
double dailyAmount = ob.ConvertToDailyRate(nBasicSalary, oBPDetail.BonusMonth);
|
|||
|
oBPDetail.BonusAmount = dailyAmount * Convert.ToDouble(dr["Value"]);
|
|||
|
}
|
|||
|
else if (_columnDefinition.SelectedItemOneID == ID.FromInteger(3))
|
|||
|
{
|
|||
|
oBPDetail.BonusAmount = CalcluateAmount(oBonusParm, oemployee, oemployee.GrossSalary, Convert.ToDouble(dr["Value"]));
|
|||
|
}
|
|||
|
oBPDetail.ChangeBonusAmount = GlobalFunctions.Round(oBPDetail.BonusAmount);
|
|||
|
oBPDetail.CalculatedAdjustAmount = oBonusParm.PercentOfGross;
|
|||
|
oBPDetail.CalculatedSalaryItemAmount = oBonusParm.PerformanceBonusPercent;
|
|||
|
//oBPDetail.ChangeAdjustAmount = BonusAdjustAmount;
|
|||
|
//oBPDetail.ChangeSalaryItemAmount = BonusSalaryItemAmount;
|
|||
|
BonusProcess.BonusProcessDetail.BonusProcessAdjustItem obj = new BonusProcess.BonusProcessDetail.BonusProcessAdjustItem();
|
|||
|
oBPDetail.BonusProcessAdjustItems = new ObjectsTemplate<BonusProcess.BonusProcessDetail.BonusProcessAdjustItem>();
|
|||
|
obj.BonusAdjustID = 4;
|
|||
|
obj.AdjustAmount = oBonusParm.PerformanceBonusPercent;
|
|||
|
oBPDetail.BonusProcessAdjustItems.Add(obj);
|
|||
|
|
|||
|
oProssBonus.BonusProcessDetails.Add(oBPDetail);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "Parameter not found for the employee"));
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
BonusCalculator oBonusCalculator = new BonusCalculator();
|
|||
|
ObjectsTemplate<Employee> oEmployees = new ObjectsTemplate<Employee>();
|
|||
|
foreach (BonusProcess.BonusProcessDetail BProcess in oProssBonus.BonusProcessDetails)
|
|||
|
{
|
|||
|
oEmployees.Add(BProcess.Employee);
|
|||
|
}
|
|||
|
if (IsTaxProcess == true)
|
|||
|
{
|
|||
|
Bonus oItem = Bonus.Get(bonusID);
|
|||
|
|
|||
|
oBonusCalculator.CalculateTax(oProssBonus, oEmployees, oItem);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return oProssBonus;
|
|||
|
}
|
|||
|
private double CalcluateAmount(BonusParameter oBonusParm, Employee oEmp, double nGrossSalary, double nPercentage)
|
|||
|
{
|
|||
|
Double m_nAMOUNT = 0;
|
|||
|
double nAnnualGrossPencentage = oBonusParm.PercentOfGross;
|
|||
|
double nPerformancePencentage = oBonusParm.PerformanceBonusPercent;
|
|||
|
m_nAMOUNT = ((nGrossSalary * nAnnualGrossPencentage) / 100);
|
|||
|
m_nAMOUNT = ((m_nAMOUNT * nPerformancePencentage) / 100);
|
|||
|
m_nAMOUNT = ((m_nAMOUNT * nPercentage) / 100);
|
|||
|
|
|||
|
return m_nAMOUNT;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region OPIDate
|
|||
|
private void ImportOPIDataAfterProcess(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
List<Employee> oemployees = Employee.GetAllEmps();
|
|||
|
List<OPIProcess> _oOPIProcess = OPIProcess.Get(SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
OpiParameter _opParam = null;
|
|||
|
Employee oemployee = null;
|
|||
|
ObjectsTemplate<OpiParameterIndividual> oopiParameterInd = new ObjectsTemplate<OpiParameterIndividual>();
|
|||
|
OpiParameterIndividual oOPIParameter = null;
|
|||
|
int nRow = 0;
|
|||
|
_oPIProcessDetailItem = new ObjectsTemplate<OPIProcessDetailItem>();
|
|||
|
_incomeTaxes = new ObjectsTemplate<IncomeTax>();
|
|||
|
double tempAmount = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Where(x => x.EmployeeNo == dr["Employee No"].ToString()).Single(); ;
|
|||
|
//OPIProcessDetail oOPIProcessDetail = _oOPIProcess[0].OPIProcessDetails.Find(delegate(OPIProcessDetail opid) { return opid.EmployeeID == oemployee.ID; });
|
|||
|
List<OPIProcessDetail> oOpIProcessDetails = new List<OPIProcessDetail>();
|
|||
|
if (_oOPIProcess != null)
|
|||
|
_oOPIProcess.ForEach(x => oOpIProcessDetails.AddRange(x.OPIProcessDetails.ToList()));
|
|||
|
|
|||
|
OPIProcessDetail oOPIProcessDetail = oOpIProcessDetails.Where(x => x.EmployeeID == oemployee.ID).SingleOrDefault();
|
|||
|
|
|||
|
if (oOPIProcessDetail != null)
|
|||
|
{
|
|||
|
OPIProcessDetailItem oOPIProcessDetailItem = new OPIProcessDetailItem();
|
|||
|
oOPIProcessDetailItem.OPIType = EnumOpiType.Provision;
|
|||
|
oOPIProcessDetailItem.OPIItemID = _columnDefinition.SelectedItemOneID;
|
|||
|
oOPIProcessDetailItem.Description = _columnDefinition.SelectedItemOneText;
|
|||
|
oOPIProcessDetailItem.ChangeNetAmount = Convert.ToDouble(dr["Amount"].ToString());
|
|||
|
oOPIProcessDetailItem.NetAmount = oOPIProcessDetailItem.ChangeNetAmount;
|
|||
|
oOPIProcessDetailItem.OPIProcessDetailID = oOPIProcessDetail.ID;
|
|||
|
_oPIProcessDetailItem.Add(oOPIProcessDetailItem);
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void ImportOPIDataNew(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
List<Employee> oemployees = Employee.Get();
|
|||
|
//List<ADParameter> _adparams = ADParameter.Get(EnumStatus.Active, EnumAllowOrDeduct.Deduction);
|
|||
|
//ADParameter _adparam = null;
|
|||
|
Employee oemployee = null;
|
|||
|
_oPIParameterIndividual = new ObjectsTemplate<OpiParameterIndividual>();
|
|||
|
OpiParameterIndividual oopiParamIndividual = null;
|
|||
|
ObjectsTemplate<OpiParameter> oparamters = OpiParameter.Get();
|
|||
|
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
oopiParamIndividual = new OpiParameterIndividual();
|
|||
|
oopiParamIndividual.EmployeeId = oemployee.ID;
|
|||
|
//oadparamemp.FormDate = Convert.ToDateTime(dr["From Date"]);
|
|||
|
//oadparamemp.TillDate = Convert.ToDateTime(dr["Till Date"]);
|
|||
|
oopiParamIndividual.Value = dr["Amount"].ToString() != string.Empty ? Convert.ToDouble(dr["Amount"]) : 0.0;
|
|||
|
oopiParamIndividual.OpiItemId = _columnDefinition.SelectedItemOneID; //ID.FromInteger(Convert.ToInt32(EnumAllowOrDeduct.Deduction));
|
|||
|
if (oemployee.GradeID == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No :" + oemployee.EmployeeNo + " Row : ", nRow, "Employee grade id not found."));
|
|||
|
|
|||
|
continue;
|
|||
|
}
|
|||
|
List<OpiParameter> opiAppParams = OpiParameter.GetApplicableParameters(oemployee, oemployee.GradeID, oparamters);
|
|||
|
OpiParameter opiAppParam = opiAppParams.FirstOrDefault(o => o.OpiItemID == oopiParamIndividual.OpiItemId);
|
|||
|
if (opiAppParam == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee applicable parameter not found."));
|
|||
|
continue;
|
|||
|
}
|
|||
|
oopiParamIndividual.OpiParameterID = opiAppParam.ID;
|
|||
|
oopiParamIndividual.OpiPeriodicity = opiAppParam.OpiPeriodicity;
|
|||
|
oopiParamIndividual.IndividualType = EnumOPIIndivdualType.AppliedToIndividual;
|
|||
|
if (oopiParamIndividual.OpiPeriodicity == EnumOpiPeriodicity.OnceOff)
|
|||
|
{
|
|||
|
oopiParamIndividual.FromDate = Payroll.BO.GlobalFunctions.FirstDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
oopiParamIndividual.ToDate = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
|
|||
|
}
|
|||
|
else if (oopiParamIndividual.OpiPeriodicity == EnumOpiPeriodicity.Monthly && opiAppParam.EntitleType == EnumEntitleType.Individual)
|
|||
|
{
|
|||
|
// from date can't prior to fist date of current month
|
|||
|
// till date can't be less to from date
|
|||
|
// from date can't be greater to last date of current month
|
|||
|
if (dr["From Date"].ToString() != "" && Convert.ToDateTime(dr["From Date"]) < Payroll.BO.GlobalFunctions.FirstDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate))
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("From Date :" + dr["From Date"].ToString() + " Row : ", nRow, "From date can not be less than first date of current month"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
if (dr["From Date"].ToString() != "" && Convert.ToDateTime(dr["From Date"]) > Payroll.BO.GlobalFunctions.LastDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate))
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("From Date :" + dr["From Date"].ToString() + " Row : ", nRow, "From date can not be greater than last date of current month"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
if (dr["Till Date"].ToString() != "" && Convert.ToDateTime(dr["Till Date"]) < Convert.ToDateTime(dr["From Date"]))
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Till Date :" + dr["Till Date"].ToString() + " Row : ", nRow, "Till date can not be less than From date"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
oopiParamIndividual.FromDate = dr["From Date"].ToString() != "" ? Convert.ToDateTime(dr["From Date"]) : Payroll.BO.GlobalFunctions.FirstDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
if (dr["Till Date"].ToString() != "")
|
|||
|
oopiParamIndividual.ToDate = Convert.ToDateTime(dr["Till Date"]);
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No :" + dr["Employee No"].ToString() + " Row : ", nRow, "Employee applicable parameter is defined greade wise"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
oopiParamIndividual.ValueType = EnumValueType.Amount;
|
|||
|
_oPIParameterIndividual.Add(oopiParamIndividual);
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occurred on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void ImportCarFuelDataNew(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
List<Employee> oemployees = Employee.Get();
|
|||
|
//List<ADParameter> _adparams = ADParameter.Get(EnumStatus.Active, EnumAllowOrDeduct.Deduction);
|
|||
|
//ADParameter _adparam = null;
|
|||
|
Employee oemployee = null;
|
|||
|
_CarFuelParameterIndividual = new ObjectsTemplate<CarFuelParameterIndividual>();
|
|||
|
CarFuelParameterIndividual oCarFuelParamIndividual = null;
|
|||
|
ObjectsTemplate<CarFuelParameter> oparamters = CarFuelParameter.Get();
|
|||
|
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
oCarFuelParamIndividual = new CarFuelParameterIndividual();
|
|||
|
oCarFuelParamIndividual.EmployeeId = oemployee.ID;
|
|||
|
//oadparamemp.FormDate = Convert.ToDateTime(dr["From Date"]);
|
|||
|
//oadparamemp.TillDate = Convert.ToDateTime(dr["Till Date"]);
|
|||
|
oCarFuelParamIndividual.Value = dr["Amount"].ToString() != string.Empty ? Convert.ToDouble(dr["Amount"]) : 0.0;
|
|||
|
oCarFuelParamIndividual.CarFuelItemId = _columnDefinition.SelectedItemOneID; //ID.FromInteger(Convert.ToInt32(EnumAllowOrDeduct.Deduction));
|
|||
|
if (oemployee.GradeID == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No :" + oemployee.EmployeeNo + " Row : ", nRow, "Employee grade id not found."));
|
|||
|
|
|||
|
continue;
|
|||
|
}
|
|||
|
List<CarFuelParameter> CarFuelAppParams = CarFuelParameter.GetApplicableParameters(oemployee, oemployee.GradeID, oparamters);
|
|||
|
CarFuelParameter CarFuelAppParam = CarFuelAppParams.FirstOrDefault(o => o.CarFuelItemID == oCarFuelParamIndividual.CarFuelItemId);
|
|||
|
if (CarFuelAppParam == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee applicable parameter not found."));
|
|||
|
continue;
|
|||
|
}
|
|||
|
oCarFuelParamIndividual.CarFuelParameterID = CarFuelAppParam.ID;
|
|||
|
oCarFuelParamIndividual.CarFuelPeriodicity = CarFuelAppParam.CarFuelPeriodicity;
|
|||
|
oCarFuelParamIndividual.IndividualType = EnumCarFuelIndivdualType.AppliedToIndividual;
|
|||
|
if (oCarFuelParamIndividual.CarFuelPeriodicity == EnumCarFuelPeriodicity.OnceOff)
|
|||
|
{
|
|||
|
oCarFuelParamIndividual.FromDate = Payroll.BO.GlobalFunctions.FirstDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
oCarFuelParamIndividual.ToDate = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
|
|||
|
}
|
|||
|
else if (oCarFuelParamIndividual.CarFuelPeriodicity == EnumCarFuelPeriodicity.Monthly && CarFuelAppParam.EntitleType == EnumEntitleType.Individual)
|
|||
|
{
|
|||
|
// from date can't prior to fist date of current month
|
|||
|
// till date can't be less to from date
|
|||
|
// from date can't be greater to last date of current month
|
|||
|
if (dr["From Date"].ToString() != "" && Convert.ToDateTime(dr["From Date"]) < Payroll.BO.GlobalFunctions.FirstDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate))
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("From Date :" + dr["From Date"].ToString() + " Row : ", nRow, "From date can not be less than first date of current month"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
if (dr["From Date"].ToString() != "" && Convert.ToDateTime(dr["From Date"]) > Payroll.BO.GlobalFunctions.LastDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate))
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("From Date :" + dr["From Date"].ToString() + " Row : ", nRow, "From date can not be greater than last date of current month"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
if (dr["Till Date"].ToString() != "" && Convert.ToDateTime(dr["Till Date"]) < Convert.ToDateTime(dr["From Date"]))
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Till Date :" + dr["Till Date"].ToString() + " Row : ", nRow, "Till date can not be less than From date"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
oCarFuelParamIndividual.FromDate = dr["From Date"].ToString() != "" ? Convert.ToDateTime(dr["From Date"]) : Payroll.BO.GlobalFunctions.FirstDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
if (dr["Till Date"].ToString() != "")
|
|||
|
oCarFuelParamIndividual.ToDate = Convert.ToDateTime(dr["Till Date"]);
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No :" + dr["Employee No"].ToString() + " Row : ", nRow, "Employee applicable parameter is defined greade wise"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
oCarFuelParamIndividual.ValueType = EnumValueType.Amount;
|
|||
|
_CarFuelParameterIndividual.Add(oCarFuelParamIndividual);
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occurred on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public void ImportOPIData(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
List<Employee> oemployees = Employee.Get();
|
|||
|
ObjectsTemplate<OPIProcessDetailItem> oOPIDetailItems = new ObjectsTemplate<OPIProcessDetailItem>();
|
|||
|
_incomeTaxes = new ObjectsTemplate<IncomeTax>();
|
|||
|
|
|||
|
Employee oemployee = null;
|
|||
|
int nRow = 0;
|
|||
|
double tempAmount = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });
|
|||
|
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
OPIProcessDetail oOPIPDetail = OPIProcess.GetDetail(oemployee.ID, Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
if (oOPIPDetail == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + " OPI not yet process"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
|
|||
|
OPIProcessDetailItem oDetail = oOPIPDetail.OPIProcessDetailItems.Find(delegate(OPIProcessDetailItem oOPIPDItem) { return oOPIPDItem.OPIItemID == _columnDefinition.SelectedItemOneID; });
|
|||
|
if (oDetail == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + " opi component not found"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
tempAmount = oDetail.ChangeNetAmount;
|
|||
|
|
|||
|
oDetail.ChangeNetAmount = Convert.ToDouble(dr["Amount"]);
|
|||
|
oDetail.NetAmount = oDetail.ChangeNetAmount;
|
|||
|
}
|
|||
|
|
|||
|
oOPIDetailItems.Add(oDetail);
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
_oPIProcessDetailItem = oOPIDetailItems;
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void ImportOPIParamInividual(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
ObjectsTemplate<OpiParameterIndividual> oOPIParamIndividuals = new ObjectsTemplate<OpiParameterIndividual>();
|
|||
|
List<Employee> oemployees = Employee.Get();
|
|||
|
ObjectsTemplate<OpiParameter> oPIParameters = OpiParameter.Get();
|
|||
|
|
|||
|
_incomeTaxes = new ObjectsTemplate<IncomeTax>();
|
|||
|
|
|||
|
Employee oemployee = null;
|
|||
|
int nRow = 0;
|
|||
|
double tempAmount = 0;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
|
|||
|
List<OpiParameterIndividual> oTotalParamIndividuals = OpiParameterIndividual.Get().Where(x => x.OpiItemId == _columnDefinition.SelectedItemOneID).ToList();
|
|||
|
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.FirstOrDefault(x => x.EmployeeNo == dr["Employee No"].ToString());
|
|||
|
|
|||
|
List<OpiParameter> oEmpOPIParams = OpiParameter.GetApplicableParameters(oemployee, oemployee.GradeID, oPIParameters);
|
|||
|
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
OpiParameterIndividual oEmpParamIndividual = oTotalParamIndividuals.FirstOrDefault(x => x.EmployeeId == oemployee.ID);
|
|||
|
|
|||
|
if (oEmpParamIndividual == null)
|
|||
|
{
|
|||
|
var oEmpOPIParameter = oEmpOPIParams.FirstOrDefault(x => x.OpiItemID == _columnDefinition.SelectedItemOneID);
|
|||
|
|
|||
|
if (oEmpOPIParameter != null)
|
|||
|
{
|
|||
|
oEmpParamIndividual = new OpiParameterIndividual();
|
|||
|
oEmpParamIndividual.ArrearType = EnumArrearType.NotPresent;
|
|||
|
oEmpParamIndividual.EmployeeId = oemployee.ID;
|
|||
|
oEmpParamIndividual.OpiPeriodicity = oEmpOPIParameter.OpiPeriodicity;
|
|||
|
oEmpParamIndividual.IndividualType = EnumOPIIndivdualType.AppliedToIndividual;
|
|||
|
oEmpParamIndividual.OpiItemId = _columnDefinition.SelectedItemOneID;
|
|||
|
oEmpParamIndividual.OpiParameterID = oEmpOPIParameter.ID;
|
|||
|
oEmpParamIndividual.ValueType = EnumValueType.Amount;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + " No OPI Setup for this Employee Found"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
oEmpParamIndividual.Value = Convert.ToDouble(dr["Amount"]);
|
|||
|
oEmpParamIndividual.FromDate = GlobalFunctions.FirstDateOfMonth(SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
|
|||
|
if (oEmpParamIndividual.OpiPeriodicity == EnumOpiPeriodicity.OnceOff)
|
|||
|
{
|
|||
|
oEmpParamIndividual.ToDate = GlobalFunctions.LastDateOfMonth(SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oEmpParamIndividual.ToDate = null;
|
|||
|
}
|
|||
|
|
|||
|
oOPIParamIndividuals.Add(oEmpParamIndividual);
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
_oPIParameterIndividual = oOPIParamIndividuals;
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void ImportCarFuelParamInividual(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
ObjectsTemplate<CarFuelParameterIndividual> oCarFuelParamIndividuals = new ObjectsTemplate<CarFuelParameterIndividual>();
|
|||
|
List<Employee> oemployees = Employee.Get();
|
|||
|
ObjectsTemplate<CarFuelParameter> CarFuelParameters = CarFuelParameter.Get();
|
|||
|
|
|||
|
_incomeTaxes = new ObjectsTemplate<IncomeTax>();
|
|||
|
|
|||
|
Employee oemployee = null;
|
|||
|
int nRow = 0;
|
|||
|
double tempAmount = 0;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
|
|||
|
List<CarFuelParameterIndividual> oTotalParamIndividuals = CarFuelParameterIndividual.Get().Where(x => x.CarFuelItemId == _columnDefinition.SelectedItemOneID).ToList();
|
|||
|
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.FirstOrDefault(x => x.EmployeeNo == dr["Employee No"].ToString());
|
|||
|
|
|||
|
List<CarFuelParameter> oEmpCarFuelParams = CarFuelParameter.GetApplicableParameters(oemployee, oemployee.GradeID, CarFuelParameters);
|
|||
|
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
CarFuelParameterIndividual oEmpParamIndividual = oTotalParamIndividuals.FirstOrDefault(x => x.EmployeeId == oemployee.ID);
|
|||
|
|
|||
|
if (oEmpParamIndividual == null)
|
|||
|
{
|
|||
|
var oEmpCarFuelParameter = oEmpCarFuelParams.FirstOrDefault(x => x.CarFuelItemID == _columnDefinition.SelectedItemOneID);
|
|||
|
|
|||
|
if (oEmpCarFuelParameter != null)
|
|||
|
{
|
|||
|
oEmpParamIndividual = new CarFuelParameterIndividual();
|
|||
|
oEmpParamIndividual.ArrearType = EnumArrearType.NotPresent;
|
|||
|
oEmpParamIndividual.EmployeeId = oemployee.ID;
|
|||
|
oEmpParamIndividual.CarFuelPeriodicity = oEmpCarFuelParameter.CarFuelPeriodicity;
|
|||
|
oEmpParamIndividual.IndividualType = EnumCarFuelIndivdualType.AppliedToIndividual;
|
|||
|
oEmpParamIndividual.CarFuelItemId = _columnDefinition.SelectedItemOneID;
|
|||
|
oEmpParamIndividual.CarFuelParameterID = oEmpCarFuelParameter.ID;
|
|||
|
oEmpParamIndividual.ValueType = EnumValueType.Amount;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + " No CarFuel Setup for this Employee Found"));
|
|||
|
continue;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
oEmpParamIndividual.Value = Convert.ToDouble(dr["Amount"]);
|
|||
|
oEmpParamIndividual.FromDate = GlobalFunctions.FirstDateOfMonth(SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
|
|||
|
if (oEmpParamIndividual.CarFuelPeriodicity == EnumCarFuelPeriodicity.OnceOff)
|
|||
|
{
|
|||
|
oEmpParamIndividual.ToDate = GlobalFunctions.LastDateOfMonth(SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oEmpParamIndividual.ToDate = null;
|
|||
|
}
|
|||
|
|
|||
|
oCarFuelParamIndividuals.Add(oEmpParamIndividual);
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
_CarFuelParameterIndividual = oCarFuelParamIndividuals;
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee CC Information
|
|||
|
public void ImportEmpCC(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
List<Employee> oemployees = Employee.Get();
|
|||
|
Employee oemployee = null;
|
|||
|
|
|||
|
List<Costcenter> oCostcenters = Costcenter.Get();
|
|||
|
Costcenter oCC = null;
|
|||
|
oempCostCenters = new ObjectsTemplate<EmployeeCostCenter>();
|
|||
|
EmployeeCostCenter oempCostCenter = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
oCC = oCostcenters.Find(delegate(Costcenter item) { return item.Code == dr["Costcenter Code"].ToString(); });
|
|||
|
if (oCC != null && Convert.ToDouble(dr["Involve Percent"]) == 100)
|
|||
|
{
|
|||
|
oempCostCenter = new EmployeeCostCenter();
|
|||
|
oempCostCenter.EmployeeID = oemployee.ID;
|
|||
|
oempCostCenter.CostCenterID = oCC.ID;
|
|||
|
oempCostCenter.Percentage = Convert.ToDouble(dr["Involve Percent"]);
|
|||
|
oempCostCenter.IsCurrentCC = true;
|
|||
|
oempCostCenter.MonthDate = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
|
|||
|
oempCostCenters.Add(oempCostCenter);
|
|||
|
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("CostCenter Code", nRow, "Cost center code not found in the existing Cost Centers or involvement percent not equal 100"));
|
|||
|
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region ImportPFOpening
|
|||
|
public void PFOpening(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
List<Employee> oemployees = Employee.Get();
|
|||
|
Employee oemployee = null;
|
|||
|
_PFTransactions = new List<PFTransaction>();
|
|||
|
PFTransaction oPFTransaction = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });
|
|||
|
oPFTransaction = new PFTransaction();
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
oPFTransaction.EmployeeID = oemployee.ID;
|
|||
|
oPFTransaction.MonthDate = GlobalFunctions.LastDateOfMonth(Convert.ToDateTime(dr["Opening Date"].ToString()));
|
|||
|
oPFTransaction.TranAmount = Convert.ToDouble(dr["PFAmount"].ToString());
|
|||
|
oPFTransaction.TranType = EnumPFTranType.PFAmount;
|
|||
|
_PFTransactions.Add(oPFTransaction);
|
|||
|
|
|||
|
oPFTransaction = new PFTransaction();
|
|||
|
oPFTransaction.EmployeeID = oemployee.ID;
|
|||
|
oPFTransaction.MonthDate = GlobalFunctions.LastDateOfMonth(Convert.ToDateTime(dr["Opening Date"].ToString()));
|
|||
|
oPFTransaction.TranAmount = Convert.ToDouble(dr["PFInterest"].ToString());
|
|||
|
oPFTransaction.TranType = EnumPFTranType.OwnInt;
|
|||
|
_PFTransactions.Add(oPFTransaction);
|
|||
|
|
|||
|
oPFTransaction = new PFTransaction();
|
|||
|
oPFTransaction.EmployeeID = oemployee.ID;
|
|||
|
oPFTransaction.MonthDate = GlobalFunctions.LastDateOfMonth(Convert.ToDateTime(dr["Opening Date"].ToString()));
|
|||
|
oPFTransaction.TranAmount = Convert.ToDouble(dr["CPFAmount"].ToString());
|
|||
|
oPFTransaction.TranType = EnumPFTranType.CPFAmount;
|
|||
|
_PFTransactions.Add(oPFTransaction);
|
|||
|
|
|||
|
oPFTransaction = new PFTransaction();
|
|||
|
oPFTransaction.EmployeeID = oemployee.ID;
|
|||
|
oPFTransaction.MonthDate = GlobalFunctions.LastDateOfMonth(Convert.ToDateTime(dr["Opening Date"].ToString()));
|
|||
|
oPFTransaction.TranAmount = Convert.ToDouble(dr["CPFInterest"].ToString());
|
|||
|
oPFTransaction.TranType = EnumPFTranType.CompInt;
|
|||
|
_PFTransactions.Add(oPFTransaction);
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Vendor Code
|
|||
|
public void ImportEmpVendorCode(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
List<Employee> oemployees = Employee.Get();
|
|||
|
Employee oemployee = null;
|
|||
|
_TempEmployees = new ObjectsTemplate<Employee>();
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
oemployee.VendorCode = dr["VendorCode"].ToString();
|
|||
|
_TempEmployees.Add(oemployee);
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import IT Investment Data
|
|||
|
public void ImportITInvestment(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
List<Employee> oemployees = Employee.Get();
|
|||
|
EmployeeTaxInvestment oEmpTaxInvest = null;
|
|||
|
_EmployeeTaxInvestments = new ObjectsTemplate<EmployeeTaxInvestment>();
|
|||
|
Employee oemployee = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
oEmpTaxInvest = new EmployeeTaxInvestment();
|
|||
|
oEmpTaxInvest.EmployeeID = oemployee.ID;
|
|||
|
oEmpTaxInvest.TypeID = _columnDefinition.SelectedItemOneID;
|
|||
|
oEmpTaxInvest.TaxparameterId = SystemInformation.CurrentSysInfo.TaxParamID;
|
|||
|
oEmpTaxInvest.Amount = Convert.ToDouble(dr["Amount"]);
|
|||
|
_EmployeeTaxInvestments.Add(oEmpTaxInvest);
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import IT Challan Data
|
|||
|
public void ImportITChallan(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
List<Employee> oemployees = Employee.GetAllEmps();
|
|||
|
TaxChallan oTaxChallan = null;
|
|||
|
_TaxChallans = new ObjectsTemplate<TaxChallan>();
|
|||
|
Employee oemployee = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
oTaxChallan = new TaxChallan();
|
|||
|
oTaxChallan.EmployeeID = oemployee.ID;
|
|||
|
oTaxChallan.SalaryMonthly = Convert.ToDateTime(dr["Month"]);
|
|||
|
oTaxChallan.DepositDate = Convert.ToDateTime(dr["Month"]);
|
|||
|
oTaxChallan.TaxParameterID = _columnDefinition.SelectedItemOneID;
|
|||
|
oTaxChallan.Amount = Convert.ToDouble(dr["Amount"]);
|
|||
|
oTaxChallan.ChallanNo = Convert.ToString(dr["ChallanNo"]);
|
|||
|
_TaxChallans.Add(oTaxChallan);
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Organogram Position Data
|
|||
|
public void ImportOrganogramPosition(DataUploadColumnDefinition _columnDefinition)
|
|||
|
{
|
|||
|
List<Employee> oemployees = Employee.GetAllEmps();
|
|||
|
_organograms = OrganogramBasic.Get(EnumStatus.Active);
|
|||
|
Employee oemployee = null;
|
|||
|
OrganogramBasic oOrganogram = null;
|
|||
|
OrganogramEmployee oOrgEmp = null;
|
|||
|
OrganogramEmployee oOrgOldEmp = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in _uplodedData.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["EmployeeNo"].ToString(); });
|
|||
|
if (oemployee != null)
|
|||
|
{
|
|||
|
oOrganogram = _organograms.Find(delegate(OrganogramBasic org) { return org.PositionNo == dr["PositionNo"].ToString(); });
|
|||
|
if (oOrganogram != null)
|
|||
|
{
|
|||
|
oOrgOldEmp = oOrganogram.OrganEmployees.Find(delegate(OrganogramEmployee ogEmp) { return ogEmp.EmployeeID.Integer == oemployee.ID.Integer && ogEmp.NodeID.Integer == oOrganogram.ID.Integer; });
|
|||
|
if (oOrgOldEmp == null)
|
|||
|
{
|
|||
|
oOrgEmp = new OrganogramEmployee();
|
|||
|
oOrgEmp.EmployeeID = oemployee.ID;
|
|||
|
oOrgEmp.NodeID = oOrganogram.ID;
|
|||
|
oOrgEmp.AssignDate = DateTime.Today;
|
|||
|
_organEmps.Add(oOrgEmp);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oOrgOldEmp.EmployeeID = oemployee.ID;
|
|||
|
oOrgOldEmp.AssignDate = DateTime.Today;
|
|||
|
_organEmps.Add(oOrgOldEmp);
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Position No.", nRow, "(" + dr["PositionNo"].ToString() + ")" + "Position not found for in the existing data"));
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["EmployeeNo"].ToString() + ")" + "Employee not found for in the existing data"));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Emport Employee HR Data
|
|||
|
|
|||
|
#region Import Employee General Information
|
|||
|
public HREmployee ImportEmpGeneralInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
if (_errorOrSuccessList == null)
|
|||
|
_errorOrSuccessList = new List<UploadErrorOrSuccess>();
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["First Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
_HREmployee.GlobalID = oDr["GDDB ID"].ToString();
|
|||
|
_HREmployee.BirthPlace = oDr["Place Of Birth"].ToString();
|
|||
|
//_HREmployee.NickName = oDr["Nick Name"].ToString();
|
|||
|
_HREmployee.FirstName = oDr["First Name"].ToString();
|
|||
|
_HREmployee.MiddleName = oDr["Middle Name"].ToString();
|
|||
|
_HREmployee.LastName = oDr["Last Name"].ToString();
|
|||
|
_HREmployee.Gender = (oDr["Gender"].ToString().Trim().ToUpper().Trim() == "Male".ToUpper().Trim()) ? EnumGender.Male : EnumGender.Female;
|
|||
|
switch (oDr["Marital Status"].ToString())
|
|||
|
{
|
|||
|
case "Married":
|
|||
|
_HREmployee.MaritalStatus = EnumMaritalStatus.Married;
|
|||
|
break;
|
|||
|
case "UnMarried":
|
|||
|
_HREmployee.MaritalStatus = EnumMaritalStatus.UnMarried;
|
|||
|
break;
|
|||
|
case "Divorced":
|
|||
|
_HREmployee.MaritalStatus = EnumMaritalStatus.Divorced;
|
|||
|
break;
|
|||
|
case "Widow":
|
|||
|
_HREmployee.MaritalStatus = EnumMaritalStatus.Widow;
|
|||
|
break;
|
|||
|
default:
|
|||
|
_HREmployee.MaritalStatus = EnumMaritalStatus.None;
|
|||
|
break;
|
|||
|
}
|
|||
|
Religion oReligion = _Religions.Find(delegate(Religion oItem) { return oItem.Name.ToUpper().Trim() == oDr["Religion"].ToString().ToUpper().Trim(); });
|
|||
|
if (oReligion != null)
|
|||
|
_HREmployee.ReligionID = oReligion.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Religion", nRow, "Religion is not valid for employee from " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
|
|||
|
if (oDr["Blood Group"].ToString().ToUpper() == "B+".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.BPos;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "B-".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.BNeg;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "A+".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.APos;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "A-".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.ANeg;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "O+".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.OPos;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "O-".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.ONeg;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "AB+".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.ABPos;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "AB-".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.ABNeg;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
_HREmployee.PassportNo = oDr["Passport No"].ToString();
|
|||
|
_HREmployee.TinNo = oDr["Tax Identification No"].ToString();
|
|||
|
|
|||
|
Nationality oNationality = _Nationalites.Find(delegate(Nationality oItem) { return oItem.Description.ToUpper().Trim() == oDr["Nationality"].ToString().ToUpper().Trim(); });
|
|||
|
if (oNationality != null)
|
|||
|
_HREmployee.NationalityID = oNationality.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Nationality", nRow, "Nationality is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
_HREmployee.NationalID = oDr["National ID"].ToString();
|
|||
|
|
|||
|
DateTime dTemFDate;
|
|||
|
if (DateTime.TryParse(oDr["Joining Date"].ToString(), out dTemFDate))
|
|||
|
_HREmployee.JoiningDate = dTemFDate;//Convert.ToDateTime(oDr["Employed From Date"].ToString());
|
|||
|
else
|
|||
|
_HREmployee.JoiningDate = DateTime.MinValue;
|
|||
|
|
|||
|
//_HREmployee.JoiningDate = Convert.ToDateTime(oDr["Joining Date"]);
|
|||
|
DateTime dTemBDate;
|
|||
|
if (DateTime.TryParse(oDr["Date of Birth"].ToString(), out dTemBDate))
|
|||
|
_HREmployee.BirthDate = dTemBDate;//Convert.ToDateTime(oDr["Date of Birth"]);
|
|||
|
else
|
|||
|
//_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Joining Date", nRow, "Please enter employee joining date " + oDTable.TableName + " Information."));
|
|||
|
_HREmployee.BirthDate = DateTime.MinValue;
|
|||
|
|
|||
|
|
|||
|
Category oCategory = _Categories.Find(delegate(Category oItem) { return oItem.Name.ToUpper().Trim() == oDr["Category"].ToString().ToUpper().Trim(); });
|
|||
|
if (oCategory != null)
|
|||
|
_HREmployee.CategoryID = oCategory.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Category", nRow, "Category is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
_HREmployee.FatherName = oDr["Father's Name"].ToString();
|
|||
|
_HREmployee.MotherName = oDr["Mother's Name"].ToString();
|
|||
|
Occupation oFOccupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Father's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oFOccupation != null)
|
|||
|
_HREmployee.FatherOccupationID = oFOccupation.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Occupation", nRow, "Father occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
Occupation oMOccupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Mother's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oMOccupation != null)
|
|||
|
_HREmployee.MotherOccupationID = oMOccupation.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Occupation", nRow, "Mother occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _HREmployee;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Contact Information
|
|||
|
public ObjectsTemplate<EmpContact> ImportEmpContactInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
int nRow = 0;
|
|||
|
EmpContact oEmpContact = null;
|
|||
|
ObjectsTemplate<Thana> oParmanentsThanas = null;
|
|||
|
ObjectsTemplate<Thana> oPresentThanas = null;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Permanent Address"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpContact = new EmpContact();
|
|||
|
oEmpContact.ParmanentAddress = oDr["Permanent Address"].ToString();
|
|||
|
District oDisPar = _Districts.Find(delegate(District oItem) { return oItem.Name.ToUpper() == oDr["Permanent District"].ToString().ToUpper(); });
|
|||
|
oParmanentsThanas = Thana.GetByDistID(oDisPar.ID);
|
|||
|
if (oDisPar != null)
|
|||
|
oEmpContact.ParmanentDistrictID = oDisPar.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("District", nRow, "Permanent District is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
Thana oThanaPar = oParmanentsThanas.Find(delegate(Thana oItem) { return oItem.Name.ToUpper().Trim() == oDr["Permanent Thana"].ToString().ToUpper().Trim(); });
|
|||
|
if (oThanaPar != null)
|
|||
|
oEmpContact.ParmanentThanaID = oThanaPar.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Thana", nRow, "Permanent Thana is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpContact.ParmanentTelephone = oDr["Permanent Telephone No"].ToString();
|
|||
|
oEmpContact.ParmanentMobile = oDr["PerMobile No"].ToString();
|
|||
|
|
|||
|
oEmpContact.PresentAddress = oDr["Present Address"].ToString();
|
|||
|
|
|||
|
District oPerDis = _Districts.Find(delegate(District oItem) { return oItem.Name.ToUpper().Trim() == oDr["Present District"].ToString().ToUpper().Trim(); });
|
|||
|
oPresentThanas = Thana.GetByDistID(oPerDis.ID);
|
|||
|
if (oPerDis != null)
|
|||
|
oEmpContact.PresentDistrictID = oPerDis.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("District", nRow, "Present District is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
Thana oThanaPre = oPresentThanas.Find(delegate(Thana oItem) { return oItem.Name.ToUpper().Trim() == oDr["Present Thana"].ToString().ToUpper().Trim(); });
|
|||
|
if (oThanaPre != null)
|
|||
|
oEmpContact.PresentThanaID = oThanaPre.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Thana", nRow, "Present Thana is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpContact.PresentTelephone = oDr["Present Telephone No"].ToString();
|
|||
|
oEmpContact.PresentMobile = oDr["PreMobile No"].ToString();
|
|||
|
|
|||
|
oEmpContact.PersonalTelephone = oDr["Personal Land Phone No"].ToString();
|
|||
|
oEmpContact.Mobile = oDr["Personal Mobile No"].ToString();
|
|||
|
oEmpContact.PersonalEMail = oDr["Personal E-Mail"].ToString();
|
|||
|
oEmpContact.OfficalEMail = oDr["Official E-Mail"].ToString();
|
|||
|
oEmpContact.Fax = oDr["Fax"].ToString();
|
|||
|
|
|||
|
oEmpContact.EmergencyContactAddress = oDr["Emergency Contact Address"].ToString();
|
|||
|
oEmpContact.EmergencyContactPerson = oDr["Emergency Contact Person"].ToString();
|
|||
|
oEmpContact.EmergencyTelephone = oDr["Emergency Telephone No"].ToString();
|
|||
|
oEmpContact.EmergencyMobile = oDr["EmeMobile No"].ToString();
|
|||
|
|
|||
|
Relation oRel = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Relation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRel != null)
|
|||
|
oEmpContact.ContactPersonRelationId = oRel.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Relation", nRow, "Emergency Relation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
_HREmployee.Contacts.Add(oEmpContact);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _HREmployee.Contacts;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Spouse Information
|
|||
|
public ObjectsTemplate<EmpSpouse> ImportEmpSpouseInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpSpouse oEmpSpouse = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Spouse Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpSpouse = new EmpSpouse();
|
|||
|
oEmpSpouse.Name = oDr["Spouse Name"].ToString();
|
|||
|
if (oDr["Spouse Level of Education"].ToString() != string.Empty)
|
|||
|
{
|
|||
|
EducationLevel oEdLevel = _EducationLevels.Find(delegate(EducationLevel oItem) { return oItem.Description.ToUpper().Trim() == oDr["Spouse Level of Education"].ToString().ToUpper().Trim(); });
|
|||
|
if (oEdLevel != null)
|
|||
|
oEmpSpouse.EducationLevelID = oEdLevel.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Spouse Level of Education", nRow, "Spouse level of education is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oEmpSpouse.EducationLevelID = null;
|
|||
|
}
|
|||
|
|
|||
|
Occupation oOccup = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Spouse Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oOccup != null)
|
|||
|
oEmpSpouse.OccupationID = oOccup.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Spouse Occupation", nRow, "Spouse Occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
DateTime dTemBDate;
|
|||
|
if (DateTime.TryParse(oDr["Date of Birth"].ToString(), out dTemBDate))
|
|||
|
oEmpSpouse.MarriageDate = dTemBDate;//Convert.ToDateTime(oDr["Date of Birth"].ToString());
|
|||
|
else
|
|||
|
oEmpSpouse.MarriageDate = DateTime.MinValue;
|
|||
|
|
|||
|
_HREmployee.Spouses.Add(oEmpSpouse);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _HREmployee.Spouses;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Child Information
|
|||
|
public ObjectsTemplate<EmpChildren> ImportEmpChildInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpChildren oEmpChildren = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Child's Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpChildren = new EmpChildren();
|
|||
|
oEmpChildren.Name = oDr["Child's Name"].ToString();
|
|||
|
oEmpChildren.Gender = (oDr["Child's Gender"].ToString().Trim() == "Male") ? EnumGender.Male : EnumGender.Female;
|
|||
|
|
|||
|
DateTime dTemCBdate;
|
|||
|
if (DateTime.TryParse(oDr["Child's Date of Birth"].ToString(), out dTemCBdate))
|
|||
|
oEmpChildren.BirthDate = dTemCBdate;//Convert.ToDateTime(oDr["Child's Date of Birth"].ToString());
|
|||
|
else
|
|||
|
oEmpChildren.BirthDate = DateTime.MinValue;
|
|||
|
|
|||
|
Occupation oCCP = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Child's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oCCP != null)
|
|||
|
oEmpChildren.OccupationID = oCCP.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Child's Occupation", nRow, "Child's Occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
switch (oDr["Child's Marital Status"].ToString().Trim())
|
|||
|
{
|
|||
|
case "Married":
|
|||
|
oEmpChildren.MaritalStatus = EnumMaritalStatus.Married;
|
|||
|
break;
|
|||
|
case "UnMarried":
|
|||
|
oEmpChildren.MaritalStatus = EnumMaritalStatus.UnMarried;
|
|||
|
break;
|
|||
|
case "Divorced":
|
|||
|
oEmpChildren.MaritalStatus = EnumMaritalStatus.Divorced;
|
|||
|
break;
|
|||
|
case "Widow":
|
|||
|
oEmpChildren.MaritalStatus = EnumMaritalStatus.Widow;
|
|||
|
break;
|
|||
|
default:
|
|||
|
break;
|
|||
|
|
|||
|
}
|
|||
|
//oEmpChildren.MaritalStatus = (oDr["Child's Marital Status"].ToString() == "Married") ? EnumMaritalStatus.Married : EnumMaritalStatus.UnMarried;
|
|||
|
_HREmployee.Childrens.Add(oEmpChildren);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _HREmployee.Childrens;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Experience Information
|
|||
|
public ObjectsTemplate<EmpExperience> ImportEmpExperienceInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpExperience oEmpExperience = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Employer"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpExperience = new EmpExperience();
|
|||
|
oEmpExperience.Employer = oDr["Employer"].ToString();
|
|||
|
oEmpExperience.ContactPerson = oDr["Contact Person"].ToString() != string.Empty ? oDr["Contact Person"].ToString() : "";
|
|||
|
oEmpExperience.Address = oDr["Address"].ToString();
|
|||
|
oEmpExperience.Telephone = oDr["Telephone No"].ToString() != string.Empty ? oDr["Telephone No"].ToString() : "";
|
|||
|
oEmpExperience.EmployerActivity = oDr["Industry/ Business Type"].ToString();
|
|||
|
oEmpExperience.Designation = oDr["Designation"].ToString();
|
|||
|
oEmpExperience.JobDescription = oDr["Role Description"].ToString() != string.Empty ? oDr["Role Description"].ToString() : "";
|
|||
|
|
|||
|
DateTime dTemFDate;
|
|||
|
if (DateTime.TryParse(oDr["Employed From Date"].ToString(), out dTemFDate))
|
|||
|
oEmpExperience.FromDate = dTemFDate;//Convert.ToDateTime(oDr["Employed From Date"].ToString());
|
|||
|
else
|
|||
|
oEmpExperience.FromDate = DateTime.MinValue;
|
|||
|
|
|||
|
DateTime dTempDate;
|
|||
|
if (DateTime.TryParse(oDr["Employed To Date"].ToString(), out dTempDate))
|
|||
|
oEmpExperience.ToDate = dTempDate;
|
|||
|
else
|
|||
|
oEmpExperience.ToDate = DateTime.MinValue;
|
|||
|
_HREmployee.Experiences.Add(oEmpExperience);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _HREmployee.Experiences;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Training Information
|
|||
|
public ObjectsTemplate<EmpTraining> ImportEmpTrainingInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpTraining oEmpTraining = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Training Title"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpTraining = new EmpTraining();
|
|||
|
oEmpTraining.Name = oDr["Training Title"].ToString();
|
|||
|
TrainingType oTType = _TrainingTypes.Find(delegate(TrainingType oItem) { return oItem.Name.ToUpper().Trim() == oDr["Training Type"].ToString().ToUpper().Trim(); });
|
|||
|
if (oTType != null)
|
|||
|
oEmpTraining.TrainingTypeID = oTType.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Training Type", nRow, "Training Type is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
NatureOfTraining oNOFTraning = _NatureOfTrainings.Find(delegate(NatureOfTraining oItem) { return oItem.Name.ToUpper().Trim() == oDr["Nature of Training"].ToString().ToUpper().Trim(); });
|
|||
|
if (oNOFTraning != null)
|
|||
|
oEmpTraining.NatureOfTrainingID = oNOFTraning.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Nature of Training", nRow, "Nature of Training is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpTraining.Description = oDr["Description"].ToString();
|
|||
|
Institution oIns = _Institutions.Find(delegate(Institution oItem) { return oItem.Name.ToUpper().Trim() == oDr["Institution"].ToString().ToUpper().Trim(); });
|
|||
|
if (oIns != null)
|
|||
|
oEmpTraining.InstitutionID = oIns.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Institution", nRow, "Institution is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpTraining.Place = oDr["Training Place"].ToString();
|
|||
|
Country oCountry = _Contries.Find(delegate(Country oItem) { return oItem.Name.ToUpper().Trim() == oDr["Country"].ToString().ToUpper().Trim(); });
|
|||
|
if (oCountry != null)
|
|||
|
oEmpTraining.CountryID = oCountry.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Country", nRow, "Country is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpTraining.Achievement = oDr["Achievement"].ToString() != string.Empty ? oDr["Achievement"].ToString() : "";
|
|||
|
oEmpTraining.TrainingCompletedFrom = (oDr["Sponsor Type"].ToString().ToUpper().Trim() == "Own".ToUpper().Trim()) ? EnumTrainingCompletedFrom.Own : EnumTrainingCompletedFrom.Company;
|
|||
|
if (oDr["Training Fees"].ToString().Trim() != string.Empty)
|
|||
|
oEmpTraining.Fees = Convert.ToDouble(oDr["Training Fees"]);
|
|||
|
else
|
|||
|
oEmpTraining.Fees = 0.0;
|
|||
|
|
|||
|
if (oDr["Other Cost"].ToString().Trim() != string.Empty)
|
|||
|
oEmpTraining.OtherCost = Convert.ToDouble(oDr["Other Cost"]);
|
|||
|
else
|
|||
|
oEmpTraining.OtherCost = 0.0;
|
|||
|
|
|||
|
DateTime dTempFdate;
|
|||
|
if (DateTime.TryParse(oDr["From Date"].ToString(), out dTempFdate))
|
|||
|
oEmpTraining.FromDate = dTempFdate;//Convert.ToDateTime(oDr["From Date"]);
|
|||
|
else
|
|||
|
oEmpTraining.FromDate = DateTime.MinValue;
|
|||
|
|
|||
|
DateTime oTEmpDate;
|
|||
|
if (DateTime.TryParse(oDr["To Date"].ToString(), out oTEmpDate))
|
|||
|
oEmpTraining.ToDate = oTEmpDate;
|
|||
|
else
|
|||
|
oEmpTraining.ToDate = DateTime.MinValue;
|
|||
|
|
|||
|
_HREmployee.Trainings.Add(oEmpTraining);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _HREmployee.Trainings;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Academic Information
|
|||
|
public ObjectsTemplate<EmpAcademic> ImportEmpAcademicInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpAcademic oEmpAcademic = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Education Type"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpAcademic = new EmpAcademic();
|
|||
|
EducationType oEDType = _EducationTypes.Find(delegate(EducationType oItem) { return oItem.Description.ToUpper().Trim() == oDr["Education Type"].ToString().ToUpper().Trim(); });
|
|||
|
if (oEDType != null)
|
|||
|
oEmpAcademic.EducationTypeID = oEDType.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Education Type", nRow, "Education Type is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
|
|||
|
EducationLevel oEducLevel = _EducationLevels.Find(delegate(EducationLevel oItem) { return oItem.Description.ToUpper().Trim() == oDr["Degree Title"].ToString().ToUpper().Trim(); });
|
|||
|
if (oEducLevel != null)
|
|||
|
oEmpAcademic.EducationLevelID = oEducLevel.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Degree Title", nRow, "Degree Title is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
|
|||
|
Discipline oDis = _Disciplines.Find(delegate(Discipline oItem) { return oItem.Description.ToUpper().Trim() == oDr["Discipline/ Department"].ToString().ToUpper().Trim(); });
|
|||
|
if (oDis != null)
|
|||
|
oEmpAcademic.DisciplineID = oDis.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Discipline/ Department", nRow, "Discipline/ Department is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
|
|||
|
Institution oIns = _Institutions.Find(delegate(Institution oItem) { return oItem.Name.ToUpper().Trim() == oDr["Institution (Board/University)"].ToString().ToUpper().Trim(); });
|
|||
|
if (oIns != null)
|
|||
|
oEmpAcademic.InstitutionID = oIns.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Institution (Board/University)", nRow, "Institution (Board/University) is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpAcademic.InstituteName = oDr["Institution Name"].ToString();
|
|||
|
DateTime dExamdate = Convert.ToDateTime(oDr["Exam Held on"]);
|
|||
|
oEmpAcademic.ExamDate = dExamdate.Year;
|
|||
|
DateTime dPassingYear = Convert.ToDateTime(oDr["Passing Year"]);
|
|||
|
oEmpAcademic.PassingYear = dPassingYear.Year;
|
|||
|
|
|||
|
ResultType oRType = _ResultTypes.Find(delegate(ResultType oItem) { return oItem.Description.ToUpper().Trim() == oDr["Result"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRType != null)
|
|||
|
oEmpAcademic.ResultTypeID = oRType.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Result", nRow, "Result is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
if (oDr["CGPA/ Marks"].ToString() != string.Empty || oDr["CGPA/ Marks"].ToString().Length > 0)
|
|||
|
oEmpAcademic.GPAOrMarks = Convert.ToDouble(oDr["CGPA/ Marks"]);
|
|||
|
oEmpAcademic.LastLevel = (oDr["Highest Education"].ToString().ToUpper().Trim() == "Yes".ToUpper().Trim()) ? true : false;
|
|||
|
|
|||
|
_HREmployee.Academics.Add(oEmpAcademic);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _HREmployee.Academics;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Reference Information
|
|||
|
public ObjectsTemplate<EmpReference> ImportEmpReferenceInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpReference oEmpReference = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Referee's Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpReference = new EmpReference();
|
|||
|
oEmpReference.Name = oDr["Referee's Name"].ToString();
|
|||
|
Occupation oCcupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Referee's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oCcupation != null)
|
|||
|
{
|
|||
|
oEmpReference.OccupationID = oCcupation.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Referee's Occupation", nRow, "Referee's Occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
|
|||
|
Relation oRelation = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Relation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRelation != null)
|
|||
|
{
|
|||
|
oEmpReference.RelationID = oRelation.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Relation", nRow, "Relation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
oEmpReference.Address = oDr["Address"].ToString();
|
|||
|
oEmpReference.EmailAddress = oDr["E-mail Address"].ToString() != string.Empty ? oDr["E-mail Address"].ToString() : "";
|
|||
|
oEmpReference.Telephone = oDr["Telephone No(s)"].ToString() != string.Empty ? oDr["Telephone No(s)"].ToString() : "";
|
|||
|
oEmpReference.ReferenceMobile = oDr["Mobile No(s)"].ToString() != string.Empty ? oDr["Mobile No(s)"].ToString() : "";
|
|||
|
_HREmployee.References.Add(oEmpReference);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _HREmployee.References;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Publication Information
|
|||
|
public ObjectsTemplate<EmpPublication> ImportEmpPublicationInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpPublication oEmpPublication = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Publication Title"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpPublication = new EmpPublication();
|
|||
|
oEmpPublication.Title = oDr["Publication Title"].ToString();
|
|||
|
oEmpPublication.PublicationType = oDr["Publication Type"].ToString();
|
|||
|
oEmpPublication.PublishersName = oDr["Publication Name"].ToString() != string.Empty ? oDr["Publication Name"].ToString() : "";
|
|||
|
oEmpPublication.Description = oDr["Description"].ToString() != string.Empty ? oDr["Description"].ToString() : "";
|
|||
|
oEmpPublication.Remarks = oDr["Remarks"].ToString() != string.Empty ? oDr["Remarks"].ToString() : "";
|
|||
|
DateTime dTempDate;
|
|||
|
|
|||
|
if (DateTime.TryParse(oDr["Date of Publication"].ToString(), out dTempDate))
|
|||
|
oEmpPublication.PublicationDate = dTempDate;//Convert.ToDateTime(oDr["Date of Publication"].ToString());
|
|||
|
else
|
|||
|
oEmpPublication.PublicationDate = DateTime.MinValue;
|
|||
|
|
|||
|
_HREmployee.Publications.Add(oEmpPublication);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _HREmployee.Publications;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Nominee Information
|
|||
|
public ObjectsTemplate<EmpNominee> ImportEmpNomineeInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpNominee oEmpNominee = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Nomination Purpose"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpNominee = new EmpNominee();
|
|||
|
NominationPurpose oNominationPurpose = _NominationPurposes.Find(delegate(NominationPurpose oItem) { return oItem.Description.ToUpper().Trim() == oDr["Nomination Purpose"].ToString().ToUpper().Trim(); });
|
|||
|
|
|||
|
if (oNominationPurpose != null)
|
|||
|
{
|
|||
|
oEmpNominee.NominationPurposeID = oNominationPurpose.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Nomination Purpose", nRow, "Nomination Purpose is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
DateTime dTemDate;
|
|||
|
if (DateTime.TryParse(Convert.ToString(oDr["Date Of Nomination"]), out dTemDate))
|
|||
|
oEmpNominee.NominationDate = dTemDate;
|
|||
|
else
|
|||
|
oEmpNominee.NominationDate = DateTime.MinValue;
|
|||
|
|
|||
|
oEmpNominee.Name = oDr["Nominee's Name"].ToString();
|
|||
|
Relation oRelation = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Relation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRelation != null)
|
|||
|
{
|
|||
|
oEmpNominee.RelationID = oRelation.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Relation", nRow, "Relation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
oEmpNominee.Percentage = Convert.ToDouble(oDr["Percentage"].ToString()) > 0 ? Convert.ToDouble(oDr["Percentage"].ToString()) : 0.0;
|
|||
|
DateTime dtempDate;
|
|||
|
if (DateTime.TryParse(Convert.ToString(oDr["Nominee's Date of Birth"]), out dtempDate))
|
|||
|
oEmpNominee.BirthDate = dtempDate;//Convert.ToDateTime(oDr["Nominee's Date of Birth"]);
|
|||
|
else
|
|||
|
oEmpNominee.BirthDate = DateTime.MinValue;
|
|||
|
|
|||
|
Occupation oOCCupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Nominee's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oOCCupation != null)
|
|||
|
{
|
|||
|
oEmpNominee.OccupationID = oOCCupation.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Nominee's Occupation", nRow, "Nominee's Occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
|
|||
|
oEmpNominee.Address = oDr["Address"].ToString();
|
|||
|
oEmpNominee.TelePhone = oDr["Telephone No(s)"].ToString() != string.Empty ? oDr["Telephone No(s)"].ToString() : "";
|
|||
|
oEmpNominee.EmailAddress = oDr["E-mail Address"].ToString() != string.Empty ? oDr["E-mail Address"].ToString() : "";
|
|||
|
_HREmployee.Nominees.Add(oEmpNominee);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _HREmployee.Nominees;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Hospitalization Information
|
|||
|
public ObjectsTemplate<EmpHospitalization> ImportEmpHospitalizationInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpHospitalization oEmpHospitalization = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Registered Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpHospitalization = new EmpHospitalization();
|
|||
|
oEmpHospitalization.RegistrationDate = Convert.ToDateTime(oDr["Date Of Registration"].ToString());
|
|||
|
oEmpHospitalization.RegisteredPerson = oDr["Registered Name"].ToString();
|
|||
|
Relation oRelation = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Relation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRelation != null)
|
|||
|
{
|
|||
|
oEmpHospitalization.RelationId = oRelation.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Relation", nRow, "Relation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
DateTime dTEmpDate;
|
|||
|
if (DateTime.TryParse(oDr["Registered Person's Date of Birth"].ToString(), out dTEmpDate))
|
|||
|
oEmpHospitalization.BirthDate = dTEmpDate;//Convert.ToDateTime(oDr["Registered Person's Date of Birth"]);
|
|||
|
else
|
|||
|
oEmpHospitalization.BirthDate = DateTime.MinValue;
|
|||
|
|
|||
|
Occupation oOCCupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Registered Person's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oOCCupation != null)
|
|||
|
{
|
|||
|
oEmpHospitalization.OccupationID = oOCCupation.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Registered Person's Occupation", nRow, "Registered Person's Occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
oEmpHospitalization.Email = oDr["Email"].ToString() != string.Empty ? oDr["Email"].ToString() : "";
|
|||
|
oEmpHospitalization.Address = oDr["Address"].ToString();
|
|||
|
oEmpHospitalization.Telephone = oDr["Telephone No(s)"].ToString() != string.Empty ? oDr["Telephone No(s)"].ToString() : "";
|
|||
|
oEmpHospitalization.Mobile = oDr["Mobile No (s)"].ToString() != string.Empty ? oDr["Mobile No (s)"].ToString() : "";
|
|||
|
_HREmployee.Hospitalizations.Add(oEmpHospitalization);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _HREmployee.Hospitalizations;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Guarantor Information
|
|||
|
public ObjectsTemplate<EmpGuarantor> ImportEmpGuarantorInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpGuarantor oEmpGuarantor = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpGuarantor = new EmpGuarantor();
|
|||
|
oEmpGuarantor.Name = oDr["Name"].ToString();
|
|||
|
|
|||
|
Occupation oOCCupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oOCCupation != null)
|
|||
|
{
|
|||
|
oEmpGuarantor.OccupationID = oOCCupation.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Occupation", nRow, "Occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
oEmpGuarantor.Address = oDr["Address"].ToString();
|
|||
|
oEmpGuarantor.EmailAddress = oDr["Email"].ToString() != string.Empty ? oDr["Email"].ToString() : "";
|
|||
|
oEmpGuarantor.Telephone = oDr["Telephone No(s)"].ToString() != string.Empty ? oDr["Telephone No(s)"].ToString() : "";
|
|||
|
oEmpGuarantor.GuarantorMobile = oDr["Mobile No(s)"].ToString() != string.Empty ? oDr["Mobile No(s)"].ToString() : "";
|
|||
|
GuarantorDocumentType oGDType = _GuarantorDocumentTypes.Find(delegate(GuarantorDocumentType oItem) { return oItem.Description.ToUpper().Trim() == oDr["Document Category"].ToString().ToUpper().Trim(); });
|
|||
|
if (oGDType != null)
|
|||
|
{
|
|||
|
oEmpGuarantor.CategotyDocId = oGDType.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Document Category", nRow, "Document Category is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
oEmpGuarantor.DocumentPath = oDr["Document Path"].ToString() != string.Empty ? oDr["Document Path"].ToString() : "";
|
|||
|
_HREmployee.Guarantors.Add(oEmpGuarantor);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _HREmployee.Guarantors;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Language Information
|
|||
|
public ObjectsTemplate<EmpLanguage> ImportEmpLanguageInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpLanguage oEmpLanguage = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["LanguageName"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpLanguage = new EmpLanguage();
|
|||
|
oEmpLanguage.LanguageName = oDr["LanguageName"].ToString();
|
|||
|
if (oDr["SpokenStatus"].ToString().ToUpper().Trim() == "Basic".ToUpper().Trim())
|
|||
|
{
|
|||
|
oEmpLanguage.SpokenStatus = EnumLanguageEfficiency.Basic;
|
|||
|
}
|
|||
|
else if (oDr["SpokenStatus"].ToString().ToUpper().Trim() == "Intermideate".ToUpper().Trim())
|
|||
|
{
|
|||
|
oEmpLanguage.SpokenStatus = EnumLanguageEfficiency.Intermideate;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oEmpLanguage.SpokenStatus = EnumLanguageEfficiency.Advanced;
|
|||
|
}
|
|||
|
|
|||
|
if (oDr["WrittenStatus"].ToString().ToUpper().Trim() == "Basic".ToUpper().Trim())
|
|||
|
{
|
|||
|
oEmpLanguage.WrittenStatus = EnumLanguageEfficiency.Basic;
|
|||
|
}
|
|||
|
else if (oDr["WrittenStatus"].ToString().ToUpper().Trim() == "Intermideate".ToUpper().Trim())
|
|||
|
{
|
|||
|
oEmpLanguage.WrittenStatus = EnumLanguageEfficiency.Intermideate;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oEmpLanguage.WrittenStatus = EnumLanguageEfficiency.Advanced;
|
|||
|
}
|
|||
|
_HREmployee.EmpLanguages.Add(oEmpLanguage);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _HREmployee.EmpLanguages;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Relative Information
|
|||
|
public ObjectsTemplate<EmpRelative> ImportEmpRelativeInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpRelative oEmpRelative = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpRelative = new EmpRelative();
|
|||
|
oEmpRelative.Name = oDr["Name"].ToString();
|
|||
|
oEmpRelative.Designation = oDr["Designation"].ToString();
|
|||
|
oEmpRelative.EmpNo = oDr["EmpID"].ToString();
|
|||
|
Relation oRelation = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Relation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRelation != null)
|
|||
|
oEmpRelative.RelationID = oRelation.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Relation", nRow, "Relation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
DateTime dTempJDate;
|
|||
|
if (DateTime.TryParse(oDr["JoiningDate"].ToString(), out dTempJDate))
|
|||
|
oEmpRelative.JoiningDate = dTempJDate;//Convert.ToDateTime(oDr["JoiningDate"]);
|
|||
|
else
|
|||
|
oEmpRelative.JoiningDate = DateTime.MinValue;
|
|||
|
|
|||
|
DateTime dTempDate;
|
|||
|
if (DateTime.TryParse(oDr["EndDate"].ToString(), out dTempDate))
|
|||
|
oEmpRelative.EndDate = dTempDate;//Convert.ToDateTime(oDr["EndDate"]);
|
|||
|
else
|
|||
|
oEmpRelative.EndDate = DateTime.MinValue;
|
|||
|
|
|||
|
_HREmployee.EmpRelatives.Add(oEmpRelative);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _HREmployee.EmpRelatives;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee MemberShip Information
|
|||
|
public ObjectsTemplate<EmpMembership> ImportEmpMembershipInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpMembership oEmpMembership = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Organization"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpMembership = new EmpMembership();
|
|||
|
oEmpMembership.Organization = oDr["Organization"].ToString();
|
|||
|
oEmpMembership.Activity = oDr["YourRole"].ToString();
|
|||
|
|
|||
|
switch (oDr["OrganizationType"].ToString().Trim())
|
|||
|
{
|
|||
|
case "Academic":
|
|||
|
oEmpMembership.OrganizationType = EnumOrganizationType.Academic;
|
|||
|
break;
|
|||
|
case "Charitable":
|
|||
|
oEmpMembership.OrganizationType = EnumOrganizationType.Charitable;
|
|||
|
break;
|
|||
|
case "Professional":
|
|||
|
oEmpMembership.OrganizationType = EnumOrganizationType.Professional;
|
|||
|
break;
|
|||
|
case "Social":
|
|||
|
oEmpMembership.OrganizationType = EnumOrganizationType.Social;
|
|||
|
break;
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
oEmpMembership.FromDate = Convert.ToDateTime(oDr["FromDate"]);
|
|||
|
DateTime dTemDate;
|
|||
|
if (DateTime.TryParse(oDr["EndDate"].ToString(), out dTemDate))
|
|||
|
oEmpMembership.EndDate = dTemDate;//Convert.ToDateTime(oDr["EndDate"]);
|
|||
|
else
|
|||
|
oEmpMembership.EndDate = DateTime.MinValue;
|
|||
|
|
|||
|
_HREmployee.EmpMemberships.Add(oEmpMembership);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _HREmployee.EmpMemberships;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Relation Information
|
|||
|
public ObjectsTemplate<EmpRelation> ImportEmpRelationInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpRelation oEmpRelation = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpRelation = new EmpRelation();
|
|||
|
oEmpRelation.Name = oDr["Name"].ToString();
|
|||
|
Relation oRelation = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Relation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRelation != null)
|
|||
|
oEmpRelation.RelationID = oRelation.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Relation", nRow, "Relation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
Occupation oCCupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oCCupation != null)
|
|||
|
oEmpRelation.OccupationID = oCCupation.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Occupation", nRow, "Occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
_HREmployee.EmpRelations.Add(oEmpRelation);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _HREmployee.EmpRelations;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Question Information
|
|||
|
public ObjectsTemplate<EmpHRQuestionAnswer> ImportEmpHRQuestionAnswerInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpHRQuestionAnswer oEmpHRQuestionAnswer = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["QuestionNo"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpHRQuestionAnswer = new EmpHRQuestionAnswer();
|
|||
|
HRJoiningQuestionary oHRJQuestion = _HRJoiningQuestionaries.Find(delegate(HRJoiningQuestionary oItem) { return oItem.Description.ToUpper().Trim() == oDr["Question"].ToString().ToUpper().Trim(); });
|
|||
|
if (oHRJQuestion != null)
|
|||
|
{
|
|||
|
oEmpHRQuestionAnswer.QuestionNo = oDr["QuestionNo"].ToString();
|
|||
|
oEmpHRQuestionAnswer.QuestionaryID = oHRJQuestion.ID;
|
|||
|
oEmpHRQuestionAnswer.QAnswer = oDr["Qanswer"].ToString();
|
|||
|
oEmpHRQuestionAnswer.QuestionDes = oDr["Question"].ToString();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Question", nRow, "Question is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
_HREmployee.EmpHRQuestionAnswers.Add(oEmpHRQuestionAnswer);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _HREmployee.EmpHRQuestionAnswers;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Emport Multiple Employee HR Data
|
|||
|
|
|||
|
#region Import Employee General Information
|
|||
|
public ObjectsTemplate<HREmployee> ImportAllEmpGeneralInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
|
|||
|
_HREmployees = new ObjectsTemplate<HREmployee>();
|
|||
|
if (_errorOrSuccessList == null)
|
|||
|
_errorOrSuccessList = new List<UploadErrorOrSuccess>();
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["First Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
_HREmployee = new HREmployee();
|
|||
|
_HREmployee.PayrollTypeID = Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID;
|
|||
|
_HREmployee.EmployeeNo = oDr["Employee No"].ToString();
|
|||
|
_HREmployee.GlobalID = oDr["GDDB ID"].ToString();
|
|||
|
_HREmployee.BirthPlace = oDr["Place Of Birth"].ToString();
|
|||
|
//_HREmployee.NickName = oDr["Nick Name"].ToString();
|
|||
|
_HREmployee.FirstName = oDr["First Name"].ToString();
|
|||
|
_HREmployee.MiddleName = oDr["Middle Name"].ToString();
|
|||
|
_HREmployee.LastName = oDr["Last Name"].ToString();
|
|||
|
_HREmployee.Name = _HREmployee.FirstName + " " + _HREmployee.MiddleName + " " + _HREmployee.LastName;
|
|||
|
_HREmployee.Gender = (oDr["Gender"].ToString().Trim().ToUpper().Trim() == "Male".ToUpper().Trim()) ? EnumGender.Male : EnumGender.Female;
|
|||
|
switch (oDr["Marital Status"].ToString())
|
|||
|
{
|
|||
|
case "Married":
|
|||
|
_HREmployee.MaritalStatus = EnumMaritalStatus.Married;
|
|||
|
break;
|
|||
|
case "UnMarried":
|
|||
|
_HREmployee.MaritalStatus = EnumMaritalStatus.UnMarried;
|
|||
|
break;
|
|||
|
case "Divorced":
|
|||
|
_HREmployee.MaritalStatus = EnumMaritalStatus.Divorced;
|
|||
|
break;
|
|||
|
case "Widow":
|
|||
|
_HREmployee.MaritalStatus = EnumMaritalStatus.Widow;
|
|||
|
break;
|
|||
|
default:
|
|||
|
_HREmployee.MaritalStatus = EnumMaritalStatus.None;
|
|||
|
break;
|
|||
|
}
|
|||
|
Religion oReligion = _Religions.Find(delegate(Religion oItem) { return oItem.Name.ToUpper().Trim() == oDr["Religion"].ToString().ToUpper().Trim(); });
|
|||
|
if (oReligion != null)
|
|||
|
_HREmployee.ReligionID = oReligion.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Religion", nRow, "Religion is not valid for employee from " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
|
|||
|
if (oDr["Blood Group"].ToString().ToUpper() == "B+".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.BPos;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "B-".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.BNeg;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "A+".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.APos;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "A-".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.ANeg;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "O+".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.OPos;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "O-".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.ONeg;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "AB+".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.ABPos;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "AB-".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.ABNeg;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
_HREmployee.PassportNo = oDr["Passport No"].ToString();
|
|||
|
_HREmployee.TinNo = oDr["Tax Identification No"].ToString();
|
|||
|
|
|||
|
Nationality oNationality = _Nationalites.Find(delegate(Nationality oItem) { return oItem.Description.ToUpper().Trim() == oDr["Nationality"].ToString().ToUpper().Trim(); });
|
|||
|
if (oNationality != null)
|
|||
|
_HREmployee.NationalityID = oNationality.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Nationality", nRow, "Nationality is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
_HREmployee.NationalID = oDr["National ID"].ToString();
|
|||
|
|
|||
|
DateTime dTemFDate;
|
|||
|
if (DateTime.TryParse(oDr["Joining Date"].ToString(), out dTemFDate))
|
|||
|
_HREmployee.JoiningDate = dTemFDate;//Convert.ToDateTime(oDr["Employed From Date"].ToString());
|
|||
|
else
|
|||
|
_HREmployee.JoiningDate = DateTime.MinValue;
|
|||
|
|
|||
|
//_HREmployee.JoiningDate = Convert.ToDateTime(oDr["Joining Date"]);
|
|||
|
DateTime dTemBDate;
|
|||
|
if (DateTime.TryParse(oDr["Date of Birth"].ToString(), out dTemBDate))
|
|||
|
_HREmployee.BirthDate = dTemBDate;//Convert.ToDateTime(oDr["Date of Birth"]);
|
|||
|
else
|
|||
|
//_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Joining Date", nRow, "Please enter employee joining date " + oDTable.TableName + " Information."));
|
|||
|
_HREmployee.BirthDate = DateTime.MinValue;
|
|||
|
|
|||
|
|
|||
|
Category oCategory = _Categories.Find(delegate(Category oItem) { return oItem.Name.ToUpper().Trim() == oDr["Category"].ToString().ToUpper().Trim(); });
|
|||
|
if (oCategory != null)
|
|||
|
_HREmployee.CategoryID = oCategory.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Category", nRow, "Category is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
_HREmployee.FatherName = oDr["Father's Name"].ToString();
|
|||
|
_HREmployee.MotherName = oDr["Mother's Name"].ToString();
|
|||
|
Occupation oFOccupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Father's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oFOccupation != null)
|
|||
|
_HREmployee.FatherOccupationID = oFOccupation.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Occupation", nRow, "Father occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
Occupation oMOccupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Mother's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oMOccupation != null)
|
|||
|
_HREmployee.MotherOccupationID = oMOccupation.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Occupation", nRow, "Mother occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
_HREmployees.Add(_HREmployee);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _HREmployees;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Contact Information
|
|||
|
public void ImportAllEmpContactInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
int nRow = 0;
|
|||
|
EmpContact oEmpContact = null;
|
|||
|
ObjectsTemplate<Thana> oParmanentsThanas = null;
|
|||
|
ObjectsTemplate<Thana> oPresentThanas = null;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Permanent Address"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
|
|||
|
HREmployee oHREmployee = _HREmployees.Find(delegate(HREmployee oItem) { return oItem.EmployeeNo == oDr["Employee No"].ToString(); });
|
|||
|
if (oHREmployee != null)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpContact = new EmpContact();
|
|||
|
oEmpContact.ParmanentAddress = oDr["Permanent Address"].ToString();
|
|||
|
District oDisPar = _Districts.Find(delegate(District oItem) { return oItem.Name.ToUpper() == oDr["Permanent District"].ToString().ToUpper(); });
|
|||
|
oParmanentsThanas = Thana.GetByDistID(oDisPar.ID);
|
|||
|
if (oDisPar != null)
|
|||
|
oEmpContact.ParmanentDistrictID = oDisPar.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("District", nRow, "Permanent District is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
Thana oThanaPar = oParmanentsThanas.Find(delegate(Thana oItem) { return oItem.Name.ToUpper().Trim() == oDr["Permanent Thana"].ToString().ToUpper().Trim(); });
|
|||
|
if (oThanaPar != null)
|
|||
|
oEmpContact.ParmanentThanaID = oThanaPar.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Thana", nRow, "Permanent Thana is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpContact.ParmanentTelephone = oDr["Permanent Telephone No"].ToString();
|
|||
|
oEmpContact.ParmanentMobile = oDr["PerMobile No"].ToString();
|
|||
|
|
|||
|
oEmpContact.PresentAddress = oDr["Present Address"].ToString();
|
|||
|
|
|||
|
District oPerDis = _Districts.Find(delegate(District oItem) { return oItem.Name.ToUpper().Trim() == oDr["Present District"].ToString().ToUpper().Trim(); });
|
|||
|
oPresentThanas = Thana.GetByDistID(oPerDis.ID);
|
|||
|
if (oPerDis != null)
|
|||
|
oEmpContact.PresentDistrictID = oPerDis.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("District", nRow, "Present District is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
Thana oThanaPre = oPresentThanas.Find(delegate(Thana oItem) { return oItem.Name.ToUpper().Trim() == oDr["Present Thana"].ToString().ToUpper().Trim(); });
|
|||
|
if (oThanaPre != null)
|
|||
|
oEmpContact.PresentThanaID = oThanaPre.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Thana", nRow, "Present Thana is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpContact.PresentTelephone = oDr["Present Telephone No"].ToString();
|
|||
|
oEmpContact.PresentMobile = oDr["PreMobile No"].ToString();
|
|||
|
|
|||
|
oEmpContact.PersonalTelephone = oDr["Personal Land Phone No"].ToString();
|
|||
|
oEmpContact.Mobile = oDr["Personal Mobile No"].ToString();
|
|||
|
oEmpContact.PersonalEMail = oDr["Personal E-Mail"].ToString();
|
|||
|
oEmpContact.OfficalEMail = oDr["Offical E-Mail"].ToString();
|
|||
|
oEmpContact.Fax = oDr["Fax"].ToString();
|
|||
|
|
|||
|
oEmpContact.EmergencyContactAddress = oDr["Emergency Contact Address"].ToString();
|
|||
|
oEmpContact.EmergencyContactPerson = oDr["Emergency Contact Person"].ToString();
|
|||
|
oEmpContact.EmergencyTelephone = oDr["Emergency Telephone No"].ToString();
|
|||
|
oEmpContact.EmergencyMobile = oDr["EmeMobile No"].ToString();
|
|||
|
|
|||
|
Relation oRel = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Relation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRel != null)
|
|||
|
oEmpContact.ContactPersonRelationId = oRel.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Relation", nRow, "Emergency Relation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oHREmployee.Contacts.Add(oEmpContact);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
//return _HREmployee.Contacts;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Spouse Information
|
|||
|
public void ImportAllEmpSpouseInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpSpouse oEmpSpouse = null;
|
|||
|
int nRow = 0;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
|
|||
|
if (oDr["Spouse Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployee oHREmployee = _HREmployees.Find(delegate(HREmployee oItem) { return oItem.EmployeeNo == oDr["Employee No"].ToString(); });
|
|||
|
if (oHREmployee != null)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
|
|||
|
oEmpSpouse = new EmpSpouse();
|
|||
|
oEmpSpouse.Name = oDr["Spouse Name"].ToString();
|
|||
|
if (oDr["Spouse Level of Education"].ToString() != string.Empty)
|
|||
|
{
|
|||
|
EducationLevel oEdLevel = _EducationLevels.Find(delegate(EducationLevel oItem) { return oItem.Description.ToUpper().Trim() == oDr["Spouse Level of Education"].ToString().ToUpper().Trim(); });
|
|||
|
if (oEdLevel != null)
|
|||
|
oEmpSpouse.EducationLevelID = oEdLevel.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Spouse Level of Education", nRow, "Spouse level of education is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oEmpSpouse.EducationLevelID = null;
|
|||
|
}
|
|||
|
|
|||
|
Occupation oOccup = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Spouse Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oOccup != null)
|
|||
|
oEmpSpouse.OccupationID = oOccup.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Spouse Occupation", nRow, "Spouse Occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
DateTime dTemBDate;
|
|||
|
if (DateTime.TryParse(oDr["Date of Birth"].ToString(), out dTemBDate))
|
|||
|
oEmpSpouse.MarriageDate = dTemBDate;//Convert.ToDateTime(oDr["Date of Birth"].ToString());
|
|||
|
else
|
|||
|
oEmpSpouse.MarriageDate = DateTime.MinValue;
|
|||
|
|
|||
|
oHREmployee.Spouses.Add(oEmpSpouse);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
//return _HREmployee.Spouses;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Child Information
|
|||
|
public void ImportAllEmpChildInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpChildren oEmpChildren = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Child's Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployee oHREmployee = _HREmployees.Find(delegate(HREmployee oItem) { return oItem.EmployeeNo == oDr["Employee No"].ToString(); });
|
|||
|
if (oHREmployee != null)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpChildren = new EmpChildren();
|
|||
|
oEmpChildren.Name = oDr["Child's Name"].ToString();
|
|||
|
oEmpChildren.Gender = (oDr["Child's Gender"].ToString().Trim() == "Male") ? EnumGender.Male : EnumGender.Female;
|
|||
|
DateTime dTemCBdate;
|
|||
|
if (DateTime.TryParse(oDr["Child's Date of Birth"].ToString(), out dTemCBdate))
|
|||
|
oEmpChildren.BirthDate = dTemCBdate;//Convert.ToDateTime(oDr["Child's Date of Birth"].ToString());
|
|||
|
else
|
|||
|
oEmpChildren.BirthDate = DateTime.MinValue;
|
|||
|
|
|||
|
Occupation oCCP = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Child's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oCCP != null)
|
|||
|
oEmpChildren.OccupationID = oCCP.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Child's Occupation", nRow, "Child's Occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
switch (oDr["Child's Marital Status"].ToString().Trim())
|
|||
|
{
|
|||
|
case "Married":
|
|||
|
oEmpChildren.MaritalStatus = EnumMaritalStatus.Married;
|
|||
|
break;
|
|||
|
case "UnMarried":
|
|||
|
oEmpChildren.MaritalStatus = EnumMaritalStatus.UnMarried;
|
|||
|
break;
|
|||
|
case "Divorced":
|
|||
|
oEmpChildren.MaritalStatus = EnumMaritalStatus.Divorced;
|
|||
|
break;
|
|||
|
case "Widow":
|
|||
|
oEmpChildren.MaritalStatus = EnumMaritalStatus.Widow;
|
|||
|
break;
|
|||
|
default:
|
|||
|
break;
|
|||
|
|
|||
|
}
|
|||
|
oHREmployee.Childrens.Add(oEmpChildren);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
//return _HREmployee.Childrens;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Experience Information
|
|||
|
public void ImportAllEmpExperienceInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpExperience oEmpExperience = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Employer"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployee oHREmployee = _HREmployees.Find(delegate(HREmployee oItem) { return oItem.EmployeeNo == oDr["Employee No"].ToString(); });
|
|||
|
if (oHREmployee != null)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpExperience = new EmpExperience();
|
|||
|
oEmpExperience.Employer = oDr["Employer"].ToString();
|
|||
|
oEmpExperience.ContactPerson = oDr["Contact Person"].ToString() != string.Empty ? oDr["Contact Person"].ToString() : "";
|
|||
|
oEmpExperience.Address = oDr["Address"].ToString();
|
|||
|
oEmpExperience.Telephone = oDr["Telephone No"].ToString() != string.Empty ? oDr["Telephone No"].ToString() : "";
|
|||
|
oEmpExperience.EmployerActivity = oDr["Industry/ Business Type"].ToString();
|
|||
|
oEmpExperience.Designation = oDr["Designation"].ToString();
|
|||
|
oEmpExperience.JobDescription = oDr["Role Description"].ToString() != string.Empty ? oDr["Role Description"].ToString() : "";
|
|||
|
|
|||
|
DateTime dTemFDate;
|
|||
|
if (DateTime.TryParse(oDr["Employed From Date"].ToString(), out dTemFDate))
|
|||
|
oEmpExperience.FromDate = dTemFDate;//Convert.ToDateTime(oDr["Employed From Date"].ToString());
|
|||
|
else
|
|||
|
oEmpExperience.FromDate = DateTime.MinValue;
|
|||
|
|
|||
|
DateTime dTempDate;
|
|||
|
if (DateTime.TryParse(oDr["Employed To Date"].ToString(), out dTempDate))
|
|||
|
oEmpExperience.ToDate = dTempDate;
|
|||
|
else
|
|||
|
oEmpExperience.ToDate = DateTime.MinValue;
|
|||
|
oHREmployee.Experiences.Add(oEmpExperience);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
//return _HREmployee.Experiences;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Training Information
|
|||
|
public void ImportAllEmpTrainingInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpTraining oEmpTraining = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Training Title"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployee oHREmployee = _HREmployees.Find(delegate(HREmployee oItem) { return oItem.EmployeeNo == oDr["Employee No"].ToString(); });
|
|||
|
if (oHREmployee != null)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpTraining = new EmpTraining();
|
|||
|
oEmpTraining.Name = oDr["Training Title"].ToString();
|
|||
|
TrainingType oTType = _TrainingTypes.Find(delegate(TrainingType oItem) { return oItem.Name.ToUpper().Trim() == oDr["Training Type"].ToString().ToUpper().Trim(); });
|
|||
|
if (oTType != null)
|
|||
|
oEmpTraining.TrainingTypeID = oTType.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Training Type", nRow, "Training Type is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
NatureOfTraining oNOFTraning = _NatureOfTrainings.Find(delegate(NatureOfTraining oItem) { return oItem.Name.ToUpper().Trim() == oDr["Nature of Training"].ToString().ToUpper().Trim(); });
|
|||
|
if (oNOFTraning != null)
|
|||
|
oEmpTraining.NatureOfTrainingID = oNOFTraning.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Nature of Training", nRow, "Nature of Training is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpTraining.Description = oDr["Description"].ToString();
|
|||
|
Institution oIns = _Institutions.Find(delegate(Institution oItem) { return oItem.Name.ToUpper().Trim() == oDr["Institution"].ToString().ToUpper().Trim(); });
|
|||
|
if (oIns != null)
|
|||
|
oEmpTraining.InstitutionID = oIns.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Institution", nRow, "Institution is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpTraining.Place = oDr["Training Place"].ToString();
|
|||
|
Country oCountry = _Contries.Find(delegate(Country oItem) { return oItem.Name.ToUpper().Trim() == oDr["Country"].ToString().ToUpper().Trim(); });
|
|||
|
if (oCountry != null)
|
|||
|
oEmpTraining.CountryID = oCountry.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Country", nRow, "Country is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpTraining.Achievement = oDr["Achievement"].ToString() != string.Empty ? oDr["Achievement"].ToString() : "";
|
|||
|
oEmpTraining.TrainingCompletedFrom = (oDr["Sponsor Type"].ToString().ToUpper().Trim() == "Own".ToUpper().Trim()) ? EnumTrainingCompletedFrom.Own : EnumTrainingCompletedFrom.Company;
|
|||
|
if (oDr["Training Fees"].ToString().Trim() != string.Empty)
|
|||
|
oEmpTraining.Fees = Convert.ToDouble(oDr["Training Fees"]);
|
|||
|
else
|
|||
|
oEmpTraining.Fees = 0.0;
|
|||
|
|
|||
|
if (oDr["Other Cost"].ToString().Trim() != string.Empty)
|
|||
|
oEmpTraining.OtherCost = Convert.ToDouble(oDr["Other Cost"]);
|
|||
|
else
|
|||
|
oEmpTraining.OtherCost = 0.0;
|
|||
|
|
|||
|
DateTime dTempFdate;
|
|||
|
if (DateTime.TryParse(oDr["From Date"].ToString(), out dTempFdate))
|
|||
|
oEmpTraining.FromDate = dTempFdate;//Convert.ToDateTime(oDr["From Date"]);
|
|||
|
else
|
|||
|
oEmpTraining.FromDate = DateTime.MinValue;
|
|||
|
|
|||
|
DateTime oTEmpDate;
|
|||
|
if (DateTime.TryParse(oDr["To Date"].ToString(), out oTEmpDate))
|
|||
|
oEmpTraining.ToDate = oTEmpDate;
|
|||
|
else
|
|||
|
oEmpTraining.ToDate = DateTime.MinValue;
|
|||
|
|
|||
|
oHREmployee.Trainings.Add(oEmpTraining);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
//return _HREmployee.Trainings;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Academic Information
|
|||
|
public void ImportAllEmpAcademicInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpAcademic oEmpAcademic = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Education Type"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployee oHREmployee = _HREmployees.Find(delegate(HREmployee oItem) { return oItem.EmployeeNo == oDr["Employee No"].ToString(); });
|
|||
|
if (oHREmployee != null)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpAcademic = new EmpAcademic();
|
|||
|
EducationType oEDType = _EducationTypes.Find(delegate(EducationType oItem) { return oItem.Description.ToUpper().Trim() == oDr["Education Type"].ToString().ToUpper().Trim(); });
|
|||
|
if (oEDType != null)
|
|||
|
oEmpAcademic.EducationTypeID = oEDType.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Education Type", nRow, "Education Type is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
|
|||
|
EducationLevel oEducLevel = _EducationLevels.Find(delegate(EducationLevel oItem) { return oItem.Description.ToUpper().Trim() == oDr["Degree Title"].ToString().ToUpper().Trim(); });
|
|||
|
if (oEducLevel != null)
|
|||
|
oEmpAcademic.EducationLevelID = oEducLevel.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Degree Title", nRow, "Degree Title is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
|
|||
|
Discipline oDis = _Disciplines.Find(delegate(Discipline oItem) { return oItem.Description.ToUpper().Trim() == oDr["Discipline/ Department"].ToString().ToUpper().Trim(); });
|
|||
|
if (oDis != null)
|
|||
|
oEmpAcademic.DisciplineID = oDis.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Discipline/ Department", nRow, "Discipline/ Department is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
|
|||
|
Institution oIns = _Institutions.Find(delegate(Institution oItem) { return oItem.Name.ToUpper().Trim() == oDr["Institution (Board/University)"].ToString().ToUpper().Trim(); });
|
|||
|
if (oIns != null)
|
|||
|
oEmpAcademic.InstitutionID = oIns.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Institution (Board/University)", nRow, "Institution (Board/University) is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpAcademic.InstituteName = oDr["Institution Name"].ToString();
|
|||
|
DateTime dExamdate = Convert.ToDateTime(oDr["Exam Held on"]);
|
|||
|
oEmpAcademic.ExamDate = dExamdate.Year;
|
|||
|
DateTime dPassingYear = Convert.ToDateTime(oDr["Passing Year"]);
|
|||
|
oEmpAcademic.PassingYear = dPassingYear.Year;
|
|||
|
|
|||
|
ResultType oRType = _ResultTypes.Find(delegate(ResultType oItem) { return oItem.Description.ToUpper().Trim() == oDr["Result"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRType != null)
|
|||
|
oEmpAcademic.ResultTypeID = oRType.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Result", nRow, "Result is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
if (oDr["CGPA/ Marks"].ToString() != string.Empty || oDr["CGPA/ Marks"].ToString().Length > 0)
|
|||
|
oEmpAcademic.GPAOrMarks = Convert.ToDouble(oDr["CGPA/ Marks"]);
|
|||
|
oEmpAcademic.LastLevel = (oDr["Highest Education"].ToString().ToUpper().Trim() == "Yes".ToUpper().Trim()) ? true : false;
|
|||
|
|
|||
|
oHREmployee.Academics.Add(oEmpAcademic);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
//return _HREmployee.Academics;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Reference Information
|
|||
|
public void ImportAllEmpReferenceInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpReference oEmpReference = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Referee's Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployee oHREmployee = _HREmployees.Find(delegate(HREmployee oItem) { return oItem.EmployeeNo == oDr["Employee No"].ToString(); });
|
|||
|
if (oHREmployee != null)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpReference = new EmpReference();
|
|||
|
oEmpReference.Name = oDr["Referee's Name"].ToString();
|
|||
|
Occupation oCcupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Referee's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oCcupation != null)
|
|||
|
{
|
|||
|
oEmpReference.OccupationID = oCcupation.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Referee's Occupation", nRow, "Referee's Occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
|
|||
|
Relation oRelation = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Relation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRelation != null)
|
|||
|
{
|
|||
|
oEmpReference.RelationID = oRelation.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Relation", nRow, "Relation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
oEmpReference.Address = oDr["Address"].ToString();
|
|||
|
oEmpReference.EmailAddress = oDr["E-mail Address"].ToString() != string.Empty ? oDr["E-mail Address"].ToString() : "";
|
|||
|
oEmpReference.Telephone = oDr["Telephone No(s)"].ToString() != string.Empty ? oDr["Telephone No(s)"].ToString() : "";
|
|||
|
oEmpReference.ReferenceMobile = oDr["Mobile No(s)"].ToString() != string.Empty ? oDr["Mobile No(s)"].ToString() : "";
|
|||
|
oHREmployee.References.Add(oEmpReference);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
//return _HREmployee.References;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Publication Information
|
|||
|
public void ImportAllEmpPublicationInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
|
|||
|
EmpPublication oEmpPublication = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Publication Title"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployee oHREmployee = _HREmployees.Find(delegate(HREmployee oItem) { return oItem.EmployeeNo == oDr["Employee No"].ToString(); });
|
|||
|
if (oHREmployee != null)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpPublication = new EmpPublication();
|
|||
|
oEmpPublication.Title = oDr["Publication Title"].ToString();
|
|||
|
oEmpPublication.PublicationType = oDr["Publication Type"].ToString();
|
|||
|
oEmpPublication.PublishersName = oDr["Publication Name"].ToString() != string.Empty ? oDr["Publication Name"].ToString() : "";
|
|||
|
oEmpPublication.Description = oDr["Description"].ToString() != string.Empty ? oDr["Description"].ToString() : "";
|
|||
|
oEmpPublication.Remarks = oDr["Remarks"].ToString() != string.Empty ? oDr["Remarks"].ToString() : "";
|
|||
|
DateTime dTempDate;
|
|||
|
|
|||
|
if (DateTime.TryParse(oDr["Date of Publication"].ToString(), out dTempDate))
|
|||
|
oEmpPublication.PublicationDate = dTempDate;//Convert.ToDateTime(oDr["Date of Publication"].ToString());
|
|||
|
else
|
|||
|
oEmpPublication.PublicationDate = DateTime.MinValue;
|
|||
|
oHREmployee.Publications.Add(oEmpPublication);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
//return _HREmployee.Publications;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Nominee Information
|
|||
|
public void ImportAllEmpNomineeInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpNominee oEmpNominee = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Nomination Purpose"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployee oHREmployee = _HREmployees.Find(delegate(HREmployee oItem) { return oItem.EmployeeNo == oDr["Employee No"].ToString(); });
|
|||
|
if (oHREmployee != null)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpNominee = new EmpNominee();
|
|||
|
NominationPurpose oNominationPurpose = _NominationPurposes.Find(delegate(NominationPurpose oItem) { return oItem.Description.ToUpper().Trim() == oDr["Nomination Purpose"].ToString().ToUpper().Trim(); });
|
|||
|
|
|||
|
if (oNominationPurpose != null)
|
|||
|
{
|
|||
|
oEmpNominee.NominationPurposeID = oNominationPurpose.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Nomination Purpose", nRow, "Nomination Purpose is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
DateTime dTemDate;
|
|||
|
if (DateTime.TryParse(Convert.ToString(oDr["Date Of Nomination"]), out dTemDate))
|
|||
|
oEmpNominee.NominationDate = dTemDate;
|
|||
|
else
|
|||
|
oEmpNominee.NominationDate = DateTime.MinValue;
|
|||
|
|
|||
|
oEmpNominee.Name = oDr["Nominee's Name"].ToString();
|
|||
|
Relation oRelation = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Relation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRelation != null)
|
|||
|
{
|
|||
|
oEmpNominee.RelationID = oRelation.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Relation", nRow, "Relation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
oEmpNominee.Percentage = Convert.ToDouble(oDr["Percentage"].ToString()) > 0 ? Convert.ToDouble(oDr["Percentage"].ToString()) : 0.0;
|
|||
|
DateTime dtempDate;
|
|||
|
if (DateTime.TryParse(Convert.ToString(oDr["Nominee's Date of Birth"]), out dtempDate))
|
|||
|
oEmpNominee.BirthDate = dtempDate;//Convert.ToDateTime(oDr["Nominee's Date of Birth"]);
|
|||
|
else
|
|||
|
oEmpNominee.BirthDate = DateTime.MinValue;
|
|||
|
|
|||
|
Occupation oOCCupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Nominee's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oOCCupation != null)
|
|||
|
{
|
|||
|
oEmpNominee.OccupationID = oOCCupation.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Nominee's Occupation", nRow, "Nominee's Occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
|
|||
|
oEmpNominee.Address = oDr["Address"].ToString();
|
|||
|
oEmpNominee.TelePhone = oDr["Telephone No(s)"].ToString() != string.Empty ? oDr["Telephone No(s)"].ToString() : "";
|
|||
|
oEmpNominee.EmailAddress = oDr["E-mail Address"].ToString() != string.Empty ? oDr["E-mail Address"].ToString() : "";
|
|||
|
oHREmployee.Nominees.Add(oEmpNominee);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
//return _HREmployee.Nominees;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Hospitalization Information
|
|||
|
public void ImportAllEmpHospitalizationInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpHospitalization oEmpHospitalization = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Registered Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployee oHREmployee = _HREmployees.Find(delegate(HREmployee oItem) { return oItem.EmployeeNo == oDr["Employee No"].ToString(); });
|
|||
|
if (oHREmployee != null)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpHospitalization = new EmpHospitalization();
|
|||
|
oEmpHospitalization.RegistrationDate = Convert.ToDateTime(oDr["Date Of Registration"].ToString());
|
|||
|
oEmpHospitalization.RegisteredPerson = oDr["Registered Name"].ToString();
|
|||
|
Relation oRelation = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Relation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRelation != null)
|
|||
|
{
|
|||
|
oEmpHospitalization.RelationId = oRelation.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Relation", nRow, "Relation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
DateTime dTEmpDate;
|
|||
|
if (DateTime.TryParse(oDr["Registered Person's Date of Birth"].ToString(), out dTEmpDate))
|
|||
|
oEmpHospitalization.BirthDate = dTEmpDate;//Convert.ToDateTime(oDr["Registered Person's Date of Birth"]);
|
|||
|
else
|
|||
|
oEmpHospitalization.BirthDate = DateTime.MinValue;
|
|||
|
|
|||
|
Occupation oOCCupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Registered Person's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oOCCupation != null)
|
|||
|
{
|
|||
|
oEmpHospitalization.OccupationID = oOCCupation.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Registered Person's Occupation", nRow, "Registered Person's Occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
oEmpHospitalization.Email = oDr["Email"].ToString() != string.Empty ? oDr["Email"].ToString() : "";
|
|||
|
oEmpHospitalization.Address = oDr["Address"].ToString();
|
|||
|
oEmpHospitalization.Telephone = oDr["Telephone No(s)"].ToString() != string.Empty ? oDr["Telephone No(s)"].ToString() : "";
|
|||
|
oEmpHospitalization.Mobile = oDr["Mobile No (s)"].ToString() != string.Empty ? oDr["Mobile No (s)"].ToString() : "";
|
|||
|
oHREmployee.Hospitalizations.Add(oEmpHospitalization);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
//return _HREmployee.Hospitalizations;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Guarantor Information
|
|||
|
public void ImportAllEmpGuarantorInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpGuarantor oEmpGuarantor = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployee oHREmployee = _HREmployees.Find(delegate(HREmployee oItem) { return oItem.EmployeeNo == oDr["Employee No"].ToString(); });
|
|||
|
if (oHREmployee != null)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpGuarantor = new EmpGuarantor();
|
|||
|
oEmpGuarantor.Name = oDr["Name"].ToString();
|
|||
|
|
|||
|
Occupation oOCCupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oOCCupation != null)
|
|||
|
{
|
|||
|
oEmpGuarantor.OccupationID = oOCCupation.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Occupation", nRow, "Occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
oEmpGuarantor.Address = oDr["Address"].ToString();
|
|||
|
oEmpGuarantor.EmailAddress = oDr["Email"].ToString() != string.Empty ? oDr["Email"].ToString() : "";
|
|||
|
oEmpGuarantor.Telephone = oDr["Telephone No(s)"].ToString() != string.Empty ? oDr["Telephone No(s)"].ToString() : "";
|
|||
|
oEmpGuarantor.GuarantorMobile = oDr["Mobile No(s)"].ToString() != string.Empty ? oDr["Mobile No(s)"].ToString() : "";
|
|||
|
GuarantorDocumentType oGDType = _GuarantorDocumentTypes.Find(delegate(GuarantorDocumentType oItem) { return oItem.Description.ToUpper().Trim() == oDr["Document Category"].ToString().ToUpper().Trim(); });
|
|||
|
if (oGDType != null)
|
|||
|
{
|
|||
|
oEmpGuarantor.CategotyDocId = oGDType.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Document Category", nRow, "Document Category is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
oEmpGuarantor.DocumentPath = oDr["Document Path"].ToString() != string.Empty ? oDr["Document Path"].ToString() : "";
|
|||
|
oHREmployee.Guarantors.Add(oEmpGuarantor);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
//return _HREmployee.Guarantors;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Language Information
|
|||
|
public void ImportAllEmpLanguageInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpLanguage oEmpLanguage = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["LanguageName"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployee oHREmployee = _HREmployees.Find(delegate(HREmployee oItem) { return oItem.EmployeeNo == oDr["Employee No"].ToString(); });
|
|||
|
if (oHREmployee != null)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpLanguage = new EmpLanguage();
|
|||
|
oEmpLanguage.LanguageName = oDr["LanguageName"].ToString();
|
|||
|
if (oDr["SpokenStatus"].ToString().ToUpper().Trim() == "Basic".ToUpper().Trim())
|
|||
|
{
|
|||
|
oEmpLanguage.SpokenStatus = EnumLanguageEfficiency.Basic;
|
|||
|
}
|
|||
|
else if (oDr["SpokenStatus"].ToString().ToUpper().Trim() == "Intermideate".ToUpper().Trim())
|
|||
|
{
|
|||
|
oEmpLanguage.SpokenStatus = EnumLanguageEfficiency.Intermideate;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oEmpLanguage.SpokenStatus = EnumLanguageEfficiency.Advanced;
|
|||
|
}
|
|||
|
|
|||
|
if (oDr["WrittenStatus"].ToString().ToUpper().Trim() == "Basic".ToUpper().Trim())
|
|||
|
{
|
|||
|
oEmpLanguage.WrittenStatus = EnumLanguageEfficiency.Basic;
|
|||
|
}
|
|||
|
else if (oDr["WrittenStatus"].ToString().ToUpper().Trim() == "Intermideate".ToUpper().Trim())
|
|||
|
{
|
|||
|
oEmpLanguage.WrittenStatus = EnumLanguageEfficiency.Intermideate;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oEmpLanguage.WrittenStatus = EnumLanguageEfficiency.Advanced;
|
|||
|
}
|
|||
|
oHREmployee.EmpLanguages.Add(oEmpLanguage);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
//return _HREmployee.EmpLanguages;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Relative Information
|
|||
|
public void ImportAllEmpRelativeInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpRelative oEmpRelative = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployee oHREmployee = _HREmployees.Find(delegate(HREmployee oItem) { return oItem.EmployeeNo == oDr["Employee No"].ToString(); });
|
|||
|
if (oHREmployee != null)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpRelative = new EmpRelative();
|
|||
|
oEmpRelative.Name = oDr["Name"].ToString();
|
|||
|
oEmpRelative.Designation = oDr["Designation"].ToString();
|
|||
|
oEmpRelative.EmpNo = oDr["EmpID"].ToString();
|
|||
|
Relation oRelation = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Relation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRelation != null)
|
|||
|
oEmpRelative.RelationID = oRelation.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Relation", nRow, "Relation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
DateTime dTempJDate;
|
|||
|
if (DateTime.TryParse(oDr["JoiningDate"].ToString(), out dTempJDate))
|
|||
|
oEmpRelative.JoiningDate = dTempJDate;//Convert.ToDateTime(oDr["JoiningDate"]);
|
|||
|
else
|
|||
|
oEmpRelative.JoiningDate = DateTime.MinValue;
|
|||
|
|
|||
|
DateTime dTempDate;
|
|||
|
if (DateTime.TryParse(oDr["EndDate"].ToString(), out dTempDate))
|
|||
|
oEmpRelative.EndDate = dTempDate;//Convert.ToDateTime(oDr["EndDate"]);
|
|||
|
else
|
|||
|
oEmpRelative.EndDate = DateTime.MinValue;
|
|||
|
|
|||
|
oHREmployee.EmpRelatives.Add(oEmpRelative);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
//return _HREmployee.EmpRelatives;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee MemberShip Information
|
|||
|
public void ImportAllEmpMembershipInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpMembership oEmpMembership = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Organization"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployee oHREmployee = _HREmployees.Find(delegate(HREmployee oItem) { return oItem.EmployeeNo == oDr["Employee No"].ToString(); });
|
|||
|
if (oHREmployee != null)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpMembership = new EmpMembership();
|
|||
|
oEmpMembership.Organization = oDr["Organization"].ToString();
|
|||
|
oEmpMembership.Activity = oDr["YourRole"].ToString();
|
|||
|
|
|||
|
switch (oDr["OrganizationType"].ToString().Trim())
|
|||
|
{
|
|||
|
case "Academic":
|
|||
|
oEmpMembership.OrganizationType = EnumOrganizationType.Academic;
|
|||
|
break;
|
|||
|
case "Charitable":
|
|||
|
oEmpMembership.OrganizationType = EnumOrganizationType.Charitable;
|
|||
|
break;
|
|||
|
case "Professional":
|
|||
|
oEmpMembership.OrganizationType = EnumOrganizationType.Professional;
|
|||
|
break;
|
|||
|
case "Social":
|
|||
|
oEmpMembership.OrganizationType = EnumOrganizationType.Social;
|
|||
|
break;
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
DateTime dTemFDate;
|
|||
|
if (DateTime.TryParse(oDr["FromDate"].ToString(), out dTemFDate))
|
|||
|
oEmpMembership.FromDate = dTemFDate;
|
|||
|
else
|
|||
|
oEmpMembership.FromDate = DateTime.MinValue;
|
|||
|
|
|||
|
|
|||
|
DateTime dTemDate;
|
|||
|
if (DateTime.TryParse(oDr["EndDate"].ToString(), out dTemDate))
|
|||
|
oEmpMembership.EndDate = dTemDate;//Convert.ToDateTime(oDr["EndDate"]);
|
|||
|
else
|
|||
|
oEmpMembership.EndDate = DateTime.MinValue;
|
|||
|
|
|||
|
oHREmployee.EmpMemberships.Add(oEmpMembership);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
//return _HREmployee.EmpMemberships;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Relation Information
|
|||
|
public void ImportAllEmpRelationInfo(DataTable oDTable)
|
|||
|
{
|
|||
|
EmpRelation oEmpRelation = null;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployee oHREmployee = _HREmployees.Find(delegate(HREmployee oItem) { return oItem.EmployeeNo == oDr["Employee No"].ToString(); });
|
|||
|
if (oHREmployee != null)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oEmpRelation = new EmpRelation();
|
|||
|
oEmpRelation.Name = oDr["Name"].ToString();
|
|||
|
Relation oRelation = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Relation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRelation != null)
|
|||
|
oEmpRelation.RelationID = oRelation.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Relation", nRow, "Relation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
Occupation oCCupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oCCupation != null)
|
|||
|
oEmpRelation.OccupationID = oCCupation.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Occupation", nRow, "Occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oHREmployee.EmpRelations.Add(oEmpRelation);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
//return _HREmployee.EmpRelations;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee Question Information
|
|||
|
//public ObjectsTemplate<EmpHRQuestionAnswer> ImportAllEmpHRQuestionAnswerInfo(DataTable oDTable)
|
|||
|
//{
|
|||
|
// EmpHRQuestionAnswer oEmpHRQuestionAnswer = null;
|
|||
|
// int nRow = 0;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// foreach (DataRow oDr in oDTable.Rows)
|
|||
|
// {
|
|||
|
// if (oDr["QuestionNo"].ToString().Trim() != string.Empty)
|
|||
|
// {
|
|||
|
// nRow = nRow + 1;
|
|||
|
// oEmpHRQuestionAnswer = new EmpHRQuestionAnswer();
|
|||
|
// HRJoiningQuestionary oHRJQuestion = _HRJoiningQuestionaries.Find(delegate(HRJoiningQuestionary oItem) { return oItem.Description.ToUpper().Trim() == oDr["Question"].ToString().ToUpper().Trim(); });
|
|||
|
// if (oHRJQuestion != null)
|
|||
|
// {
|
|||
|
// oEmpHRQuestionAnswer.QuestionNo = oDr["QuestionNo"].ToString();
|
|||
|
// oEmpHRQuestionAnswer.QuestionaryID = oHRJQuestion.ID;
|
|||
|
// oEmpHRQuestionAnswer.QAnswer = oDr["Qanswer"].ToString();
|
|||
|
// oEmpHRQuestionAnswer.QuestionDes = oDr["Question"].ToString();
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Question", nRow, "Question is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
// }
|
|||
|
// _HREmployee.EmpHRQuestionAnswers.Add(oEmpHRQuestionAnswer);
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
// }
|
|||
|
// catch (Exception ex)
|
|||
|
// {
|
|||
|
// throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
// }
|
|||
|
// return _HREmployee.EmpHRQuestionAnswers;
|
|||
|
//}
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Employee General Information
|
|||
|
public ObjectsTemplate<HREmployee> ImportAllEmpGeneralInForNavana(DataTable oDTable)
|
|||
|
{
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
|
|||
|
//ObjectsTemplate<EmpContact> oEmployee
|
|||
|
_CheckHREmployees = HREmployee.Get();
|
|||
|
EmpContact oEmpContact = null;
|
|||
|
ObjectsTemplate<Thana> oParmanentsThanas = null;
|
|||
|
ObjectsTemplate<Thana> oPresentThanas = null;
|
|||
|
//HREmployee oHREmployee=null;
|
|||
|
ObjectsTemplate<EmpContact> oEmpContacts = new ObjectsTemplate<EmpContact>();
|
|||
|
|
|||
|
_HREmployees = new ObjectsTemplate<HREmployee>();
|
|||
|
if (_errorOrSuccessList == null)
|
|||
|
_errorOrSuccessList = new List<UploadErrorOrSuccess>();
|
|||
|
|
|||
|
_HREmployee.Contacts = new ObjectsTemplate<EmpContact>();
|
|||
|
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["First Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployee oHREmp = _CheckHREmployees.Find(delegate(HREmployee oItem) { return oItem.EmployeeNo == oDr["EmployeeID"].ToString().ToUpper().Trim(); });
|
|||
|
|
|||
|
if (oHREmp != null)
|
|||
|
{
|
|||
|
oHREmp.Contacts = new ObjectsTemplate<EmpContact>();
|
|||
|
oHREmp.Childrens = new ObjectsTemplate<EmpChildren>();
|
|||
|
oHREmp.Experiences = new ObjectsTemplate<EmpExperience>();
|
|||
|
oHREmp.Spouses = new ObjectsTemplate<EmpSpouse>();
|
|||
|
oHREmp.Experiences = new ObjectsTemplate<EmpExperience>();
|
|||
|
oHREmp.Trainings = new ObjectsTemplate<EmpTraining>();
|
|||
|
oHREmp.Academics = new ObjectsTemplate<EmpAcademic>();
|
|||
|
|
|||
|
oHREmp.Achievement = new ObjectsTemplate<EmpAchievement>();
|
|||
|
oHREmp.OtherTalents = new ObjectsTemplate<EmpOtherTalent>();
|
|||
|
oHREmp.CurricularActivities = new ObjectsTemplate<EmpCurricularActivity>();
|
|||
|
oHREmp.Hobbys = new ObjectsTemplate<EmpHobby>();
|
|||
|
oHREmp.References = new ObjectsTemplate<EmpReference>();
|
|||
|
oHREmp.Allergies = new ObjectsTemplate<EmpAllergy>();
|
|||
|
oHREmp.Publications = new ObjectsTemplate<EmpPublication>();
|
|||
|
oHREmp.Nominees = new ObjectsTemplate<EmpNominee>();
|
|||
|
oHREmp.Hospitalizations = new ObjectsTemplate<EmpHospitalization>();
|
|||
|
oHREmp.Guarantors = new ObjectsTemplate<EmpGuarantor>();
|
|||
|
oHREmp.WorkPlanSetup = new EmpWorkPlanSetup();
|
|||
|
|
|||
|
oHREmp.EmpLanguages = new ObjectsTemplate<EmpLanguage>();
|
|||
|
oHREmp.EmpRelatives = new ObjectsTemplate<EmpRelative>();
|
|||
|
oHREmp.EmpMemberships = new ObjectsTemplate<EmpMembership>();
|
|||
|
oHREmp.EmpRelations = new ObjectsTemplate<EmpRelation>();
|
|||
|
oHREmp.EmpHRQuestionAnswers = new ObjectsTemplate<EmpHRQuestionAnswer>();
|
|||
|
oHREmp.CreditCards = new ObjectsTemplate<EmpCreditCard>();
|
|||
|
_HREmployee = oHREmp;
|
|||
|
_HREmployee.Contacts = new ObjectsTemplate<EmpContact>();
|
|||
|
//if(_HREmployee.Contacts.Count>0)
|
|||
|
//{
|
|||
|
//_HREmployee.Contacts = new ObjectsTemplate<EmpContact>();
|
|||
|
//}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
//_HREmployee = oHREmp;
|
|||
|
//_HREmployee.Contacts = new ObjectsTemplate<EmpContact>();
|
|||
|
//_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("EmployeeID", nRow, "EmployeeID : " + oDr["EmployeeID"].ToString() + " Not found in the database"));
|
|||
|
//continue;
|
|||
|
//_HREmployee = new HREmployee();
|
|||
|
}
|
|||
|
nRow = nRow + 1;
|
|||
|
_HREmployee.PayrollTypeID = Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID;
|
|||
|
_HREmployee.EmployeeNo = oDr["EmployeeID"].ToString();
|
|||
|
_HREmployee.GlobalID = oDr["GEID"].ToString();
|
|||
|
_HREmployee.BirthPlace = oDr["Place Of Birth"].ToString();
|
|||
|
//_HREmployee.NickName = oDr["Nick Name"].ToString();
|
|||
|
_HREmployee.FirstName = oDr["First Name"].ToString();
|
|||
|
_HREmployee.MiddleName = oDr["Middle Name"].ToString();
|
|||
|
_HREmployee.LastName = oDr["Last Name"].ToString();
|
|||
|
_HREmployee.Name = _HREmployee.FirstName + " " + _HREmployee.MiddleName + " " + _HREmployee.LastName;
|
|||
|
_HREmployee.Gender = (oDr["Gender"].ToString().Trim().ToUpper().Trim() == "Male".ToUpper().Trim()) ? EnumGender.Male : EnumGender.Female;
|
|||
|
|
|||
|
|
|||
|
Religion oReligion = _Religions.Find(delegate(Religion oItem) { return oItem.Name.ToUpper().Trim() == oDr["Religion"].ToString().ToUpper().Trim(); });
|
|||
|
if (oReligion != null)
|
|||
|
_HREmployee.ReligionID = oReligion.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Religion", nRow, "Religion is not valid for employee from " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
|
|||
|
if (oDr["Blood Group"].ToString().ToUpper() == "B+".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.BPos;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "B-".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.BNeg;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "A+".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.APos;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "A-".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.ANeg;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "O+".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.OPos;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "O-".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.ONeg;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "AB+".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.ABPos;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "AB-".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.ABNeg;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
_HREmployee.PassportNo = oDr["Passport No"].ToString();
|
|||
|
|
|||
|
_HREmployee.PassportIssuePlace = oDr["Passport Issue Place"].ToString();
|
|||
|
|
|||
|
DateTime dTemPassIssueDate;
|
|||
|
if (DateTime.TryParse(oDr["Passport Issue Date"].ToString(), out dTemPassIssueDate))
|
|||
|
_HREmployee.PassportIssueDate = dTemPassIssueDate;//Convert.ToDateTime(oDr["Employed From Date"].ToString());
|
|||
|
else
|
|||
|
_HREmployee.PassportIssueDate = DateTime.MinValue;
|
|||
|
|
|||
|
DateTime dTemPassExpireDate;
|
|||
|
if (DateTime.TryParse(oDr["Passport Expire Date"].ToString(), out dTemPassExpireDate))
|
|||
|
_HREmployee.PassportExpDate = dTemPassExpireDate;//Convert.ToDateTime(oDr["Employed From Date"].ToString());
|
|||
|
else
|
|||
|
_HREmployee.PassportExpDate = DateTime.MinValue;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
_HREmployee.TinNo = oDr["Tax Identification No"].ToString();
|
|||
|
|
|||
|
Nationality oNationality = _Nationalites.Find(delegate(Nationality oItem) { return oItem.Description.ToUpper().Trim() == oDr["Nationality"].ToString().ToUpper().Trim(); });
|
|||
|
if (oNationality != null)
|
|||
|
_HREmployee.NationalityID = oNationality.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Nationality", nRow, "Nationality is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
_HREmployee.NationalID = oDr["National ID"].ToString();
|
|||
|
|
|||
|
DateTime dTemFDate;
|
|||
|
if (DateTime.TryParse(oDr["Joining Date"].ToString(), out dTemFDate))
|
|||
|
_HREmployee.JoiningDate = dTemFDate;//Convert.ToDateTime(oDr["Employed From Date"].ToString());
|
|||
|
else
|
|||
|
_HREmployee.JoiningDate = DateTime.MinValue;
|
|||
|
|
|||
|
//_HREmployee.JoiningDate = Convert.ToDateTime(oDr["Joining Date"]);
|
|||
|
DateTime dTemBDate;
|
|||
|
if (DateTime.TryParse(oDr["Birth Date"].ToString(), out dTemBDate))
|
|||
|
_HREmployee.BirthDate = dTemBDate;//Convert.ToDateTime(oDr["Date of Birth"]);
|
|||
|
else
|
|||
|
//_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Joining Date", nRow, "Please enter employee joining date " + oDTable.TableName + " Information."));
|
|||
|
_HREmployee.BirthDate = DateTime.MinValue;
|
|||
|
|
|||
|
|
|||
|
Category oCategory = _Categories.Find(delegate(Category oItem) { return oItem.Name.ToUpper().Trim() == oDr["Category"].ToString().ToUpper().Trim(); });
|
|||
|
if (oCategory != null)
|
|||
|
_HREmployee.CategoryID = oCategory.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Category", nRow, "Category is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
_HREmployee.DrivingLicenceNo = oDr["Driving Licence No"].ToString();
|
|||
|
_HREmployee.FatherName = oDr["Father's Name"].ToString();
|
|||
|
_HREmployee.MotherName = oDr["Mother's Name"].ToString();
|
|||
|
Occupation oFOccupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Father's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oFOccupation != null)
|
|||
|
_HREmployee.FatherOccupationID = oFOccupation.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Occupation", nRow, "Father occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
Occupation oMOccupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Mother's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oMOccupation != null)
|
|||
|
_HREmployee.MotherOccupationID = oMOccupation.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Occupation", nRow, "Mother occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#region Employee Contact
|
|||
|
oEmpContact = new EmpContact();
|
|||
|
oEmpContact.ParmanentAddress = oDr["Permanent Address"].ToString();
|
|||
|
District oDisPar = _Districts.Find(delegate(District oItem) { return oItem.Name.ToUpper() == oDr["Permanent District"].ToString().ToUpper(); });
|
|||
|
oParmanentsThanas = Thana.GetByDistID(oDisPar.ID);
|
|||
|
if (oDisPar != null)
|
|||
|
oEmpContact.ParmanentDistrictID = oDisPar.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("District", nRow, "Permanent District is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
Thana oThanaPar = oParmanentsThanas.Find(delegate(Thana oItem) { return oItem.Name.ToUpper().Trim() == oDr["Permanent Thana"].ToString().ToUpper().Trim(); });
|
|||
|
if (oThanaPar != null)
|
|||
|
oEmpContact.ParmanentThanaID = oThanaPar.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Thana", nRow, "Permanent Thana is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpContact.ParmanentTelephone = oDr["Permanent Telephone No"].ToString();
|
|||
|
oEmpContact.ParmanentMobile = oDr["PerMobile No"].ToString();
|
|||
|
|
|||
|
oEmpContact.PresentAddress = oDr["Present Address"].ToString();
|
|||
|
|
|||
|
District oPerDis = _Districts.Find(delegate(District oItem) { return oItem.Name.ToUpper().Trim() == oDr["Present District"].ToString().ToUpper().Trim(); });
|
|||
|
oPresentThanas = Thana.GetByDistID(oPerDis.ID);
|
|||
|
if (oPerDis != null)
|
|||
|
oEmpContact.PresentDistrictID = oPerDis.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("District", nRow, "Present District is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
Thana oThanaPre = oPresentThanas.Find(delegate(Thana oItem) { return oItem.Name.ToUpper().Trim() == oDr["Present Thana"].ToString().ToUpper().Trim(); });
|
|||
|
if (oThanaPre != null)
|
|||
|
oEmpContact.PresentThanaID = oThanaPre.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Thana", nRow, "Present Thana is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpContact.PresentTelephone = oDr["Present Telephone No"].ToString();
|
|||
|
oEmpContact.PresentMobile = oDr["PreMobile No"].ToString();
|
|||
|
|
|||
|
oEmpContact.PersonalTelephone = oDr["Personal Land Phone No"].ToString();
|
|||
|
oEmpContact.Mobile = oDr["Personal Mobile No"].ToString();
|
|||
|
oEmpContact.PersonalEMail = oDr["Personal E-Mail"].ToString();
|
|||
|
oEmpContact.OfficalEMail = oDr["Official E-Mail"].ToString();
|
|||
|
oEmpContact.Fax = oDr["Fax"].ToString();
|
|||
|
|
|||
|
oEmpContact.EmergencyContactAddress = oDr["Emergency Contact Address"].ToString();
|
|||
|
oEmpContact.EmergencyContactPerson = oDr["Emergency Contact Person"].ToString();
|
|||
|
oEmpContact.EmergencyTelephone = oDr["Emergency Telephone No"].ToString();
|
|||
|
oEmpContact.EmergencyMobile = oDr["EmeMobile No"].ToString();
|
|||
|
|
|||
|
Relation oRel = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Relation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRel != null)
|
|||
|
oEmpContact.ContactPersonRelationId = oRel.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Relation", nRow, "Emergency Relation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
_HREmployee.Contacts.Add(oEmpContact);
|
|||
|
_HREmployees.Add(_HREmployee);
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return _HREmployees;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import Single Employee Information
|
|||
|
public ObjectsTemplate<HREmployee> ImportSingleEmpInForNavana(DataTable oDTable)
|
|||
|
{
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
_CheckHREmployees = HREmployee.Get();
|
|||
|
EmpContact oEmpContact = null;
|
|||
|
EmpSpouse oEmpSpouse = null;
|
|||
|
EmpChildren oEmpChildren = null;
|
|||
|
EmpExperience oEmpExperience = null;
|
|||
|
EmpTraining oEmpTraining = null;
|
|||
|
EmpAcademic oEmpAcademic = null;
|
|||
|
ObjectsTemplate<Thana> oParmanentsThanas = null;
|
|||
|
ObjectsTemplate<Thana> oPresentThanas = null;
|
|||
|
ObjectsTemplate<EmpContact> oEmpContacts = new ObjectsTemplate<EmpContact>();
|
|||
|
|
|||
|
_HREmployees = new ObjectsTemplate<HREmployee>();
|
|||
|
if (_errorOrSuccessList == null)
|
|||
|
_errorOrSuccessList = new List<UploadErrorOrSuccess>();
|
|||
|
|
|||
|
_HREmployee.Contacts = new ObjectsTemplate<EmpContact>();
|
|||
|
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["First Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
HREmployee oHREmp = _CheckHREmployees.Find(delegate(HREmployee oItem) { return oItem.EmployeeNo == oDr["EmployeeID"].ToString().ToUpper().Trim(); });
|
|||
|
|
|||
|
if (oHREmp != null)
|
|||
|
{
|
|||
|
oHREmp.Contacts = new ObjectsTemplate<EmpContact>();
|
|||
|
oHREmp.Childrens = new ObjectsTemplate<EmpChildren>();
|
|||
|
oHREmp.Experiences = new ObjectsTemplate<EmpExperience>();
|
|||
|
oHREmp.Spouses = new ObjectsTemplate<EmpSpouse>();
|
|||
|
oHREmp.Experiences = new ObjectsTemplate<EmpExperience>();
|
|||
|
oHREmp.Trainings = new ObjectsTemplate<EmpTraining>();
|
|||
|
oHREmp.Academics = new ObjectsTemplate<EmpAcademic>();
|
|||
|
|
|||
|
oHREmp.Achievement = new ObjectsTemplate<EmpAchievement>();
|
|||
|
oHREmp.OtherTalents = new ObjectsTemplate<EmpOtherTalent>();
|
|||
|
oHREmp.CurricularActivities = new ObjectsTemplate<EmpCurricularActivity>();
|
|||
|
oHREmp.Hobbys = new ObjectsTemplate<EmpHobby>();
|
|||
|
oHREmp.References = new ObjectsTemplate<EmpReference>();
|
|||
|
oHREmp.Allergies = new ObjectsTemplate<EmpAllergy>();
|
|||
|
oHREmp.Publications = new ObjectsTemplate<EmpPublication>();
|
|||
|
oHREmp.Nominees = new ObjectsTemplate<EmpNominee>();
|
|||
|
oHREmp.Hospitalizations = new ObjectsTemplate<EmpHospitalization>();
|
|||
|
oHREmp.Guarantors = new ObjectsTemplate<EmpGuarantor>();
|
|||
|
oHREmp.WorkPlanSetup = new EmpWorkPlanSetup();
|
|||
|
|
|||
|
oHREmp.EmpLanguages = new ObjectsTemplate<EmpLanguage>();
|
|||
|
oHREmp.EmpRelatives = new ObjectsTemplate<EmpRelative>();
|
|||
|
oHREmp.EmpMemberships = new ObjectsTemplate<EmpMembership>();
|
|||
|
oHREmp.EmpRelations = new ObjectsTemplate<EmpRelation>();
|
|||
|
oHREmp.EmpHRQuestionAnswers = new ObjectsTemplate<EmpHRQuestionAnswer>();
|
|||
|
oHREmp.CreditCards = new ObjectsTemplate<EmpCreditCard>();
|
|||
|
_HREmployee = oHREmp;
|
|||
|
_HREmployee.Contacts = new ObjectsTemplate<EmpContact>();
|
|||
|
//if(_HREmployee.Contacts.Count>0)
|
|||
|
//{
|
|||
|
//_HREmployee.Contacts = new ObjectsTemplate<EmpContact>();
|
|||
|
//}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
//_HREmployee = oHREmp;
|
|||
|
//_HREmployee.Contacts = new ObjectsTemplate<EmpContact>();
|
|||
|
//_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("EmployeeID", nRow, "EmployeeID : " + oDr["EmployeeID"].ToString() + " Not found in the database"));
|
|||
|
//continue;
|
|||
|
//_HREmployee = new HREmployee();
|
|||
|
}
|
|||
|
nRow = nRow + 1;
|
|||
|
_HREmployee.PayrollTypeID = Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID;
|
|||
|
_HREmployee.EmployeeNo = oDr["EmployeeID"].ToString();
|
|||
|
_HREmployee.GlobalID = oDr["GEID"].ToString();
|
|||
|
_HREmployee.BirthPlace = oDr["Place Of Birth"].ToString();
|
|||
|
//_HREmployee.NickName = oDr["Nick Name"].ToString();
|
|||
|
_HREmployee.FirstName = oDr["First Name"].ToString();
|
|||
|
_HREmployee.MiddleName = oDr["Middle Name"].ToString();
|
|||
|
_HREmployee.LastName = oDr["Last Name"].ToString();
|
|||
|
_HREmployee.Name = _HREmployee.FirstName + " " + _HREmployee.MiddleName + " " + _HREmployee.LastName;
|
|||
|
_HREmployee.Gender = (oDr["Gender"].ToString().Trim().ToUpper().Trim() == "Male".ToUpper().Trim()) ? EnumGender.Male : EnumGender.Female;
|
|||
|
|
|||
|
|
|||
|
Religion oReligion = _Religions.Find(delegate(Religion oItem) { return oItem.Name.ToUpper().Trim() == oDr["Religion"].ToString().ToUpper().Trim(); });
|
|||
|
if (oReligion != null)
|
|||
|
_HREmployee.ReligionID = oReligion.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Religion", nRow, "Religion is not valid for employee from " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
|
|||
|
if (oDr["Blood Group"].ToString().ToUpper() == "B+".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.BPos;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "B-".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.BNeg;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "A+".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.APos;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "A-".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.ANeg;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "O+".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.OPos;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "O-".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.ONeg;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "AB+".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.ABPos;
|
|||
|
}
|
|||
|
else if (oDr["Blood Group"].ToString().ToUpper() == "AB-".ToUpper())
|
|||
|
{
|
|||
|
_HREmployee.BloodGroup = EnumBloodGroup.ABNeg;
|
|||
|
}
|
|||
|
|
|||
|
_HREmployee.PassportNo = oDr["Passport No"].ToString();
|
|||
|
|
|||
|
_HREmployee.PassportIssuePlace = oDr["Passport Issue Place"].ToString();
|
|||
|
|
|||
|
DateTime dTemPassIssueDate;
|
|||
|
if (DateTime.TryParse(oDr["Passport Issue Date"].ToString(), out dTemPassIssueDate))
|
|||
|
_HREmployee.PassportIssueDate = dTemPassIssueDate;//Convert.ToDateTime(oDr["Employed From Date"].ToString());
|
|||
|
else
|
|||
|
_HREmployee.PassportIssueDate = DateTime.MinValue;
|
|||
|
|
|||
|
DateTime dTemPassExpireDate;
|
|||
|
if (DateTime.TryParse(oDr["Passport Expire Date"].ToString(), out dTemPassExpireDate))
|
|||
|
_HREmployee.PassportExpDate = dTemPassExpireDate;//Convert.ToDateTime(oDr["Employed From Date"].ToString());
|
|||
|
else
|
|||
|
_HREmployee.PassportExpDate = DateTime.MinValue;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
_HREmployee.TinNo = oDr["Tax Identification No"].ToString();
|
|||
|
|
|||
|
Nationality oNationality = _Nationalites.Find(delegate(Nationality oItem) { return oItem.Description.ToUpper().Trim() == oDr["Nationality"].ToString().ToUpper().Trim(); });
|
|||
|
if (oNationality != null)
|
|||
|
_HREmployee.NationalityID = oNationality.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Nationality", nRow, "Nationality is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
_HREmployee.NationalID = oDr["National ID"].ToString();
|
|||
|
|
|||
|
DateTime dTemFDate;
|
|||
|
if (DateTime.TryParse(oDr["Joining Date"].ToString(), out dTemFDate))
|
|||
|
_HREmployee.JoiningDate = dTemFDate;//Convert.ToDateTime(oDr["Employed From Date"].ToString());
|
|||
|
else
|
|||
|
_HREmployee.JoiningDate = DateTime.MinValue;
|
|||
|
|
|||
|
//_HREmployee.JoiningDate = Convert.ToDateTime(oDr["Joining Date"]);
|
|||
|
DateTime dTemBDate;
|
|||
|
if (DateTime.TryParse(oDr["Birth Date"].ToString(), out dTemBDate))
|
|||
|
_HREmployee.BirthDate = dTemBDate;//Convert.ToDateTime(oDr["Date of Birth"]);
|
|||
|
else
|
|||
|
//_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Joining Date", nRow, "Please enter employee joining date " + oDTable.TableName + " Information."));
|
|||
|
_HREmployee.BirthDate = DateTime.MinValue;
|
|||
|
|
|||
|
|
|||
|
Category oCategory = _Categories.Find(delegate(Category oItem) { return oItem.Name.ToUpper().Trim() == oDr["Category"].ToString().ToUpper().Trim(); });
|
|||
|
if (oCategory != null)
|
|||
|
_HREmployee.CategoryID = oCategory.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Category", nRow, "Category is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
_HREmployee.DrivingLicenceNo = oDr["Driving Licence No"].ToString();
|
|||
|
_HREmployee.FatherName = oDr["Father's Name"].ToString();
|
|||
|
_HREmployee.MotherName = oDr["Mother's Name"].ToString();
|
|||
|
Occupation oFOccupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Father's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oFOccupation != null)
|
|||
|
_HREmployee.FatherOccupationID = oFOccupation.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Occupation", nRow, "Father occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
Occupation oMOccupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Mother's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oMOccupation != null)
|
|||
|
_HREmployee.MotherOccupationID = oMOccupation.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Occupation", nRow, "Mother occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
#region Employee Contact
|
|||
|
oEmpContact = new EmpContact();
|
|||
|
oEmpContact.ParmanentAddress = oDr["Permanent Address"].ToString();
|
|||
|
District oDisPar = _Districts.Find(delegate(District oItem) { return oItem.Name.ToUpper() == oDr["Permanent District"].ToString().ToUpper(); });
|
|||
|
oParmanentsThanas = Thana.GetByDistID(oDisPar.ID);
|
|||
|
if (oDisPar != null)
|
|||
|
oEmpContact.ParmanentDistrictID = oDisPar.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("District", nRow, "Permanent District is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
Thana oThanaPar = oParmanentsThanas.Find(delegate(Thana oItem) { return oItem.Name.ToUpper().Trim() == oDr["Permanent Thana"].ToString().ToUpper().Trim(); });
|
|||
|
if (oThanaPar != null)
|
|||
|
oEmpContact.ParmanentThanaID = oThanaPar.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Thana", nRow, "Permanent Thana is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpContact.ParmanentTelephone = oDr["Permanent Telephone No"].ToString();
|
|||
|
oEmpContact.ParmanentMobile = oDr["PerMobile No"].ToString();
|
|||
|
|
|||
|
oEmpContact.PresentAddress = oDr["Present Address"].ToString();
|
|||
|
|
|||
|
District oPerDis = _Districts.Find(delegate(District oItem) { return oItem.Name.ToUpper().Trim() == oDr["Present District"].ToString().ToUpper().Trim(); });
|
|||
|
oPresentThanas = Thana.GetByDistID(oPerDis.ID);
|
|||
|
if (oPerDis != null)
|
|||
|
oEmpContact.PresentDistrictID = oPerDis.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("District", nRow, "Present District is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
Thana oThanaPre = oPresentThanas.Find(delegate(Thana oItem) { return oItem.Name.ToUpper().Trim() == oDr["Present Thana"].ToString().ToUpper().Trim(); });
|
|||
|
if (oThanaPre != null)
|
|||
|
oEmpContact.PresentThanaID = oThanaPre.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Thana", nRow, "Present Thana is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpContact.PresentTelephone = oDr["Present Telephone No"].ToString();
|
|||
|
oEmpContact.PresentMobile = oDr["PreMobile No"].ToString();
|
|||
|
|
|||
|
oEmpContact.PersonalTelephone = oDr["Personal Land Phone No"].ToString();
|
|||
|
oEmpContact.Mobile = oDr["Personal Mobile No"].ToString();
|
|||
|
oEmpContact.PersonalEMail = oDr["Personal E-Mail"].ToString();
|
|||
|
oEmpContact.OfficalEMail = oDr["Official E-Mail"].ToString();
|
|||
|
oEmpContact.Fax = oDr["Fax"].ToString();
|
|||
|
|
|||
|
oEmpContact.EmergencyContactAddress = oDr["Emergency Contact Address"].ToString();
|
|||
|
oEmpContact.EmergencyContactPerson = oDr["Emergency Contact Person"].ToString();
|
|||
|
oEmpContact.EmergencyTelephone = oDr["Emergency Telephone No"].ToString();
|
|||
|
oEmpContact.EmergencyMobile = oDr["EmeMobile No"].ToString();
|
|||
|
|
|||
|
Relation oRel = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Relation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRel != null)
|
|||
|
oEmpContact.ContactPersonRelationId = oRel.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Relation", nRow, "Emergency Relation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
_HREmployee.Contacts.Add(oEmpContact);
|
|||
|
#endregion
|
|||
|
#region EmpSpouse
|
|||
|
oEmpSpouse = new EmpSpouse();
|
|||
|
oEmpSpouse.Name = oDr["Spouse Name"].ToString();
|
|||
|
if (oDr["Spouse Level of Education"].ToString() != string.Empty)
|
|||
|
{
|
|||
|
EducationLevel oEdLevel = _EducationLevels.Find(delegate(EducationLevel oItem) { return oItem.Description.ToUpper().Trim() == oDr["Spouse Level of Education"].ToString().ToUpper().Trim(); });
|
|||
|
if (oEdLevel != null)
|
|||
|
oEmpSpouse.EducationLevelID = oEdLevel.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Spouse Level of Education", nRow, "Spouse level of education is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oEmpSpouse.EducationLevelID = null;
|
|||
|
}
|
|||
|
|
|||
|
Occupation oOccup = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Spouse Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oOccup != null)
|
|||
|
oEmpSpouse.OccupationID = oOccup.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Spouse Occupation", nRow, "Spouse Occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
DateTime dDate;
|
|||
|
if (DateTime.TryParse(oDr["Date of Marriage"].ToString(), out dDate))
|
|||
|
oEmpSpouse.MarriageDate = dDate;//Convert.ToDateTime(oDr["Date of Birth"].ToString());
|
|||
|
else
|
|||
|
oEmpSpouse.MarriageDate = DateTime.MinValue;
|
|||
|
|
|||
|
_HREmployee.Spouses.Add(oEmpSpouse);
|
|||
|
#endregion
|
|||
|
#region Children
|
|||
|
oEmpChildren = new EmpChildren();
|
|||
|
oEmpChildren.Name = oDr["Child's Name"].ToString();
|
|||
|
oEmpChildren.Gender = (oDr["Child's Gender"].ToString().Trim() == "Male") ? EnumGender.Male : EnumGender.Female;
|
|||
|
DateTime dTemCBdate;
|
|||
|
if (DateTime.TryParse(oDr["Child's Date of Birth"].ToString(), out dTemCBdate))
|
|||
|
oEmpChildren.BirthDate = dTemCBdate;//Convert.ToDateTime(oDr["Child's Date of Birth"].ToString());
|
|||
|
else
|
|||
|
oEmpChildren.BirthDate = DateTime.MinValue;
|
|||
|
|
|||
|
Occupation oCCP = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Child's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oCCP != null)
|
|||
|
oEmpChildren.OccupationID = oCCP.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Child's Occupation", nRow, "Child's Occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
switch (oDr["Child's Marital Status"].ToString().Trim())
|
|||
|
{
|
|||
|
case "Married":
|
|||
|
oEmpChildren.MaritalStatus = EnumMaritalStatus.Married;
|
|||
|
break;
|
|||
|
case "UnMarried":
|
|||
|
oEmpChildren.MaritalStatus = EnumMaritalStatus.UnMarried;
|
|||
|
break;
|
|||
|
case "Divorced":
|
|||
|
oEmpChildren.MaritalStatus = EnumMaritalStatus.Divorced;
|
|||
|
break;
|
|||
|
case "Widow":
|
|||
|
oEmpChildren.MaritalStatus = EnumMaritalStatus.Widow;
|
|||
|
break;
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
_HREmployee.Childrens.Add(oEmpChildren);
|
|||
|
#endregion
|
|||
|
#region EmpExperience
|
|||
|
oEmpExperience = new EmpExperience();
|
|||
|
oEmpExperience.Employer = oDr["Employer"].ToString();
|
|||
|
oEmpExperience.ContactPerson = oDr["Contact Person"].ToString() != string.Empty ? oDr["Contact Person"].ToString() : "";
|
|||
|
oEmpExperience.Address = oDr["ConPer Address"].ToString();
|
|||
|
oEmpExperience.Telephone = oDr["ConPer Telephone No"].ToString() != string.Empty ? oDr["ConPer Telephone No"].ToString() : "";
|
|||
|
oEmpExperience.EmployerActivity = oDr["Industry/ Business Type"].ToString();
|
|||
|
oEmpExperience.Designation = oDr["ConPer Designation"].ToString();
|
|||
|
oEmpExperience.JobDescription = oDr["Role Description"].ToString() != string.Empty ? oDr["Role Description"].ToString() : "";
|
|||
|
|
|||
|
DateTime dFDate;
|
|||
|
if (DateTime.TryParse(oDr["Employed From Date"].ToString(), out dFDate))
|
|||
|
oEmpExperience.FromDate = dFDate;//Convert.ToDateTime(oDr["Employed From Date"].ToString());
|
|||
|
else
|
|||
|
oEmpExperience.FromDate = DateTime.MinValue;
|
|||
|
|
|||
|
DateTime dpDate;
|
|||
|
if (DateTime.TryParse(oDr["Employed To Date"].ToString(), out dpDate))
|
|||
|
oEmpExperience.ToDate = dpDate;
|
|||
|
else
|
|||
|
oEmpExperience.ToDate = DateTime.MinValue;
|
|||
|
_HREmployee.Experiences.Add(oEmpExperience);
|
|||
|
#endregion
|
|||
|
#region EmpTraining
|
|||
|
oEmpTraining = new EmpTraining();
|
|||
|
oEmpTraining.Name = oDr["Training Title"].ToString();
|
|||
|
TrainingType oTType = _TrainingTypes.Find(delegate(TrainingType oItem) { return oItem.Name.ToUpper().Trim() == oDr["Training Type"].ToString().ToUpper().Trim(); });
|
|||
|
if (oTType != null)
|
|||
|
oEmpTraining.TrainingTypeID = oTType.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Training Type", nRow, "Training Type is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
NatureOfTraining oNOFTraning = _NatureOfTrainings.Find(delegate(NatureOfTraining oItem) { return oItem.Name.ToUpper().Trim() == oDr["Nature of Training"].ToString().ToUpper().Trim(); });
|
|||
|
if (oNOFTraning != null)
|
|||
|
oEmpTraining.NatureOfTrainingID = oNOFTraning.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Nature of Training", nRow, "Nature of Training is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpTraining.Description = oDr["Training Description"].ToString();
|
|||
|
Institution oIns = _Institutions.Find(delegate(Institution oItem) { return oItem.Name.ToUpper().Trim() == oDr["Institution"].ToString().ToUpper().Trim(); });
|
|||
|
if (oIns != null)
|
|||
|
oEmpTraining.InstitutionID = oIns.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Institution", nRow, "Institution is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpTraining.Place = oDr["Training Place"].ToString();
|
|||
|
Country oCountry = _Contries.Find(delegate(Country oItem) { return oItem.Name.ToUpper().Trim() == oDr["Country"].ToString().ToUpper().Trim(); });
|
|||
|
if (oCountry != null)
|
|||
|
oEmpTraining.CountryID = oCountry.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Country", nRow, "Country is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpTraining.Achievement = oDr["Achievement"].ToString() != string.Empty ? oDr["Achievement"].ToString() : "";
|
|||
|
oEmpTraining.TrainingCompletedFrom = (oDr["Sponsor Type"].ToString().ToUpper().Trim() == "Own".ToUpper().Trim()) ? EnumTrainingCompletedFrom.Own : EnumTrainingCompletedFrom.Company;
|
|||
|
if (oDr["Training Fees"].ToString().Trim() != string.Empty)
|
|||
|
oEmpTraining.Fees = Convert.ToDouble(oDr["Training Fees"]);
|
|||
|
else
|
|||
|
oEmpTraining.Fees = 0.0;
|
|||
|
|
|||
|
if (oDr["Other Cost"].ToString().Trim() != string.Empty)
|
|||
|
oEmpTraining.OtherCost = Convert.ToDouble(oDr["Other Cost"]);
|
|||
|
else
|
|||
|
oEmpTraining.OtherCost = 0.0;
|
|||
|
|
|||
|
DateTime dTempFdate;
|
|||
|
if (DateTime.TryParse(oDr["Training From Date"].ToString(), out dTempFdate))
|
|||
|
oEmpTraining.FromDate = dTempFdate;//Convert.ToDateTime(oDr["From Date"]);
|
|||
|
else
|
|||
|
oEmpTraining.FromDate = DateTime.MinValue;
|
|||
|
|
|||
|
DateTime oTEmpDate;
|
|||
|
if (DateTime.TryParse(oDr["Training To Date"].ToString(), out oTEmpDate))
|
|||
|
oEmpTraining.ToDate = oTEmpDate;
|
|||
|
else
|
|||
|
oEmpTraining.ToDate = DateTime.MinValue;
|
|||
|
|
|||
|
_HREmployee.Trainings.Add(oEmpTraining);
|
|||
|
#endregion
|
|||
|
#region EmpAcademic
|
|||
|
oEmpAcademic = new EmpAcademic();
|
|||
|
EducationType oEDType = _EducationTypes.Find(delegate(EducationType oItem) { return oItem.Description.ToUpper().Trim() == oDr["Education Type"].ToString().ToUpper().Trim(); });
|
|||
|
if (oEDType != null)
|
|||
|
oEmpAcademic.EducationTypeID = oEDType.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Education Type", nRow, "Education Type is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
|
|||
|
EducationLevel oEducLevel = _EducationLevels.Find(delegate(EducationLevel oItem) { return oItem.Description.ToUpper().Trim() == oDr["Degree Title"].ToString().ToUpper().Trim(); });
|
|||
|
if (oEducLevel != null)
|
|||
|
oEmpAcademic.EducationLevelID = oEducLevel.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Degree Title", nRow, "Degree Title is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
|
|||
|
Discipline oDis = _Disciplines.Find(delegate(Discipline oItem) { return oItem.Description.ToUpper().Trim() == oDr["Discipline/ Department"].ToString().ToUpper().Trim(); });
|
|||
|
if (oDis != null)
|
|||
|
oEmpAcademic.DisciplineID = oDis.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Discipline/ Department", nRow, "Discipline/ Department is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
|
|||
|
Institution oInsti = _Institutions.Find(delegate(Institution oItem) { return oItem.Name.ToUpper().Trim() == oDr["Institution (Board/University)"].ToString().ToUpper().Trim(); });
|
|||
|
if (oInsti != null)
|
|||
|
oEmpAcademic.InstitutionID = oInsti.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Institution (Board/University)", nRow, "Institution (Board/University) is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEmpAcademic.InstituteName = oDr["Institution Name"].ToString();
|
|||
|
DateTime dExamdate = Convert.ToDateTime(oDr["Exam Held on"]);
|
|||
|
oEmpAcademic.ExamDate = dExamdate.Year;
|
|||
|
DateTime dPassingYear = Convert.ToDateTime(oDr["Passing Year"]);
|
|||
|
oEmpAcademic.PassingYear = dPassingYear.Year;
|
|||
|
|
|||
|
ResultType oRType = _ResultTypes.Find(delegate(ResultType oItem) { return oItem.Description.ToUpper().Trim() == oDr["EduResult"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRType != null)
|
|||
|
oEmpAcademic.ResultTypeID = oRType.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("EduResult", nRow, "Result is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
if (oDr["CGPA/ Marks"].ToString() != string.Empty || oDr["CGPA/ Marks"].ToString().Length > 0)
|
|||
|
oEmpAcademic.GPAOrMarks = Convert.ToDouble(oDr["CGPA/ Marks"]);
|
|||
|
oEmpAcademic.LastLevel = (oDr["Highest Education"].ToString().ToUpper().Trim() == "Yes".ToUpper().Trim()) ? true : false;
|
|||
|
|
|||
|
_HREmployee.Academics.Add(oEmpAcademic);
|
|||
|
#endregion
|
|||
|
#region EmpReference
|
|||
|
EmpReference oEmpReference = null;
|
|||
|
if (oDr["Referee's Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
oEmpReference = new EmpReference();
|
|||
|
oEmpReference.Name = oDr["Referee's Name"].ToString();
|
|||
|
Occupation oCcupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Referee's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oCcupation != null)
|
|||
|
{
|
|||
|
oEmpReference.OccupationID = oCcupation.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Referee's Occupation", nRow, "Referee's Occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
|
|||
|
Relation oRelation = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Relation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRelation != null)
|
|||
|
{
|
|||
|
oEmpReference.RelationID = oRelation.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Referee's Relation", nRow, "Relation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
oEmpReference.Address = oDr["Referee's Address"].ToString();
|
|||
|
oEmpReference.EmailAddress = oDr["Referee's E-mail Address"].ToString() != string.Empty ? oDr["Referee's E-mail Address"].ToString() : "";
|
|||
|
oEmpReference.Telephone = oDr["Referee's Telephone No(s)"].ToString() != string.Empty ? oDr["Referee's Telephone No(s)"].ToString() : "";
|
|||
|
oEmpReference.ReferenceMobile = oDr["Referee's Mobile No(s)"].ToString() != string.Empty ? oDr["Referee's Mobile No(s)"].ToString() : "";
|
|||
|
_HREmployee.References.Add(oEmpReference);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
#region EmpPublication
|
|||
|
EmpPublication oEmpPublication = null;
|
|||
|
if (oDr["Publication Title"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
oEmpPublication = new EmpPublication();
|
|||
|
oEmpPublication.Title = oDr["Publication Title"].ToString();
|
|||
|
oEmpPublication.PublicationType = oDr["Publication Type"].ToString();
|
|||
|
oEmpPublication.PublishersName = oDr["Publication Name"].ToString() != string.Empty ? oDr["Publication Name"].ToString() : "";
|
|||
|
oEmpPublication.Description = oDr["Publication Description"].ToString() != string.Empty ? oDr["Publication Description"].ToString() : "";
|
|||
|
oEmpPublication.Remarks = oDr["Publication Remarks"].ToString() != string.Empty ? oDr["Publication Remarks"].ToString() : "";
|
|||
|
DateTime dTempDate;
|
|||
|
|
|||
|
if (DateTime.TryParse(oDr["Date of Publication"].ToString(), out dTempDate))
|
|||
|
oEmpPublication.PublicationDate = dTempDate;//Convert.ToDateTime(oDr["Date of Publication"].ToString());
|
|||
|
else
|
|||
|
oEmpPublication.PublicationDate = DateTime.MinValue;
|
|||
|
_HREmployee.Publications.Add(oEmpPublication);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
#region EmpNomonee
|
|||
|
EmpNominee oEmpNominee = null;
|
|||
|
|
|||
|
if (oDr["Nomination Purpose"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
oEmpNominee = new EmpNominee();
|
|||
|
NominationPurpose oNominationPurpose = _NominationPurposes.Find(delegate(NominationPurpose oItem) { return oItem.Description.ToUpper().Trim() == oDr["Nomination Purpose"].ToString().ToUpper().Trim(); });
|
|||
|
|
|||
|
if (oNominationPurpose != null)
|
|||
|
{
|
|||
|
oEmpNominee.NominationPurposeID = oNominationPurpose.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Nomination Purpose", nRow, "Nomination Purpose is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
DateTime dTemDate;
|
|||
|
if (DateTime.TryParse(Convert.ToString(oDr["Date Of Nomination"]), out dTemDate))
|
|||
|
oEmpNominee.NominationDate = dTemDate;
|
|||
|
else
|
|||
|
oEmpNominee.NominationDate = DateTime.MinValue;
|
|||
|
|
|||
|
oEmpNominee.Name = oDr["Nominee's Name"].ToString();
|
|||
|
Relation oRelation = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Nominee's Relation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRelation != null)
|
|||
|
{
|
|||
|
oEmpNominee.RelationID = oRelation.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Nominee's Relation", nRow, "Relation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
oEmpNominee.Percentage = Convert.ToDouble(oDr["Nominee's Percentage"].ToString()) > 0 ? Convert.ToDouble(oDr["Nominee's Percentage"].ToString()) : 0.0;
|
|||
|
DateTime dtempDate;
|
|||
|
if (DateTime.TryParse(Convert.ToString(oDr["Nominee's Date of Birth"]), out dtempDate))
|
|||
|
oEmpNominee.BirthDate = dtempDate;//Convert.ToDateTime(oDr["Nominee's Date of Birth"]);
|
|||
|
else
|
|||
|
oEmpNominee.BirthDate = DateTime.MinValue;
|
|||
|
|
|||
|
Occupation oOCCupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Nominee's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oOCCupation != null)
|
|||
|
{
|
|||
|
oEmpNominee.OccupationID = oOCCupation.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Nominee's Occupation", nRow, "Nominee's Occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
|
|||
|
oEmpNominee.Address = oDr["Nominee's Address"].ToString();
|
|||
|
oEmpNominee.TelePhone = oDr["Nominee's Telephone No(s)"].ToString() != string.Empty ? oDr["Nominee's Telephone No(s)"].ToString() : "";
|
|||
|
oEmpNominee.EmailAddress = oDr["Nominee's E-mail Address"].ToString() != string.Empty ? oDr["Nominee's E-mail Address"].ToString() : "";
|
|||
|
_HREmployee.Nominees.Add(oEmpNominee);
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
#region Hospitalization
|
|||
|
EmpHospitalization oEmpHospitalization = null;
|
|||
|
|
|||
|
if (oDr["Registered Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
oEmpHospitalization = new EmpHospitalization();
|
|||
|
oEmpHospitalization.RegistrationDate = Convert.ToDateTime(oDr["Date Of Registration"].ToString());
|
|||
|
oEmpHospitalization.RegisteredPerson = oDr["Registered Name"].ToString();
|
|||
|
Relation oRelation = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Registered Person's Relation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRelation != null)
|
|||
|
{
|
|||
|
oEmpHospitalization.RelationId = oRelation.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Registered Person's Relation", nRow, "Relation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
DateTime dTEmpDate;
|
|||
|
if (DateTime.TryParse(oDr["Registered Person's Date of Birth"].ToString(), out dTEmpDate))
|
|||
|
oEmpHospitalization.BirthDate = dTEmpDate;//Convert.ToDateTime(oDr["Registered Person's Date of Birth"]);
|
|||
|
else
|
|||
|
oEmpHospitalization.BirthDate = DateTime.MinValue;
|
|||
|
|
|||
|
Occupation oOCCupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Registered Person's Occupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oOCCupation != null)
|
|||
|
{
|
|||
|
oEmpHospitalization.OccupationID = oOCCupation.ID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Registered Person's Occupation", nRow, "Registered Person's Occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
oEmpHospitalization.Email = oDr["Registered Person's Email"].ToString() != string.Empty ? oDr["Registered Person's Email"].ToString() : "";
|
|||
|
oEmpHospitalization.Address = oDr["Registered Person's Address"].ToString();
|
|||
|
oEmpHospitalization.Telephone = oDr["Registered Person's Telephone No(s)"].ToString() != string.Empty ? oDr["Registered Person's Telephone No(s)"].ToString() : "";
|
|||
|
oEmpHospitalization.Mobile = oDr["Registered Person's Mobile No (s)"].ToString() != string.Empty ? oDr["Registered Person's Mobile No (s)"].ToString() : "";
|
|||
|
_HREmployee.Hospitalizations.Add(oEmpHospitalization);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
#region EmpLanguage
|
|||
|
EmpLanguage oEmpLanguage = null;
|
|||
|
|
|||
|
if (oDr["LanguageName"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
oEmpLanguage = new EmpLanguage();
|
|||
|
oEmpLanguage.LanguageName = oDr["LanguageName"].ToString();
|
|||
|
if (oDr["SpokenStatus"].ToString().ToUpper().Trim() == "Basic".ToUpper().Trim())
|
|||
|
{
|
|||
|
oEmpLanguage.SpokenStatus = EnumLanguageEfficiency.Basic;
|
|||
|
}
|
|||
|
else if (oDr["SpokenStatus"].ToString().ToUpper().Trim() == "Intermideate".ToUpper().Trim())
|
|||
|
{
|
|||
|
oEmpLanguage.SpokenStatus = EnumLanguageEfficiency.Intermideate;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oEmpLanguage.SpokenStatus = EnumLanguageEfficiency.Advanced;
|
|||
|
}
|
|||
|
|
|||
|
if (oDr["WrittenStatus"].ToString().ToUpper().Trim() == "Basic".ToUpper().Trim())
|
|||
|
{
|
|||
|
oEmpLanguage.WrittenStatus = EnumLanguageEfficiency.Basic;
|
|||
|
}
|
|||
|
else if (oDr["WrittenStatus"].ToString().ToUpper().Trim() == "Intermideate".ToUpper().Trim())
|
|||
|
{
|
|||
|
oEmpLanguage.WrittenStatus = EnumLanguageEfficiency.Intermideate;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oEmpLanguage.WrittenStatus = EnumLanguageEfficiency.Advanced;
|
|||
|
}
|
|||
|
_HREmployee.EmpLanguages.Add(oEmpLanguage);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
#region EmpRelative
|
|||
|
EmpRelative oEmpRelative = null;
|
|||
|
|
|||
|
if (oDr["Relative Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
oEmpRelative = new EmpRelative();
|
|||
|
oEmpRelative.Name = oDr["Relative Name"].ToString();
|
|||
|
oEmpRelative.Designation = oDr["Relative Designation"].ToString();
|
|||
|
oEmpRelative.EmpNo = oDr["EmployeeID"].ToString();
|
|||
|
Relation oRelation = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["Relative's Relation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRelation != null)
|
|||
|
oEmpRelative.RelationID = oRelation.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Relative's Relation", nRow, "Relation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
DateTime dTempJDate;
|
|||
|
if (DateTime.TryParse(oDr["Relative's JoiningDate"].ToString(), out dTempJDate))
|
|||
|
oEmpRelative.JoiningDate = dTempJDate;//Convert.ToDateTime(oDr["JoiningDate"]);
|
|||
|
else
|
|||
|
oEmpRelative.JoiningDate = DateTime.MinValue;
|
|||
|
|
|||
|
DateTime dTempDate;
|
|||
|
if (DateTime.TryParse(oDr["Relative's EndDate"].ToString(), out dTempDate))
|
|||
|
oEmpRelative.EndDate = dTempDate;//Convert.ToDateTime(oDr["EndDate"]);
|
|||
|
else
|
|||
|
oEmpRelative.EndDate = DateTime.MinValue;
|
|||
|
|
|||
|
_HREmployee.EmpRelatives.Add(oEmpRelative);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
#region EmpRelation
|
|||
|
EmpRelation oEmpRelation = null;
|
|||
|
|
|||
|
if (oDr["IRName"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
oEmpRelation = new EmpRelation();
|
|||
|
oEmpRelation.Name = oDr["IRName"].ToString();
|
|||
|
Relation oRelation = _Relations.Find(delegate(Relation oItem) { return oItem.Description.ToUpper().Trim() == oDr["IRRelation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oRelation != null)
|
|||
|
oEmpRelation.RelationID = oRelation.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("IRRelation", nRow, "Relation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
Occupation oCCupation = _Occupations.Find(delegate(Occupation oItem) { return oItem.Description.ToUpper().Trim() == oDr["IROccupation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oCCupation != null)
|
|||
|
oEmpRelation.OccupationID = oCCupation.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("IROccupation", nRow, "Occupation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
_HREmployee.EmpRelations.Add(oEmpRelation);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
#region EmpMembership
|
|||
|
EmpMembership oEmpMembership = null;
|
|||
|
if (oDr["Membership Organization"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
oEmpMembership = new EmpMembership();
|
|||
|
oEmpMembership.Organization = oDr["Membership Organization"].ToString();
|
|||
|
oEmpMembership.Activity = oDr["YourRole"].ToString();
|
|||
|
|
|||
|
switch (oDr["OrganizationType"].ToString().Trim())
|
|||
|
{
|
|||
|
case "Academic":
|
|||
|
oEmpMembership.OrganizationType = EnumOrganizationType.Academic;
|
|||
|
break;
|
|||
|
case "Charitable":
|
|||
|
oEmpMembership.OrganizationType = EnumOrganizationType.Charitable;
|
|||
|
break;
|
|||
|
case "Professional":
|
|||
|
oEmpMembership.OrganizationType = EnumOrganizationType.Professional;
|
|||
|
break;
|
|||
|
case "Social":
|
|||
|
oEmpMembership.OrganizationType = EnumOrganizationType.Social;
|
|||
|
break;
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
DateTime dDateF;
|
|||
|
if (DateTime.TryParse(oDr["Membership FromDate"].ToString(), out dDateF))
|
|||
|
oEmpMembership.FromDate = dDateF;
|
|||
|
else
|
|||
|
oEmpMembership.FromDate = DateTime.MinValue;
|
|||
|
|
|||
|
DateTime dDateP;
|
|||
|
if (DateTime.TryParse(oDr["Membership EndDate"].ToString(), out dDateP))
|
|||
|
oEmpMembership.EndDate = dDateP;//Convert.ToDateTime(oDr["EndDate"]);
|
|||
|
else
|
|||
|
oEmpMembership.EndDate = DateTime.MinValue;
|
|||
|
|
|||
|
_HREmployee.EmpMemberships.Add(oEmpMembership);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
#region EmpCuestion
|
|||
|
|
|||
|
EmpHRQuestionAnswer oEmpHRQuestionAnswer = null;
|
|||
|
|
|||
|
if (oDr["QuestionNo"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
oEmpHRQuestionAnswer = new EmpHRQuestionAnswer();
|
|||
|
HRJoiningQuestionary oHRJQuestion = _HRJoiningQuestionaries.Find(delegate(HRJoiningQuestionary oItem) { return oItem.Description.ToUpper().Trim() == oDr["Question"].ToString().ToUpper().Trim(); });
|
|||
|
if (oHRJQuestion != null)
|
|||
|
{
|
|||
|
oEmpHRQuestionAnswer.QuestionNo = oDr["QuestionNo"].ToString();
|
|||
|
oEmpHRQuestionAnswer.QuestionaryID = oHRJQuestion.ID;
|
|||
|
oEmpHRQuestionAnswer.QAnswer = oDr["QAnswer"].ToString();
|
|||
|
oEmpHRQuestionAnswer.QuestionDes = oDr["Question"].ToString();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Question", nRow, "Question is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
}
|
|||
|
_HREmployee.EmpHRQuestionAnswers.Add(oEmpHRQuestionAnswer);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
_HREmployees.Add(_HREmployee);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return _HREmployees;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Import CV Data
|
|||
|
public CV ImportCVMainData(DataTable oDTable)
|
|||
|
{
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
if (_errorOrSuccessList == null)
|
|||
|
_errorOrSuccessList = new List<UploadErrorOrSuccess>();
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["TrackNo"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
_CV.TrackNo = oDr["Name"].ToString();
|
|||
|
_CV.TotalYearOfExperience = Convert.ToDouble(oDr["TotalYearOfExperience"]);
|
|||
|
_CV.SpecialSkill = oDr["SpecialSkill"].ToString();
|
|||
|
_CV.NationalId = oDr["NationalId"].ToString();
|
|||
|
_CV.Name = oDr["Name"].ToString();
|
|||
|
_CV.MotherName = oDr["MotherName"].ToString();
|
|||
|
_CV.MobileNo = oDr["MobileNo"].ToString();
|
|||
|
_CV.FatherName = oDr["FatherName"].ToString();
|
|||
|
_CV.ExpectedMinimumSalary = Convert.ToDouble(oDr["ExpectedMinimumSalary"]);
|
|||
|
_CV.LandPhoneNo = oDr["LandPhoneNo"].ToString();
|
|||
|
|
|||
|
_CV.EmailAddress = oDr["EmailAddress"].ToString();
|
|||
|
_CV.IsFresher = oDr["IsFresher"].ToString().ToUpper().Trim() == "Yes".ToString().ToUpper().Trim() ? true : false;
|
|||
|
_CV.ContactAddress = oDr["ContactAddress"].ToString();
|
|||
|
|
|||
|
DateTime dAppDate;
|
|||
|
if (DateTime.TryParse(oDr["ApplicationDate"].ToString(), out dAppDate))
|
|||
|
_CV.ApplicationDate = dAppDate;//Convert.ToDateTime(oDr["Employed From Date"].ToString());
|
|||
|
else
|
|||
|
_CV.ApplicationDate = DateTime.MinValue;
|
|||
|
|
|||
|
Designation oDesig = _Designations.Find(delegate(Designation oItem) { return oItem.Name.ToUpper().Trim() == oDr["Designation"].ToString().ToUpper().Trim(); });
|
|||
|
if (oDesig != null)
|
|||
|
_CV.Designation = oDesig.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Designation", nRow, "Designation is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _CV;
|
|||
|
}
|
|||
|
|
|||
|
public ObjectsTemplate<Experience> ImportCVExperienceData(DataTable oDTable)
|
|||
|
{
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
if (_errorOrSuccessList == null)
|
|||
|
_errorOrSuccessList = new List<UploadErrorOrSuccess>();
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["ContactNo"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
Experience oExperience = new Experience();
|
|||
|
nRow = nRow + 1;
|
|||
|
oExperience.ContactNo = oDr["ContactNo"].ToString();
|
|||
|
oExperience.ContactPerson = oDr["ContactPerson"].ToString();
|
|||
|
oExperience.Employer = oDr["Employer"].ToString();
|
|||
|
oExperience.RoleDefination = oDr["RoleDefination"].ToString();
|
|||
|
|
|||
|
DateTime dFDate;
|
|||
|
if (DateTime.TryParse(oDr["FromDate"].ToString(), out dFDate))
|
|||
|
oExperience.FromDate = dFDate;
|
|||
|
else
|
|||
|
oExperience.FromDate = DateTime.MinValue;
|
|||
|
|
|||
|
DateTime dTDate;
|
|||
|
if (DateTime.TryParse(oDr["ToDate"].ToString(), out dTDate))
|
|||
|
oExperience.ToDate = dTDate;
|
|||
|
else
|
|||
|
oExperience.ToDate = DateTime.MinValue;
|
|||
|
|
|||
|
//oExperience.RoleDefination = oDr["RoleDefination"].ToString();
|
|||
|
|
|||
|
_CV.AllExperiences.Add(oExperience);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _CV.AllExperiences;
|
|||
|
}
|
|||
|
|
|||
|
public ObjectsTemplate<ReferredBy> ImportCVReferredByData(DataTable oDTable)
|
|||
|
{
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
if (_errorOrSuccessList == null)
|
|||
|
_errorOrSuccessList = new List<UploadErrorOrSuccess>();
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Name"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
ReferredBy oReferredBy = new ReferredBy();
|
|||
|
nRow = nRow + 1;
|
|||
|
oReferredBy.Name = oDr["Name"].ToString();
|
|||
|
oReferredBy.OtherDetail = oDr["OtherDetail"].ToString();
|
|||
|
if (oDr["ReferredBy"].ToString() == "CompanyEmployee")
|
|||
|
{
|
|||
|
oReferredBy.ReferredBY = EnumReferredBy.CompanyEmployee;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oReferredBy.ReferredBY = EnumReferredBy.Other;
|
|||
|
}
|
|||
|
|
|||
|
oReferredBy.EmployeeNo = oDr["EmployeeNo"].ToString();
|
|||
|
_CV.AllReferences.Add(oReferredBy);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _CV.AllReferences;
|
|||
|
}
|
|||
|
|
|||
|
public ObjectsTemplate<EductionalQualification> ImportCVEductionalQualificationData(DataTable oDTable)
|
|||
|
{
|
|||
|
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
if (_errorOrSuccessList == null)
|
|||
|
_errorOrSuccessList = new List<UploadErrorOrSuccess>();
|
|||
|
foreach (DataRow oDr in oDTable.Rows)
|
|||
|
{
|
|||
|
if (oDr["Board"].ToString().Trim() != string.Empty)
|
|||
|
{
|
|||
|
EductionalQualification oEductionalQualification = new EductionalQualification();
|
|||
|
nRow = nRow + 1;
|
|||
|
|
|||
|
Institution oBoard = _Institutions.Find(delegate(Institution oItem) { return oItem.Name.ToUpper() == oDr["Board"].ToString().ToUpper(); });
|
|||
|
if (oBoard != null)
|
|||
|
oEductionalQualification.BoardId = oBoard.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Board", nRow, "Board is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
oEductionalQualification.InstituteName = oDr["InstituteName"].ToString();
|
|||
|
oEductionalQualification.IsHighestEducation = oDr["IsHighestEducation"].ToString().ToUpper().Trim() == "Yes".ToString().ToUpper().Trim() ? true : false;
|
|||
|
oEductionalQualification.Name = oDr["InstituteName"].ToString();
|
|||
|
|
|||
|
ResultType oResult = _ResultTypes.Find(delegate(ResultType oItem) { return oItem.Description.ToUpper().Trim() == oDr["Result"].ToString().ToUpper().Trim(); });
|
|||
|
if (oResult != null)
|
|||
|
oEductionalQualification.ResultID = oResult.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Result", nRow, "Result is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
|
|||
|
EducationLevel oEducLevel = _EducationLevels.Find(delegate(EducationLevel oItem) { return oItem.Description.ToUpper().Trim() == oDr["DegreeTitle"].ToString().ToUpper().Trim(); });
|
|||
|
if (oEducLevel != null)
|
|||
|
oEductionalQualification.DegreeTitleId = oEducLevel.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Degree Title", nRow, "Degree Title is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
|
|||
|
Discipline oDis = _Disciplines.Find(delegate(Discipline oItem) { return oItem.Description.ToUpper().Trim() == oDr["Discipline"].ToString().ToUpper().Trim(); });
|
|||
|
if (oDis != null)
|
|||
|
oEductionalQualification.DisciplineId = oDis.ID;
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Discipline/ Department", nRow, "Discipline/ Department is not valid for employee " + oDTable.TableName + " Information."));
|
|||
|
|
|||
|
|
|||
|
//int dPassingYear = Convert.ToInt32(oDr["PassingYear"]);
|
|||
|
|
|||
|
oEductionalQualification.PassingYear = Convert.ToInt32(oDr["PassingYear"]);
|
|||
|
oEductionalQualification.CgpaOrMarks = Convert.ToDouble(oDr["CgpaOrMarks"].ToString());
|
|||
|
oEductionalQualification.CgpaOrMarksOutOf = Convert.ToDouble(oDr["CgpaOrMarksOutOf"].ToString());
|
|||
|
_CV.AllEduQualifications.Add(oEductionalQualification);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
return _CV.AllEduQualifications;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save Methods
|
|||
|
|
|||
|
#region Save Employee Basic Information
|
|||
|
public void SaveEmpBasicInformation()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
_basicwithEmployee.Save();
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
public void SaveEmpBasicInformation2()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
|
|||
|
foreach (Employee item in _employees)
|
|||
|
{
|
|||
|
item.PayrollTypeID = SystemInformation.CurrentSysInfo.PayrollTypeID;
|
|||
|
}
|
|||
|
|
|||
|
RegularDataUpload.Save(_categorys, _grades, _departments, _locations, _religions,
|
|||
|
_designations, _banks, _branches, _employees, _accessCards);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#region Save Employee Email Address
|
|||
|
public void SaveShortInfo()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
new Employee().SaveShortInfo(_TempEmployees);
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save Employee Individual Allowance
|
|||
|
public void SaveEmpIndividualAllowance()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (ADParameterEmployee item in oadparamemployees)
|
|||
|
{
|
|||
|
item.Save();
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save Employee Individual Allowance
|
|||
|
public void SaveChildEduAllowance()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
new ChildrenEducation().Save(ChildrenEducations, oAdparameterEmployees);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save WPPFClaim
|
|||
|
public void SaveWPPFClaim(DataTable dt)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
new SalaryMonthly().WPPFClaimSave(dt);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save WPPF
|
|||
|
public void SaveWPPF(DataTable dt)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
new SalaryMonthly().WPPFSave(dt);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save WWF
|
|||
|
public void SaveWWF(DataTable dt)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
new SalaryMonthly().WWFSave(dt);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save UnAuthorized Leave
|
|||
|
public void SaveUnAuthorizedLeave()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
EmployeeUnAuthorizeLeave.Save(_empUnAuthoLeaves);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save Employee OverTime Data
|
|||
|
public void SaveEmployeeOverTime()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
EmployeeOverTime.Save(_EmployeeOverTimes);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save Employee Individual Deduction
|
|||
|
public void SaveEmpIndividualDeduction()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (ADParameterEmployee item in oadparamemployees)
|
|||
|
{
|
|||
|
item.Save();
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save Employee Grade Salary Assignment
|
|||
|
public void SaveEmpGradeSalaryAssignment()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
ObjectsTemplate<HREmployee> hrEmps = HREmployee.Get();
|
|||
|
ObjectsTemplate<EmpLifeCycle> ocyclies = new ObjectsTemplate<EmpLifeCycle>();
|
|||
|
foreach (EmployeeGradeSalary oGradeSalary in oempgradesalarys)
|
|||
|
{
|
|||
|
ID nID = oGradeSalary.EmpLifeCycle.StatusDetailID;
|
|||
|
EnumEmployeeStatus eStatus = oGradeSalary.EmpLifeCycle.Status;
|
|||
|
string sDescription = oGradeSalary.EmpLifeCycle.Description;
|
|||
|
oGradeSalary.EmpLifeCycle.EmployeeGradeSalary = oGradeSalary;
|
|||
|
oGradeSalary.EmpLifeCycle.HREmployee = hrEmps.Find(delegate(HREmployee emp) { return emp.ID.Integer == oGradeSalary.EmployeeID.Integer; });
|
|||
|
oGradeSalary.EmpLifeCycle.HREmployee.GrossSalary = oGradeSalary.GrossSalary;
|
|||
|
oGradeSalary.EmpLifeCycle.HREmployee.BasicSalary = oGradeSalary.BasicSalary;
|
|||
|
oGradeSalary.EmpLifeCycle.HREmployee.GradeID = oGradeSalary.GradeID;
|
|||
|
ocyclies.Add(oGradeSalary.EmpLifeCycle);
|
|||
|
}
|
|||
|
EmpLifeCycle lifeCycle = new EmpLifeCycle();
|
|||
|
lifeCycle.Save(ocyclies);
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save Employee Bank Account
|
|||
|
public void SaveEmpBankAccount()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (EmployeeBankAccount oBankAccount in oempbankaccounts)
|
|||
|
{
|
|||
|
oBankAccount.Save();
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save Employee CC Data
|
|||
|
public void SaveEmpCCData()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
EmployeeCostCenter oEmpCC = new EmployeeCostCenter();
|
|||
|
oEmpCC.Save(oempCostCenters);
|
|||
|
//foreach (EmployeeCostCenter oEmpCC in oempCostCenters)
|
|||
|
//{
|
|||
|
// oEmpCC.Save();
|
|||
|
//}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save SavePFOpeningData
|
|||
|
public void SavePFOpeningData()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
new PFTransaction().SaveAll(_PFTransactions);
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save Employee Vendor Code
|
|||
|
public void SaveEmpVendorCode()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (Employee oEmp in _TempEmployees)
|
|||
|
{
|
|||
|
oEmp.SaveBasicInfo(oEmp);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
#region Save Loan Information
|
|||
|
public void SaveLoanInformation()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (LoanIssue loanissue in loanissues)
|
|||
|
{
|
|||
|
loanissue.Save();
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion]
|
|||
|
|
|||
|
#region Save Bonus Data
|
|||
|
public void SaveBonusInformation()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
_BonusProcess.BulkSave();
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save Organogram Position
|
|||
|
public void SaveOrganPosition()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
OrganogramEmployee.SaveEmp(_organEmps);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
public void SaveLoanInformationSetup()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (LoanSchedule loansch in loanschs)
|
|||
|
{
|
|||
|
loansch.Save();
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#region SalaryComponentData
|
|||
|
public void SaveSalaryComponent()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
|
|||
|
SalaryMonthly ob = new SalaryMonthly();
|
|||
|
ob.UpdateSalaryDetail(_salaryDetails, _incomeTaxes);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save For Basic Upload
|
|||
|
public static void Save(ObjectsTemplate<Category> categorys, ObjectsTemplate<Grade> grades, ObjectsTemplate<Department> departments, ObjectsTemplate<Location> locations,
|
|||
|
ObjectsTemplate<Religion> religions, ObjectsTemplate<Designation> designations, ObjectsTemplate<Bank> banks, ObjectsTemplate<Branch> branches, ObjectsTemplate<Employee> employees, ObjectsTemplate<AccessCard> accessCards)
|
|||
|
{
|
|||
|
RegularDataUpload.Service.Save(categorys, grades, departments, locations, religions, designations, banks, branches, employees, accessCards);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save Employee Tax Data
|
|||
|
public void SaveEmpTaxData(ObjectsTemplate<IncomeTax> oIncomeTaxs, EnumIncomeTaxDataFrom ITDType)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
IncomeTax.Save(oIncomeTaxs, ITDType);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save Tax Investment Data
|
|||
|
public void SaveITInvestmentData(ObjectsTemplate<EmployeeTaxInvestment> oEmpTaxInvestments)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (EmployeeTaxInvestment oItem in oEmpTaxInvestments)
|
|||
|
{
|
|||
|
oItem.Save();
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save Tax Challan Data
|
|||
|
public void SaveITChallanData(ObjectsTemplate<TaxChallan> oTaxChallans)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (TaxChallan oItem in oTaxChallans)
|
|||
|
{
|
|||
|
oItem.Save();
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save All HR Employee Data
|
|||
|
public void SaveAllHREmpData(ObjectsTemplate<HREmployee> oEmployees)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (HREmployee oItem in oEmployees)
|
|||
|
{
|
|||
|
oItem.Save(null);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void SaveHREmpContactData(ObjectsTemplate<EmpContact> oEmpContacts)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
HREmployee.SaveMultipleEmployeeContacts(oEmpContacts);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Save All OPI Param Individual
|
|||
|
|
|||
|
private void SaveAllOPIParamIndividual()
|
|||
|
{
|
|||
|
//OpiParameterIndividual.
|
|||
|
try
|
|||
|
{
|
|||
|
OpiParameterIndividual.BulkSave(_oPIParameterIndividual);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
private void SaveAllCarFuelParamIndividual()
|
|||
|
{
|
|||
|
//OpiParameterIndividual.
|
|||
|
try
|
|||
|
{
|
|||
|
CarFuelParameterIndividual.BulkSave(_CarFuelParameterIndividual);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region OPI Data
|
|||
|
public void SaveOPIData()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
|
|||
|
OPIProcess ob = new OPIProcess();
|
|||
|
ob.UpdateOPIDetail(_oPIProcessDetailItem);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Basic Data Upload
|
|||
|
public void RefreshObject()
|
|||
|
{
|
|||
|
|
|||
|
_departments = Department.Get();
|
|||
|
int maxID = 0;
|
|||
|
if (_departments.Count > 0)
|
|||
|
{
|
|||
|
maxID = (from detail in _departments
|
|||
|
select detail.ID.Integer).Max();
|
|||
|
_departmentid = maxID;
|
|||
|
}
|
|||
|
|
|||
|
_categorys = Category.Get(EnumStatus.Regardless);
|
|||
|
if (_categorys.Count > 0)
|
|||
|
{
|
|||
|
maxID = (from detail in _categorys
|
|||
|
select detail.ID.Integer).Max();
|
|||
|
_categoryID = maxID;
|
|||
|
}
|
|||
|
|
|||
|
_grades = Grade.GetRegardlessPayrollType(EnumStatus.Regardless);
|
|||
|
if (_grades.Count > 0)
|
|||
|
{
|
|||
|
maxID = (from detail in _grades
|
|||
|
select detail.ID.Integer).Max();
|
|||
|
_gradeid = maxID;
|
|||
|
}
|
|||
|
// _grades = new ObjectsTemplate<Grade>();
|
|||
|
|
|||
|
_locations = Location.Get();
|
|||
|
if (_locations.Count > 0)
|
|||
|
{
|
|||
|
maxID = (from detail in _locations
|
|||
|
select detail.ID.Integer).Max();
|
|||
|
_locationid = maxID;
|
|||
|
}
|
|||
|
|
|||
|
_religions = Religion.Get(EnumStatus.Regardless);
|
|||
|
if (_religions.Count > 0)
|
|||
|
{
|
|||
|
maxID = (from detail in _religions
|
|||
|
select detail.ID.Integer).Max();
|
|||
|
_religionID = maxID;
|
|||
|
}
|
|||
|
|
|||
|
_designations = Designation.Get(EnumStatus.Regardless);
|
|||
|
if (_designations.Count > 0)
|
|||
|
{
|
|||
|
maxID = (from detail in _designations
|
|||
|
select detail.ID.Integer).Max();
|
|||
|
_designationid = maxID;
|
|||
|
}
|
|||
|
|
|||
|
_banks = Bank.Get(EnumStatus.Regardless);
|
|||
|
if (_banks.Count > 0)
|
|||
|
{
|
|||
|
maxID = (from detail in _banks
|
|||
|
select detail.ID.Integer).Max();
|
|||
|
_bankid = maxID;
|
|||
|
}
|
|||
|
_branches = Branch.Get(EnumStatus.Regardless);
|
|||
|
if (_branches.Count > 0)
|
|||
|
{
|
|||
|
maxID = (from detail in _branches
|
|||
|
select detail.ID.Integer).Max();
|
|||
|
_branchid = maxID;
|
|||
|
}
|
|||
|
SearchManager omanager = new SearchManager(EnumSearchFrom.Employee);
|
|||
|
omanager.Parameter.Remove(EnumSearchParameter.PayrollTypeID);
|
|||
|
ObjectsTemplate<SearchEmployee> oemployees = omanager.Find();
|
|||
|
if (oemployees.Count > 0)
|
|||
|
{
|
|||
|
maxID = (from detail in oemployees
|
|||
|
select detail.EmployeeID.Integer).Max();
|
|||
|
_emloyeeId = maxID;
|
|||
|
}
|
|||
|
_accessCards = AccessCard.Get();
|
|||
|
if (_accessCards.Count > 0)
|
|||
|
{
|
|||
|
maxID = (from detail in _accessCards
|
|||
|
select detail.ID.Integer).Max();
|
|||
|
_accessCardID = maxID;
|
|||
|
}
|
|||
|
_accessCards = new ObjectsTemplate<AccessCard>();
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public bool ProcessBasicData(DataTable uploadTable)
|
|||
|
{
|
|||
|
GlobalFunctions.SetProgressbarMaxValue = uploadTable.Rows.Count;
|
|||
|
GlobalFunctions.TotalRocordCount = uploadTable.Rows.Count;
|
|||
|
UpdateprocessStatus("Checking & Creating Basic Data");
|
|||
|
UpdateProgressStatus(EnumProcessStatus.Start);
|
|||
|
bool CodeautoGenerate = false;
|
|||
|
|
|||
|
RefreshObject();
|
|||
|
|
|||
|
ConfigurationManager ocManager = new ConfigurationManager();
|
|||
|
ObjectsTemplate<Configaration> deptConfig = ocManager.GetChilds("department", EnumConfigurationType.Logic);
|
|||
|
ObjectsTemplate<Configaration> deptTiers = ocManager.GetChilds(deptConfig, "tiernames");
|
|||
|
|
|||
|
ObjectsTemplate<Configaration> locConfig = ocManager.GetChilds("location", EnumConfigurationType.Logic);
|
|||
|
ObjectsTemplate<Configaration> locTiers = ocManager.GetChilds(locConfig, "tiernames");
|
|||
|
Employee oemployee = new Employee();
|
|||
|
int nRow = 0;
|
|||
|
int nIndex = 0;
|
|||
|
int count = 0;
|
|||
|
foreach (DataRow row in uploadTable.Rows)
|
|||
|
{
|
|||
|
UpdateProgressStatus(EnumProcessStatus.PerformStep);
|
|||
|
Application.DoEvents();
|
|||
|
_emloyeeId = _emloyeeId + 1;
|
|||
|
count++;
|
|||
|
oemployee = new Employee();
|
|||
|
oemployee.EmployeeNo = row["Employee Code"].ToString();
|
|||
|
oemployee.SetObjectID(_emloyeeId + 1);
|
|||
|
object[] obj = row.ItemArray;
|
|||
|
nRow = nRow + 1;
|
|||
|
//uploadStatus.Text = string.Format("Processing Basic Data... {0}/{1}", index, uploadTable.Rows.Count);
|
|||
|
//uploadStatus.Refresh();
|
|||
|
/// <summary>
|
|||
|
/// Process category whether it is already in the system or new category
|
|||
|
/// </summary>
|
|||
|
#region Category upload
|
|||
|
Category oCategory = null;
|
|||
|
CodeautoGenerate = ConfigurationManager.GetBoolValue("category", "codeautogenerate", EnumConfigurationType.Logic);
|
|||
|
if (CodeautoGenerate == false)
|
|||
|
oCategory = _categorys.Find(delegate(Category item) { return item.Code == row["Category Code"].ToString(); });
|
|||
|
else
|
|||
|
oCategory = _categorys.Find(delegate(Category item) { return item.Name == row["Category Name"].ToString(); });
|
|||
|
|
|||
|
if (oCategory == null)
|
|||
|
{
|
|||
|
oCategory = new Category();
|
|||
|
oCategory.Name = row["Category Name"].ToString();
|
|||
|
oCategory.Status = EnumStatus.Active;
|
|||
|
if (CodeautoGenerate == false)
|
|||
|
oCategory.Code = row["Category Code"].ToString();
|
|||
|
_categoryID = _categoryID + 1;
|
|||
|
oemployee.CategoryID = ID.FromInteger(_categoryID);
|
|||
|
oCategory.SetObjectID(_categoryID);
|
|||
|
_categorys.Add(oCategory);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oemployee.CategoryID = oCategory.ID;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#endregion Category upload
|
|||
|
/// <summary>
|
|||
|
/// Process grade whether it is already in the system or new grade
|
|||
|
/// </summary>
|
|||
|
///
|
|||
|
#region Grade upload
|
|||
|
Grade ograde = null;
|
|||
|
CodeautoGenerate = ConfigurationManager.GetBoolValue("grade", "codeautogenerate", EnumConfigurationType.Logic);
|
|||
|
if (CodeautoGenerate == false)
|
|||
|
ograde = _grades.Find(delegate(Grade item) { return item.Code == row["Grade Code"].ToString(); });
|
|||
|
else
|
|||
|
ograde = _grades.Find(delegate(Grade item) { return item.Name == row["Grade Name"].ToString(); });
|
|||
|
|
|||
|
if (ograde == null)
|
|||
|
{
|
|||
|
ograde = new Grade();
|
|||
|
ograde.Status = EnumStatus.Active;
|
|||
|
|
|||
|
ograde.GradeSegmentID = ID.FromInteger(1);
|
|||
|
ograde.HasPayscale = ConfigurationManager.GetBoolValue("grade", "payscaleapplicable ", EnumConfigurationType.Logic);
|
|||
|
ograde.HasGrossConcept = ConfigurationManager.GetBoolValue("grade", "grossapplicable", EnumConfigurationType.Logic);
|
|||
|
ograde.Name = row["Grade Name"].ToString().Trim();
|
|||
|
if (CodeautoGenerate == false)
|
|||
|
ograde.Code = row["Grade Code"].ToString().Trim();
|
|||
|
_gradeid = _gradeid + 1;
|
|||
|
oemployee.GradeID = ID.FromInteger(_gradeid);
|
|||
|
ograde.SetObjectID(_gradeid);
|
|||
|
_grades.Add(ograde);
|
|||
|
|
|||
|
if (Grade.Get(ograde.Code) != null)
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Grade", nRow, "Grade already exist in other payroll type."));
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oemployee.GradeID = ograde.ID;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#endregion Grade upload
|
|||
|
/// <summary>
|
|||
|
/// Process Department whether it is already in the system or new location
|
|||
|
/// </summary>
|
|||
|
#region Department
|
|||
|
int nparentid = 0;
|
|||
|
ID tempid = ID.FromInteger(0);
|
|||
|
nIndex = 0;
|
|||
|
foreach (Configaration oconfig in deptTiers)
|
|||
|
{
|
|||
|
string sValue = oconfig.ConAttributes.GetAttributeValue("tier");
|
|||
|
if (sValue == "") continue;
|
|||
|
nIndex = nIndex + 1;
|
|||
|
if (row[oconfig.Value + " Name"].ToString() == "") continue;
|
|||
|
Department odepartment = null;
|
|||
|
CodeautoGenerate = ConfigurationManager.GetBoolValue("department", "codeautogenerate", EnumConfigurationType.Logic);
|
|||
|
if (CodeautoGenerate == false)
|
|||
|
{
|
|||
|
if (nIndex > 1)
|
|||
|
odepartment = _departments.Find(delegate(Department item) { return item.Code == row[oconfig.Value + " Code"].ToString().Trim() && item.Tier == nIndex && item.ParentID.Integer == nparentid; });
|
|||
|
else
|
|||
|
odepartment = _departments.Find(delegate(Department item) { return item.Code == row[oconfig.Value + " Code"].ToString().Trim() && item.Tier == nIndex; });
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (nIndex > 1)
|
|||
|
odepartment = _departments.Find(delegate(Department item) { return item.Name == row[oconfig.Value + " Name"].ToString().Trim() && item.Tier == nIndex && item.ParentID.Integer == nparentid; });
|
|||
|
else
|
|||
|
odepartment = _departments.Find(delegate(Department item) { return item.Name == row[oconfig.Value + " Name"].ToString().Trim() && item.Tier == nIndex; });
|
|||
|
}
|
|||
|
|
|||
|
if (odepartment == null)
|
|||
|
{
|
|||
|
odepartment = new Department();
|
|||
|
odepartment.Name = row[oconfig.Value + " Name"].ToString().Trim();
|
|||
|
odepartment.Tier = nIndex;
|
|||
|
odepartment.Status = EnumStatus.Active;
|
|||
|
|
|||
|
|
|||
|
if (CodeautoGenerate == false)
|
|||
|
{
|
|||
|
odepartment.Code = row[oconfig.Value + " Code"].ToString().Trim();
|
|||
|
if (odepartment.Code == "")
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create(oconfig.Value + " Code", nRow, oconfig.Value + " Code can't be empty"));
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if (nIndex > 1) odepartment.ParentID = ID.FromInteger(nparentid);
|
|||
|
_departmentid = _departmentid + 1;
|
|||
|
nparentid = _departmentid;
|
|||
|
|
|||
|
oemployee.DepartmentID = ID.FromInteger(_departmentid);
|
|||
|
odepartment.SetObjectID(_departmentid);
|
|||
|
|
|||
|
|
|||
|
_departments.Add(odepartment);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
nparentid = odepartment.ID.Integer;
|
|||
|
oemployee.DepartmentID = odepartment.ID;
|
|||
|
}
|
|||
|
//if (nIndex > 1) odepartment.ParentID = ID.FromInteger(nparentid);
|
|||
|
//nparentid = odepartment.ID.Integer;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
/// <summary>
|
|||
|
/// Process location whether it is already in the system or new location
|
|||
|
/// </summary>
|
|||
|
#region Location
|
|||
|
nparentid = 0;
|
|||
|
nIndex = 0;
|
|||
|
foreach (Configaration oconfig in locConfig)
|
|||
|
{
|
|||
|
string sValue = oconfig.ConAttributes.GetAttributeValue("tier");
|
|||
|
if (sValue == "") continue;
|
|||
|
nIndex = nIndex + 1;
|
|||
|
if (row[oconfig.Value + " Name"].ToString() == "") continue;
|
|||
|
Location olocation = null;
|
|||
|
CodeautoGenerate = ConfigurationManager.GetBoolValue("location", "codeautogenerate", EnumConfigurationType.Logic);
|
|||
|
if (CodeautoGenerate == false)
|
|||
|
{
|
|||
|
if (nIndex > 1)
|
|||
|
{
|
|||
|
olocation = _locations.Find(delegate(Location item) { return item.Code == row[oconfig.Value + " Code"].ToString().Trim() && item.Tier == nIndex && item.ParentID.Integer == nparentid; });
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
olocation = _locations.Find(delegate(Location item) { return item.Code == row[oconfig.Value + " Code"].ToString().Trim() && item.Tier == nIndex; });
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (nIndex > 1)
|
|||
|
{
|
|||
|
olocation = _locations.Find(delegate(Location item) { return item.Name == row[oconfig.Value + " Name"].ToString().Trim() && item.Tier == nIndex && item.ParentID.Integer == nparentid; });
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
olocation = _locations.Find(delegate(Location item) { return item.Name == row[oconfig.Value + " Name"].ToString().Trim() && item.Tier == nIndex; });
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (olocation == null)
|
|||
|
{
|
|||
|
olocation = new Location();
|
|||
|
olocation.Name = row[oconfig.Value + " Name"].ToString().Trim();
|
|||
|
olocation.Tier = nIndex;
|
|||
|
olocation.Status = EnumStatus.Active;
|
|||
|
if (olocation.Name == "")
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create(oconfig.Value + " Name", nRow, oconfig.Value + " Name can't be empty"));
|
|||
|
|
|||
|
if (CodeautoGenerate == false)
|
|||
|
{
|
|||
|
olocation.Code = row[oconfig.Value + " Code"].ToString().Trim();
|
|||
|
if (olocation.Code == "")
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create(oconfig.Value + " Code", nRow, oconfig.Value + " Code can't be empty"));
|
|||
|
|
|||
|
}
|
|||
|
if (nIndex > 1) olocation.ParentID = ID.FromInteger(nparentid);
|
|||
|
_locationid = _locationid + 1;
|
|||
|
nparentid = _locationid;
|
|||
|
oemployee.LocationID = ID.FromInteger(_locationid);
|
|||
|
olocation.SetObjectID(_locationid);
|
|||
|
_locations.Add(olocation);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
nparentid = olocation.ID.Integer;
|
|||
|
oemployee.LocationID = olocation.ID;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
/// <summary>
|
|||
|
/// Process religion whether it is already in the system or new religion
|
|||
|
/// </summary>
|
|||
|
#region Religion upload
|
|||
|
Religion oreligion = null;
|
|||
|
CodeautoGenerate = ConfigurationManager.GetBoolValue("religion", "codeautogenerate", EnumConfigurationType.Logic);
|
|||
|
if (CodeautoGenerate == false)
|
|||
|
oreligion = _religions.Find(delegate(Religion item) { return item.Code == row["Religion Code"].ToString().Trim(); });
|
|||
|
else
|
|||
|
oreligion = _religions.Find(delegate(Religion item) { return item.Name == row["Religion Name"].ToString().Trim(); });
|
|||
|
|
|||
|
if (oreligion == null)
|
|||
|
{
|
|||
|
oreligion = new Religion();
|
|||
|
oreligion.Name = row["Religion Name"].ToString().Trim();
|
|||
|
if (CodeautoGenerate == false)
|
|||
|
{
|
|||
|
oreligion.Code = row["Religion Name"].ToString().Trim();
|
|||
|
|
|||
|
}
|
|||
|
_religionID = _religionID + 1;
|
|||
|
oemployee.ReligionID = ID.FromInteger(_religionID);
|
|||
|
oreligion.SetObjectID(_religionID);
|
|||
|
_religions.Add(oreligion);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oemployee.ReligionID = oreligion.ID;
|
|||
|
}
|
|||
|
|
|||
|
#endregion Religion upload
|
|||
|
/// <summary>
|
|||
|
/// Process designation whether it is already in the system or new designation
|
|||
|
/// </summary>
|
|||
|
#region Designation upload
|
|||
|
Designation odesignation = null;
|
|||
|
CodeautoGenerate = ConfigurationManager.GetBoolValue("designation", "codeautogenerate", EnumConfigurationType.Logic);
|
|||
|
if (CodeautoGenerate == false)
|
|||
|
odesignation = _designations.Find(delegate(Designation item) { return item.Code == row["Designation Code"].ToString().Trim(); });
|
|||
|
else
|
|||
|
odesignation = _designations.Find(delegate(Designation item) { return item.Name == row["Designation Name"].ToString().Trim(); });
|
|||
|
|
|||
|
if (odesignation == null)
|
|||
|
{
|
|||
|
odesignation = new Designation();
|
|||
|
odesignation.Name = row["Designation Name"].ToString().Trim();
|
|||
|
|
|||
|
if (CodeautoGenerate == false)
|
|||
|
odesignation.Code = row["Designation Code"].ToString().Trim();
|
|||
|
_designationid = _designationid + 1;
|
|||
|
oemployee.DesignationID = ID.FromInteger(_designationid);
|
|||
|
odesignation.SetObjectID(_designationid);
|
|||
|
odesignation.Status = EnumStatus.Active;
|
|||
|
_designations.Add(odesignation);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oemployee.DesignationID = odesignation.ID;
|
|||
|
}
|
|||
|
|
|||
|
#endregion Designation upload
|
|||
|
|
|||
|
#region Bank & Branch upload
|
|||
|
|
|||
|
if (row["Salary Bank Name"].ToString().Trim() != "")
|
|||
|
{
|
|||
|
|
|||
|
Bank obank = null;
|
|||
|
CodeautoGenerate = ConfigurationManager.GetBoolValue("bank", "codeautogenerate", EnumConfigurationType.Logic);
|
|||
|
if (CodeautoGenerate == false)
|
|||
|
{
|
|||
|
obank = _banks.Where(x =>
|
|||
|
x.Code.ToUpper().Trim() == row["Salary Bank Code"].ToString().ToUpper().Trim())
|
|||
|
.FirstOrDefault();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
obank = _banks.Where(x =>
|
|||
|
x.Name.ToUpper().Trim() == row["Salary Bank Name"].ToString().ToUpper().Trim())
|
|||
|
.FirstOrDefault();
|
|||
|
}
|
|||
|
if (obank == null)
|
|||
|
{
|
|||
|
obank = new Bank();
|
|||
|
obank.Name = row["Salary Bank Name"].ToString().Trim();
|
|||
|
if (CodeautoGenerate == false)
|
|||
|
obank.Code = row["Salary Bank Code"].ToString().Trim();
|
|||
|
_bankid = _bankid + 1;
|
|||
|
obank.SetObjectID(_bankid);
|
|||
|
_banks.Add(obank);
|
|||
|
}
|
|||
|
|
|||
|
if (row["Salary Branch Name"].ToString() != "")
|
|||
|
{
|
|||
|
|
|||
|
Branch oBranch = null;
|
|||
|
CodeautoGenerate = ConfigurationManager.GetBoolValue("branch", "codeautogenerate", EnumConfigurationType.Logic);
|
|||
|
if (CodeautoGenerate == false)
|
|||
|
{
|
|||
|
oBranch = _branches.Where(item =>
|
|||
|
item.Code.ToUpper().Trim() == row["Salary Branch Code"].ToString().ToUpper().Trim()
|
|||
|
&& item.BankID.Integer == obank.ID.Integer)
|
|||
|
.FirstOrDefault();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oBranch = _branches.Where(item =>
|
|||
|
item.Name.ToUpper().Trim() == row["Salary Branch Name"].ToString().ToUpper().Trim()
|
|||
|
&& item.BankID.Integer == obank.ID.Integer)
|
|||
|
.FirstOrDefault();
|
|||
|
}
|
|||
|
if (oBranch == null)
|
|||
|
{
|
|||
|
oBranch = new Branch();
|
|||
|
oBranch.Name = row["Salary Branch Name"].ToString().Trim();
|
|||
|
if (CodeautoGenerate == false)
|
|||
|
oBranch.Code = row["Salary Branch Code"].ToString().Trim();
|
|||
|
_branchid = _branchid + 1;
|
|||
|
oBranch.BankID = obank.ID;
|
|||
|
oBranch.SetObjectID(_branchid);
|
|||
|
oemployee.BranchID = ID.FromInteger(_branchid);
|
|||
|
_branches.Add(oBranch);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oemployee.BranchID = oBranch.ID;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
bool isOPISeparateAcountApplicable = ConfigurationManager.GetBoolValue("opi", "separateaccount", EnumConfigurationType.Logic);
|
|||
|
|
|||
|
if (isOPISeparateAcountApplicable)
|
|||
|
{
|
|||
|
if (row["OPI Bank Name"].ToString() != "")
|
|||
|
{
|
|||
|
|
|||
|
Bank obank = null;
|
|||
|
CodeautoGenerate = ConfigurationManager.GetBoolValue("bank", "codeautogenerate", EnumConfigurationType.Logic);
|
|||
|
|
|||
|
if (CodeautoGenerate == false)
|
|||
|
{
|
|||
|
obank = _banks.Where(x =>
|
|||
|
x.Code.ToUpper().Trim() == row["OPI Bank Code"].ToString().ToUpper().Trim())
|
|||
|
.FirstOrDefault();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
obank = _banks.Where(x =>
|
|||
|
x.Name.ToUpper().Trim() == row["OPI Bank Name"].ToString().ToUpper().Trim())
|
|||
|
.FirstOrDefault();
|
|||
|
}
|
|||
|
|
|||
|
if (obank == null)
|
|||
|
{
|
|||
|
obank = new Bank();
|
|||
|
obank.Name = row["OPI Bank Name"].ToString().Trim();
|
|||
|
if (CodeautoGenerate == false)
|
|||
|
obank.Code = row["OPI Bank Code"].ToString().Trim();
|
|||
|
_bankid = _bankid + 1;
|
|||
|
obank.SetObjectID(_bankid);
|
|||
|
_banks.Add(obank);
|
|||
|
}
|
|||
|
|
|||
|
if (row["OPI Branch Name"].ToString() != "")
|
|||
|
{
|
|||
|
|
|||
|
Branch oBranch = null;
|
|||
|
CodeautoGenerate = ConfigurationManager.GetBoolValue("branch", "codeautogenerate", EnumConfigurationType.Logic);
|
|||
|
if (CodeautoGenerate == false)
|
|||
|
{
|
|||
|
oBranch = _branches.Where(item =>
|
|||
|
item.Code.ToUpper().Trim() == row["OPI Branch Code"].ToString().ToUpper().Trim()
|
|||
|
&& item.BankID.Integer == obank.ID.Integer)
|
|||
|
.FirstOrDefault();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oBranch = _branches.Where(item =>
|
|||
|
item.Name.ToUpper().Trim() == row["OPI Branch Name"].ToString().ToUpper().Trim()
|
|||
|
&& item.BankID.Integer == obank.ID.Integer)
|
|||
|
.FirstOrDefault();
|
|||
|
}
|
|||
|
|
|||
|
if (oBranch == null)
|
|||
|
{
|
|||
|
oBranch = new Branch();
|
|||
|
oBranch.Name = row["OPI Branch Name"].ToString().Trim();
|
|||
|
if (CodeautoGenerate == false)
|
|||
|
oBranch.Code = row["OPI Branch Code"].ToString().Trim();
|
|||
|
_branchid = _branchid + 1;
|
|||
|
oBranch.BankID = obank.ID;
|
|||
|
oBranch.SetObjectID(_branchid);
|
|||
|
oemployee.OutPayBranchID = ID.FromInteger(_branchid);
|
|||
|
_branches.Add(oBranch);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oemployee.OutPayBranchID = oBranch.ID;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion Bank & Branch upload
|
|||
|
|
|||
|
_employees.Add(oemployee);
|
|||
|
}
|
|||
|
UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
private BasicCodeItem ExistingItem(object ItemByCode, object ItemByName)
|
|||
|
{
|
|||
|
if (ItemByCode != null) return BasicCodeItem.Code;
|
|||
|
else return BasicCodeItem.Name;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public void Save()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
|
|||
|
foreach (Employee item in _employees)
|
|||
|
{
|
|||
|
item.PayrollTypeID = SystemInformation.CurrentSysInfo.PayrollTypeID;
|
|||
|
}
|
|||
|
|
|||
|
RegularDataUpload.Save(_categorys, _grades, _departments, _locations, _religions,
|
|||
|
_designations, _banks, _branches, _employees, _accessCards);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#region Save Tax Data
|
|||
|
public void SaveTaxData()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
IncomeTax.Save(_incomeTaxs, EnumIncomeTaxDataFrom.ProcessTempData);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
public void ImportEmpBasicInfoRegularly(DataTable odataTable)
|
|||
|
{
|
|||
|
|
|||
|
Employee oemployee = null;
|
|||
|
|
|||
|
#region Refresh Objects
|
|||
|
if (ProcessBasicData(odataTable) == false) return;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in odataTable.Rows)
|
|||
|
{
|
|||
|
Application.DoEvents();
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = _employees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee Code"].ToString(); });
|
|||
|
if (oemployee == null) throw new ServiceException("Employee not found in the collection; employeeNo:" + dr["Employee Code"].ToString());
|
|||
|
oemployee.Name = dr["Employee Name"].ToString().Trim();
|
|||
|
oemployee.FatherName = dr["Father's Name"].ToString().Trim();
|
|||
|
oemployee.BirthDate = Convert.ToDateTime(dr["Date of Birth"]);
|
|||
|
oemployee.JoiningDate = Convert.ToDateTime(dr["Date of Joining"]);
|
|||
|
//For Novartis Discontinue Employee Upload and Fund Management Data Issue
|
|||
|
//oemployee.Status = EnumEmployeeStatus.Discontinued;
|
|||
|
|
|||
|
oemployee.Gender = (dr["Gender"].ToString().Trim().ToUpper() == "M") ? EnumGender.Male : EnumGender.Female;
|
|||
|
oemployee.MaritalStatus = (dr["Marital Status"].ToString().Trim().ToUpper() == "MARRIED") ? EnumMaritalStatus.Married : EnumMaritalStatus.UnMarried;
|
|||
|
//oemployee.TaxCircle = dr["Tax Circle"].ToString() != string.Empty ? (EnumTaxCircle)Enum.Parse(typeof(EnumTaxCircle), dr["Tax Circle"].ToString(), true) : EnumTaxCircle.Employee;
|
|||
|
oemployee.TaxCircle = dr["Tax Circle"].ToString().Trim();
|
|||
|
oemployee.TinNo = dr["TIN"].ToString().Trim();
|
|||
|
if (dr["Confirmation Date"].ToString() != "") oemployee.ConfirDate = Convert.ToDateTime(dr["Confirmation Date"]);
|
|||
|
if (oemployee.ConfirDate != DateTime.MinValue)
|
|||
|
oemployee.IsConfirmed = true;
|
|||
|
if (dr["PF Membership"].ToString().ToUpper().Trim() == "Y")
|
|||
|
oemployee.PFMemberType = EnumPFMembershipType.Live;
|
|||
|
oemployee.ForeignExPat = dr["Is Foreign Expatriate"].ToString() != string.Empty ? (dr["Is Foreign Expatriate"].ToString() == "YES" ? true : false) : false;
|
|||
|
|
|||
|
//Refresh Employee Grade Salary
|
|||
|
if (oemployee.GradeID != null)
|
|||
|
{
|
|||
|
|
|||
|
Grade ograde = _grades.GetItem(oemployee.GradeID);
|
|||
|
|
|||
|
oemployee.EmployeeGradeSalary.SetObjectID(oemployee.ID.Integer);
|
|||
|
oemployee.EmployeeGradeSalary.GradeID = oemployee.GradeID;
|
|||
|
oemployee.EmployeeGradeSalary.GradeSalaryTypeID = ID.FromInteger(1);
|
|||
|
if (ograde.HasGrossConcept == true) oemployee.EmployeeGradeSalary.GrossSalary = dr["Gross Salary"].ToString() != string.Empty ? Convert.ToDouble(dr["Gross Salary"]) : 0.0;
|
|||
|
oemployee.EmployeeGradeSalary.BasicSalary = dr["Basic Salary"].ToString() != string.Empty ? Convert.ToDouble(dr["Basic Salary"]) : 0.0;
|
|||
|
oemployee.BasicSalary = oemployee.EmployeeGradeSalary.BasicSalary;
|
|||
|
oemployee.GrossSalary = oemployee.EmployeeGradeSalary.GrossSalary;
|
|||
|
oemployee.EmployeeGradeSalary.EffectDate = oemployee.JoiningDate;
|
|||
|
oemployee.EmployeeGradeSalary.EmployeeID = oemployee.ID;
|
|||
|
|
|||
|
ObjectsTemplate<EmployeeGradeSalary> itemsToSave = oemployee.EmployeeGradeSalary.process();
|
|||
|
oemployee.EmployeeGradeSalarys = new ObjectsTemplate<EmployeeGradeSalary>();
|
|||
|
foreach (EmployeeGradeSalary item in itemsToSave)
|
|||
|
{
|
|||
|
oemployee.EmployeeGradeSalarys.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
//Refresh Employee Posting
|
|||
|
oemployee.EmployeePosting.EffectDate = oemployee.JoiningDate;
|
|||
|
oemployee.EmployeePosting.SetObjectID(oemployee.ID.Integer);
|
|||
|
oemployee.EmployeePosting.DepartmentID = oemployee.DepartmentID;
|
|||
|
oemployee.EmployeePosting.LocationID = oemployee.LocationID;
|
|||
|
oemployee.EmployeePosting.DesignationID = oemployee.DesignationID;
|
|||
|
|
|||
|
//Refresh Emloyee Bank Account
|
|||
|
if (oemployee.BranchID != null)
|
|||
|
{
|
|||
|
if (dr["Salary Account Number"].ToString() != "")
|
|||
|
{
|
|||
|
oemployee.AccountNo = dr["Salary Account Number"].ToString();
|
|||
|
// oemployee.EmployeeBankAccount.SetObjectID(oemployee.ID.Integer);
|
|||
|
oemployee.PaymentMode = EnumPaymentMode.BankTransfer;
|
|||
|
oemployee.EmployeeBankAccount.EffectDate = oemployee.JoiningDate;
|
|||
|
oemployee.EmployeeBankAccount.BranchID = oemployee.BranchID;
|
|||
|
oemployee.EmployeeBankAccount.AccountType = EnumBankAccountType.SalaryAccount;
|
|||
|
oemployee.EmployeeBankAccount.AccountNo = dr["Salary Account Number"].ToString();
|
|||
|
}
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Salary Account Number", nRow, "'Salary Account Number' Column not found for the employee No:" + oemployee.EmployeeNo, oemployee.EmployeeNo, oemployee.Name));
|
|||
|
}
|
|||
|
|
|||
|
if (oemployee.OutPayBranchID != null)
|
|||
|
{
|
|||
|
if (dr["OPI Account Number"].ToString() != "")
|
|||
|
{
|
|||
|
oemployee.OutPayAccountNo = dr["OPI Account Number"].ToString();
|
|||
|
// oemployee.EmployeeOPIBankAccount.SetObjectID(oemployee.ID.Integer);
|
|||
|
oemployee.OutPayPaymentMode = EnumPaymentMode.BankTransfer;
|
|||
|
oemployee.EmployeeOPIBankAccount.EffectDate = oemployee.JoiningDate;
|
|||
|
oemployee.EmployeeOPIBankAccount.BranchID = oemployee.OutPayBranchID;
|
|||
|
oemployee.EmployeeOPIBankAccount.AccountType = EnumBankAccountType.OutPayAccount;
|
|||
|
oemployee.EmployeeOPIBankAccount.AccountNo = dr["OPI Account Number"].ToString();
|
|||
|
}
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("OPI Account Number", nRow, "'OPI Account Number' Column not found for the employee No:" + oemployee.EmployeeNo, oemployee.EmployeeNo, oemployee.Name));
|
|||
|
}
|
|||
|
|
|||
|
if (dr["PROXID"].ToString() != "")
|
|||
|
{
|
|||
|
_accessCardID = _accessCardID + 1;
|
|||
|
oemployee.CardID = ID.FromInteger(_accessCardID);
|
|||
|
AccessCard ocard = new AccessCard();
|
|||
|
ocard.SetObjectID(_accessCardID);
|
|||
|
ocard.CardNumber = dr["PROXID"].ToString();
|
|||
|
ocard.TypeID = ID.FromInteger(1);
|
|||
|
ocard.Status = EnumCardStatus.Attached;
|
|||
|
ocard.CardOperation.EmployeeID = oemployee.ID;
|
|||
|
ocard.CardOperation.CardID = ocard.ID;
|
|||
|
ocard.CardOperation.AssignDate = oemployee.JoiningDate;
|
|||
|
_accessCards.Add(ocard);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occered on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|
|||
|
public void ImportEmpBasicInfo(DataTable odataTable)
|
|||
|
{
|
|||
|
|
|||
|
Employee oemployee = null;
|
|||
|
|
|||
|
#region Refresh Objects
|
|||
|
if (ProcessBasicData(odataTable) == false) return;
|
|||
|
int nRow = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in odataTable.Rows)
|
|||
|
{
|
|||
|
Application.DoEvents();
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = _employees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee Code"].ToString(); });
|
|||
|
if (oemployee == null) throw new ServiceException("Employee not found in the collection; employeeNo:" + dr["Employee Code"].ToString());
|
|||
|
oemployee.Name = dr["Employee Name"].ToString().Trim();
|
|||
|
oemployee.FatherName = dr["Father's Name"].ToString().Trim();
|
|||
|
oemployee.BirthDate = Convert.ToDateTime(dr["Date of Birth"]);
|
|||
|
oemployee.JoiningDate = Convert.ToDateTime(dr["Date of Joining"]);
|
|||
|
//For Novartis Discontinue Employee Upload and Fund Management Data Issue
|
|||
|
//oemployee.Status = EnumEmployeeStatus.Discontinued;
|
|||
|
if ((dr["Gender"].ToString().Trim().ToUpper() == "MALE") || (dr["Gender"].ToString().Trim().ToUpper() == "M"))
|
|||
|
{
|
|||
|
oemployee.Gender = EnumGender.Male;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oemployee.Gender = EnumGender.Female;
|
|||
|
}
|
|||
|
//oemployee.Gender = ((dr["Gender"].ToString().Trim().ToUpper() == "M") || (dr["Gender"].ToString().Trim().ToUpper() == "Male")) ? EnumGender.Male : EnumGender.Female;
|
|||
|
oemployee.MaritalStatus = (dr["Marital Status"].ToString().Trim().ToUpper() == "MARRIED") ? EnumMaritalStatus.Married : EnumMaritalStatus.UnMarried;
|
|||
|
//oemployee.TaxCircle = dr["Tax Circle"].ToString() != string.Empty ? (EnumTaxCircle)Enum.Parse(typeof(EnumTaxCircle), dr["Tax Circle"].ToString(), true) : EnumTaxCircle.Employee;
|
|||
|
oemployee.TaxCircle = dr["Tax Circle"].ToString().Trim();
|
|||
|
oemployee.TinNo = dr["TIN"].ToString().Trim();
|
|||
|
if (dr["Confirmation Date"].ToString() != "") oemployee.ConfirDate = Convert.ToDateTime(dr["Confirmation Date"]);
|
|||
|
if (oemployee.ConfirDate != DateTime.MinValue)
|
|||
|
oemployee.IsConfirmed = true;
|
|||
|
if (dr["PF Membership"].ToString().ToUpper().Trim() == "Y")
|
|||
|
oemployee.PFMemberType = EnumPFMembershipType.Live;
|
|||
|
oemployee.ForeignExPat = dr["Is Foreign Expatriate"].ToString() != string.Empty ? (dr["Is Foreign Expatriate"].ToString() == "YES" ? true : false) : false;
|
|||
|
oemployee.MobileNo = dr["Mobile No"].ToString().Trim();
|
|||
|
oemployee.EmailAddress = dr["Email Address"].ToString().Trim();
|
|||
|
//Refresh Employee Grade Salary
|
|||
|
if (oemployee.GradeID != null)
|
|||
|
{
|
|||
|
Grade ograde = _grades.GetItem(oemployee.GradeID);
|
|||
|
oemployee.EmployeeGradeSalary.SetObjectID(oemployee.ID.Integer);
|
|||
|
oemployee.EmployeeGradeSalary.GradeID = oemployee.GradeID;
|
|||
|
oemployee.EmployeeGradeSalary.GradeSalaryTypeID = ID.FromInteger(1);
|
|||
|
if (ograde.HasGrossConcept == true) oemployee.EmployeeGradeSalary.GrossSalary = dr["Gross Salary"].ToString() != string.Empty ? Convert.ToDouble(dr["Gross Salary"]) : 0.0;
|
|||
|
oemployee.EmployeeGradeSalary.BasicSalary = dr["Basic Salary"].ToString() != string.Empty ? Convert.ToDouble(dr["Basic Salary"]) : 0.0;
|
|||
|
oemployee.BasicSalary = oemployee.EmployeeGradeSalary.BasicSalary;
|
|||
|
oemployee.GrossSalary = oemployee.EmployeeGradeSalary.GrossSalary;
|
|||
|
oemployee.EmployeeGradeSalary.EffectDate = oemployee.JoiningDate;
|
|||
|
|
|||
|
oemployee.EmployeeGradeSalarys = new ObjectsTemplate<EmployeeGradeSalary>();
|
|||
|
|
|||
|
oemployee.EmployeeGradeSalarys.Add(oemployee.EmployeeGradeSalary);
|
|||
|
}
|
|||
|
|
|||
|
//Refresh Employee Posting
|
|||
|
oemployee.EmployeePosting.EffectDate = oemployee.JoiningDate;
|
|||
|
oemployee.EmployeePosting.SetObjectID(oemployee.ID.Integer);
|
|||
|
oemployee.EmployeePosting.DepartmentID = oemployee.DepartmentID;
|
|||
|
oemployee.EmployeePosting.LocationID = oemployee.LocationID;
|
|||
|
oemployee.EmployeePosting.DesignationID = oemployee.DesignationID;
|
|||
|
|
|||
|
//Refresh Emloyee Bank Account
|
|||
|
if (oemployee.BranchID != null)
|
|||
|
{
|
|||
|
if (dr["Salary Account Number"].ToString() != "")
|
|||
|
{
|
|||
|
oemployee.AccountNo = dr["Salary Account Number"].ToString();
|
|||
|
// oemployee.EmployeeBankAccount.SetObjectID(oemployee.ID.Integer);
|
|||
|
oemployee.PaymentMode = EnumPaymentMode.BankTransfer;
|
|||
|
oemployee.EmployeeBankAccount.EffectDate = oemployee.JoiningDate;
|
|||
|
oemployee.EmployeeBankAccount.BranchID = oemployee.BranchID;
|
|||
|
oemployee.EmployeeBankAccount.AccountType = EnumBankAccountType.SalaryAccount;
|
|||
|
oemployee.EmployeeBankAccount.AccountNo = dr["Salary Account Number"].ToString();
|
|||
|
}
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Salary Account Number", nRow, "'Salary Account Number' Column not found for the employee No:" + oemployee.EmployeeNo, oemployee.EmployeeNo, oemployee.Name));
|
|||
|
}
|
|||
|
|
|||
|
if (oemployee.OutPayBranchID != null)
|
|||
|
{
|
|||
|
if (dr["OPI Account Number"].ToString() != "")
|
|||
|
{
|
|||
|
oemployee.OutPayAccountNo = dr["OPI Account Number"].ToString();
|
|||
|
// oemployee.EmployeeOPIBankAccount.SetObjectID(oemployee.ID.Integer);
|
|||
|
oemployee.OutPayPaymentMode = EnumPaymentMode.BankTransfer;
|
|||
|
oemployee.EmployeeOPIBankAccount.EffectDate = oemployee.JoiningDate;
|
|||
|
oemployee.EmployeeOPIBankAccount.BranchID = oemployee.OutPayBranchID;
|
|||
|
oemployee.EmployeeOPIBankAccount.AccountType = EnumBankAccountType.OutPayAccount;
|
|||
|
oemployee.EmployeeOPIBankAccount.AccountNo = dr["OPI Account Number"].ToString();
|
|||
|
}
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("OPI Account Number", nRow, "'OPI Account Number' Column not found for the employee No:" + oemployee.EmployeeNo, oemployee.EmployeeNo, oemployee.Name));
|
|||
|
}
|
|||
|
|
|||
|
if (dr["PROXID"].ToString() != "")
|
|||
|
{
|
|||
|
_accessCardID = _accessCardID + 1;
|
|||
|
oemployee.CardID = ID.FromInteger(_accessCardID);
|
|||
|
AccessCard ocard = new AccessCard();
|
|||
|
ocard.SetObjectID(_accessCardID);
|
|||
|
ocard.CardNumber = dr["PROXID"].ToString();
|
|||
|
ocard.TypeID = ID.FromInteger(1);
|
|||
|
ocard.Status = EnumCardStatus.Attached;
|
|||
|
ocard.CardOperation.EmployeeID = oemployee.ID;
|
|||
|
ocard.CardOperation.CardID = ocard.ID;
|
|||
|
ocard.CardOperation.AssignDate = oemployee.JoiningDate;
|
|||
|
_accessCards.Add(ocard);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occered on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|
|||
|
public void ImportEmpBasicInfo2(DataTable odataTable)
|
|||
|
{
|
|||
|
|
|||
|
Employee oemployee = null;
|
|||
|
|
|||
|
#region Refresh Objects
|
|||
|
if (ProcessBasicData(odataTable) == false) return;
|
|||
|
int nRow = 0;
|
|||
|
GlobalFunctions.SetProgressbarMaxValue = odataTable.Rows.Count;
|
|||
|
|
|||
|
UpdateProgressStatus(EnumProcessStatus.Start);
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in odataTable.Rows)
|
|||
|
{
|
|||
|
|
|||
|
Application.DoEvents();
|
|||
|
nRow = nRow + 1;
|
|||
|
UpdateprocessStatus("Collecting information " + nRow.ToString() + "/" + odataTable.Rows.Count);
|
|||
|
UpdateProgressStatus(EnumProcessStatus.PerformStep);
|
|||
|
oemployee = _employees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee Code"].ToString(); });
|
|||
|
if (oemployee == null) throw new ServiceException("Employee not found in the collection; employeeNo:" + dr["Employee Code"].ToString());
|
|||
|
oemployee.Name = dr["Employee Name"].ToString().Trim();
|
|||
|
oemployee.FatherName = dr["Father's Name"].ToString().Trim();
|
|||
|
oemployee.BirthDate = Convert.ToDateTime(dr["Date of Birth"]);
|
|||
|
oemployee.JoiningDate = Convert.ToDateTime(dr["Date of Joining"]);
|
|||
|
//For Novartis Discontinue Employee Upload and Fund Management Data Issue
|
|||
|
//oemployee.Status = EnumEmployeeStatus.Discontinued;
|
|||
|
if ((dr["Gender"].ToString().Trim().ToUpper() == "MALE") || (dr["Gender"].ToString().Trim().ToUpper() == "M"))
|
|||
|
{
|
|||
|
oemployee.Gender = EnumGender.Male;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oemployee.Gender = EnumGender.Female;
|
|||
|
}
|
|||
|
//oemployee.Gender = ((dr["Gender"].ToString().Trim().ToUpper() == "M") || (dr["Gender"].ToString().Trim().ToUpper() == "Male")) ? EnumGender.Male : EnumGender.Female;
|
|||
|
oemployee.MaritalStatus = (dr["Marital Status"].ToString().Trim().ToUpper() == "MARRIED") ? EnumMaritalStatus.Married : EnumMaritalStatus.UnMarried;
|
|||
|
//oemployee.TaxCircle = dr["Tax Circle"].ToString() != string.Empty ? (EnumTaxCircle)Enum.Parse(typeof(EnumTaxCircle), dr["Tax Circle"].ToString(), true) : EnumTaxCircle.Employee;
|
|||
|
oemployee.TaxCircle = dr["Tax Circle"].ToString().Trim();
|
|||
|
oemployee.TinNo = dr["TIN"].ToString().Trim();
|
|||
|
if (dr["Confirmation Date"].ToString() != "") oemployee.ConfirDate = Convert.ToDateTime(dr["Confirmation Date"]);
|
|||
|
if (oemployee.ConfirDate != DateTime.MinValue)
|
|||
|
oemployee.IsConfirmed = true;
|
|||
|
if (dr["PF Membership"].ToString().ToUpper().Trim() == "Y")
|
|||
|
oemployee.PFMemberType = EnumPFMembershipType.Live;
|
|||
|
oemployee.ForeignExPat = dr["Is Foreign Expatriate"].ToString() != string.Empty ? (dr["Is Foreign Expatriate"].ToString() == "YES" ? true : false) : false;
|
|||
|
oemployee.MobileNo = dr["Mobile No"].ToString().Trim();
|
|||
|
oemployee.EmailAddress = dr["Email Address"].ToString().Trim();
|
|||
|
//Refresh Employee Grade Salary
|
|||
|
if (oemployee.GradeID != null)
|
|||
|
{
|
|||
|
Grade ograde = _grades.GetItem(oemployee.GradeID);
|
|||
|
oemployee.EmployeeGradeSalary.SetObjectID(oemployee.ID.Integer);
|
|||
|
oemployee.EmployeeGradeSalary.GradeID = oemployee.GradeID;
|
|||
|
oemployee.EmployeeGradeSalary.GradeSalaryTypeID = ID.FromInteger(1);
|
|||
|
if (ograde.HasGrossConcept == true) oemployee.EmployeeGradeSalary.GrossSalary = dr["Gross Salary"].ToString() != string.Empty ? Convert.ToDouble(dr["Gross Salary"]) : 0.0;
|
|||
|
oemployee.EmployeeGradeSalary.BasicSalary = dr["Basic Salary"].ToString() != string.Empty ? Convert.ToDouble(dr["Basic Salary"]) : 0.0;
|
|||
|
oemployee.BasicSalary = oemployee.EmployeeGradeSalary.BasicSalary;
|
|||
|
oemployee.GrossSalary = oemployee.EmployeeGradeSalary.GrossSalary;
|
|||
|
oemployee.EmployeeGradeSalary.EffectDate = oemployee.JoiningDate;
|
|||
|
|
|||
|
oemployee.EmployeeGradeSalarys = new ObjectsTemplate<EmployeeGradeSalary>();
|
|||
|
|
|||
|
oemployee.EmployeeGradeSalarys.Add(oemployee.EmployeeGradeSalary);
|
|||
|
}
|
|||
|
|
|||
|
//Refresh Employee Posting
|
|||
|
oemployee.EmployeePosting.EffectDate = oemployee.JoiningDate;
|
|||
|
oemployee.EmployeePosting.SetObjectID(oemployee.ID.Integer);
|
|||
|
oemployee.EmployeePosting.DepartmentID = oemployee.DepartmentID;
|
|||
|
oemployee.EmployeePosting.LocationID = oemployee.LocationID;
|
|||
|
oemployee.EmployeePosting.DesignationID = oemployee.DesignationID;
|
|||
|
|
|||
|
//Refresh Emloyee Bank Account
|
|||
|
if (oemployee.BranchID != null)
|
|||
|
{
|
|||
|
if (dr["Salary Account Number"].ToString() != "")
|
|||
|
{
|
|||
|
oemployee.AccountNo = dr["Salary Account Number"].ToString();
|
|||
|
// oemployee.EmployeeBankAccount.SetObjectID(oemployee.ID.Integer);
|
|||
|
oemployee.PaymentMode = EnumPaymentMode.BankTransfer;
|
|||
|
oemployee.EmployeeBankAccount.EffectDate = oemployee.JoiningDate;
|
|||
|
oemployee.EmployeeBankAccount.BranchID = oemployee.BranchID;
|
|||
|
oemployee.EmployeeBankAccount.AccountType = EnumBankAccountType.SalaryAccount;
|
|||
|
oemployee.EmployeeBankAccount.AccountNo = dr["Salary Account Number"].ToString();
|
|||
|
}
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Salary Account Number", nRow, "'Salary Account Number' Column not found for the employee No:" + oemployee.EmployeeNo, oemployee.EmployeeNo, oemployee.Name));
|
|||
|
}
|
|||
|
|
|||
|
if (oemployee.OutPayBranchID != null)
|
|||
|
{
|
|||
|
if (dr["OPI Account Number"].ToString() != "")
|
|||
|
{
|
|||
|
oemployee.OutPayAccountNo = dr["OPI Account Number"].ToString();
|
|||
|
// oemployee.EmployeeOPIBankAccount.SetObjectID(oemployee.ID.Integer);
|
|||
|
oemployee.OutPayPaymentMode = EnumPaymentMode.BankTransfer;
|
|||
|
oemployee.EmployeeOPIBankAccount.EffectDate = oemployee.JoiningDate;
|
|||
|
oemployee.EmployeeOPIBankAccount.BranchID = oemployee.OutPayBranchID;
|
|||
|
oemployee.EmployeeOPIBankAccount.AccountType = EnumBankAccountType.OutPayAccount;
|
|||
|
oemployee.EmployeeOPIBankAccount.AccountNo = dr["OPI Account Number"].ToString();
|
|||
|
}
|
|||
|
else
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("OPI Account Number", nRow, "'OPI Account Number' Column not found for the employee No:" + oemployee.EmployeeNo, oemployee.EmployeeNo, oemployee.Name));
|
|||
|
}
|
|||
|
|
|||
|
if (dr["PROXID"].ToString() != "")
|
|||
|
{
|
|||
|
_accessCardID = _accessCardID + 1;
|
|||
|
oemployee.CardID = ID.FromInteger(_accessCardID);
|
|||
|
AccessCard ocard = new AccessCard();
|
|||
|
ocard.SetObjectID(_accessCardID);
|
|||
|
ocard.CardNumber = dr["PROXID"].ToString();
|
|||
|
ocard.TypeID = ID.FromInteger(1);
|
|||
|
ocard.Status = EnumCardStatus.Attached;
|
|||
|
ocard.CardOperation.EmployeeID = oemployee.ID;
|
|||
|
ocard.CardOperation.CardID = ocard.ID;
|
|||
|
ocard.CardOperation.AssignDate = oemployee.JoiningDate;
|
|||
|
_accessCards.Add(ocard);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
throw new ServiceException("Error occered on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public void ImportTaxAdjustmentData(DataTable odataTable, DataUploadColumnDefinition columnDefinition)
|
|||
|
{
|
|||
|
ObjectsTemplate<TaxMergeMaster> oTaxMergeMasters = new ObjectsTemplate<TaxMergeMaster>();
|
|||
|
oTaxMergeMasters = TaxMergeMaster.GetbyTaxParameter(SystemInformation.CurrentSysInfo.TaxParamID);
|
|||
|
Employee oemployee = null;
|
|||
|
IncomeTax oIncomeTax = null;
|
|||
|
TaxMergeMaster oTaxMergeMaster = null;
|
|||
|
_employees = Employee.Get();
|
|||
|
|
|||
|
ObjectsTemplate<ProcessItem> processItems = ProcessItem.Get();
|
|||
|
#region Refresh Objects
|
|||
|
int nRow = 0;
|
|||
|
ObjectsTemplate<IncomeTax> savedData = IncomeTax.Get(EnumIncomeTaxDataFrom.ProcessTempData);
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in odataTable.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = _employees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });//Employee.Get(dr["Employee Code"].ToString());
|
|||
|
if (oemployee == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee Code", nRow, "Employee Code not found: " + dr["Employee No"].ToString()));
|
|||
|
continue;
|
|||
|
}
|
|||
|
|
|||
|
for (int i = 1; i < odataTable.Columns.Count; i++)
|
|||
|
{
|
|||
|
oIncomeTax = TaxMergeMaster.Extract(oTaxMergeMasters, EnumTaxMergeType.TaxAdjustItem, columnDefinition.SelectedItemOneID.Integer);
|
|||
|
|
|||
|
|
|||
|
if (oIncomeTax == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create(odataTable.Columns[i].ColumnName, nRow, "Tax head grouping net yet created for the selected item", oemployee.EmployeeNo, oemployee.Name));
|
|||
|
continue;
|
|||
|
}
|
|||
|
ProcessItem pitem = processItems.Find(delegate(ProcessItem item)
|
|||
|
{ return item.ItemCode == (int)oIncomeTax.ItemGroup; });
|
|||
|
if (pitem == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create(odataTable.Columns[i].ColumnName, nRow, " Tax process item code not found in the process collection; Item Code:" + oTaxMergeMaster.ItemGroup.ToString(), oemployee.EmployeeNo, oemployee.Name));
|
|||
|
continue;
|
|||
|
}
|
|||
|
|
|||
|
oIncomeTax.EmployeeID = oemployee.ID;
|
|||
|
double nAmount = 0;
|
|||
|
if (double.TryParse(dr[odataTable.Columns[i].ColumnName].ToString(), out nAmount) == false)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create(odataTable.Columns[i].ColumnName, nRow, odataTable.Columns[i].ColumnName + " contains Invalid value:" + dr[odataTable.Columns[i].ColumnName].ToString(), oemployee.EmployeeNo, oemployee.Name));
|
|||
|
continue;
|
|||
|
}
|
|||
|
|
|||
|
IncomeTax oNewItem = IncomeTax.Get(savedData, oemployee.ID, oIncomeTax.ItemGroup, oIncomeTax.ItemID); //.Get(savedData, oemployee.ID, oTaxMergeMaster.ItemGroup, oTaxMergeMaster.ItemID);
|
|||
|
if (oNewItem != null)
|
|||
|
oIncomeTax = oNewItem;
|
|||
|
else
|
|||
|
{
|
|||
|
oIncomeTax.Side = (EnumIncomeTaxSide)pitem.ItemGroup;
|
|||
|
oIncomeTax.Position = pitem.Position;
|
|||
|
}
|
|||
|
|
|||
|
// if (oIncomeTax == null) oIncomeTax = new IncomeTax();
|
|||
|
oIncomeTax.EmployeeID = oemployee.ID;
|
|||
|
oIncomeTax.PreviousAmount = oIncomeTax.PreviousAmount + nAmount;
|
|||
|
if (oIncomeTax.PreviousAmount != 0)
|
|||
|
_incomeTaxs.Add(oIncomeTax);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occered on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public void ImportTaxDataInfo(DataTable odataTable)
|
|||
|
{
|
|||
|
ObjectsTemplate<TaxMergeMaster> oTaxMergeMasters = new ObjectsTemplate<TaxMergeMaster>();
|
|||
|
oTaxMergeMasters = TaxMergeMaster.GetbyTaxParameter(SystemInformation.CurrentSysInfo.TaxParamID);
|
|||
|
Employee oemployee = null;
|
|||
|
IncomeTax oIncomeTax = null;
|
|||
|
TaxMergeMaster oTaxMergeMaster = null;
|
|||
|
_employees = Employee.Get();
|
|||
|
ObjectsTemplate<ProcessItem> processItems = ProcessItem.Get();
|
|||
|
#region Refresh Objects
|
|||
|
int nRow = 0;
|
|||
|
ObjectsTemplate<IncomeTax> savedData = IncomeTax.Get(EnumIncomeTaxDataFrom.ProcessTempData);
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (DataRow dr in odataTable.Rows)
|
|||
|
{
|
|||
|
nRow = nRow + 1;
|
|||
|
oemployee = _employees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee Code"].ToString(); });//Employee.Get(dr["Employee Code"].ToString());
|
|||
|
if (oemployee == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee Code", nRow, "Employee Code not found: " + dr["Employee Code"].ToString()));
|
|||
|
continue;
|
|||
|
}
|
|||
|
|
|||
|
for (int i = 1; i < odataTable.Columns.Count; i++)
|
|||
|
{
|
|||
|
oIncomeTax = new IncomeTax();
|
|||
|
oTaxMergeMaster = oTaxMergeMasters.Find(delegate(TaxMergeMaster taxMerge)
|
|||
|
{ return taxMerge.Description == odataTable.Columns[i].ColumnName; });
|
|||
|
|
|||
|
if (oTaxMergeMaster == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create(odataTable.Columns[i].ColumnName, nRow, odataTable.Columns[i].ColumnName + " not found in the tax head groping", oemployee.EmployeeNo, oemployee.Name));
|
|||
|
continue;
|
|||
|
}
|
|||
|
ProcessItem pitem = processItems.Find(delegate(ProcessItem item)
|
|||
|
{ return item.ItemCode == (int)oTaxMergeMaster.ItemGroup; });
|
|||
|
if (pitem == null)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create(odataTable.Columns[i].ColumnName, nRow, " Tax process item code not found in the process collection; Item Code:" + oTaxMergeMaster.ItemGroup.ToString(), oemployee.EmployeeNo, oemployee.Name));
|
|||
|
continue;
|
|||
|
}
|
|||
|
|
|||
|
if (oTaxMergeMaster != null)
|
|||
|
{
|
|||
|
oIncomeTax.EmployeeID = oemployee.ID;
|
|||
|
double nAmount = 0;
|
|||
|
if (double.TryParse(dr[odataTable.Columns[i].ColumnName].ToString(), out nAmount) == false)
|
|||
|
{
|
|||
|
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create(odataTable.Columns[i].ColumnName, nRow, odataTable.Columns[i].ColumnName + " contains Invalid value:" + dr[odataTable.Columns[i].ColumnName].ToString(), oemployee.EmployeeNo, oemployee.Name));
|
|||
|
continue;
|
|||
|
}
|
|||
|
oIncomeTax = IncomeTax.Get(savedData, oemployee.ID, oTaxMergeMaster.ItemGroup, oTaxMergeMaster.ItemID);
|
|||
|
if (oIncomeTax == null) oIncomeTax = new IncomeTax();
|
|||
|
oIncomeTax.EmployeeID = oemployee.ID;
|
|||
|
oIncomeTax.ItemGroup = oTaxMergeMaster.ItemGroup;
|
|||
|
oIncomeTax.ItemID = oTaxMergeMaster.ItemID;
|
|||
|
|
|||
|
oIncomeTax.PreviousAmount = oIncomeTax.PreviousAmount + nAmount;
|
|||
|
oIncomeTax.Description = oTaxMergeMaster.Description;
|
|||
|
oIncomeTax.Side = (EnumIncomeTaxSide)pitem.ItemGroup;
|
|||
|
oIncomeTax.Position = pitem.Position;
|
|||
|
if (oIncomeTax.PreviousAmount != 0)
|
|||
|
_incomeTaxs.Add(oIncomeTax);
|
|||
|
}
|
|||
|
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create(odataTable.Columns[i].ColumnName, nRow, "Column not found in tax setup", oemployee.EmployeeNo, oemployee.Name));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new ServiceException("Error occered on row:" + nRow + " Reason:" + ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
#region IRegularDataUploadServices
|
|||
|
public interface IRegularDataUploadService
|
|||
|
{
|
|||
|
DataTable LoadData(string filePath);
|
|||
|
DataTable LoadData(string filePath, string sheetName);
|
|||
|
DataTable LoadExcelData(string filePath, string sheetName);
|
|||
|
//DataSet LoadExcelData(string filePath, List<string> sheetName);
|
|||
|
void Save(ObjectsTemplate<Category> categorys, ObjectsTemplate<Grade> grades, ObjectsTemplate<Department> departments, ObjectsTemplate<Location> locations,
|
|||
|
ObjectsTemplate<Religion> religions, ObjectsTemplate<Designation> designations, ObjectsTemplate<Bank> banks,
|
|||
|
ObjectsTemplate<Branch> branches, ObjectsTemplate<Employee> employees, ObjectsTemplate<AccessCard> accessCards);
|
|||
|
DataSet LoadViewData();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|