EchoTex_Payroll/HRM.BO/Common/RegularDataUpload.cs

9162 lines
531 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00

using Ease.Core.Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
namespace HRM.BO
{
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 List<HREmployee> _HREmployees = null;
//private List<Religion> _Religions = null;
//private List<Category> _Categories = null;
private List<Occupation> _Occupations = null;
private List<Nationality> _Nationalites = null;
private List<District> _Districts = null;
private List<Thana> _Thanas = null;
private List<Relation> _Relations = null;
private List<EducationLevel> _EducationLevels = null;
private List<NatureOfTraining> _NatureOfTrainings = null;
private List<Institution> _Institutions = null;
private List<Country> _Contries = null;
private List<EducationType> _EducationTypes = null;
private List<Discipline> _Disciplines = null;
private List<ResultType> _ResultTypes = null;
private List<NominationPurpose> _NominationPurposes = null;
private List<GuarantorDocumentType> _GuarantorDocumentTypes = null;
private List<TrainingType> _TrainingTypes = null;
private List<HRJoiningQuestionary> _HRJoiningQuestionaries = null;
private List<EmployeeTaxInvestment> _EmployeeTaxInvestments = null;
private List<TaxChallan> _TaxChallans = null;
//private List<Designation> _Designations = null;
//private List<CardOperation> _CardOperations = null;
List<HREmployee> _CheckHREmployees = null;
private List<PFTransaction> _PFTransactions = null;
private List<ArrearProcessDetailItem> aProcessDetailItems = null;
//private List<EmployeeWorkPlanSetup> _employeeWorkPlanSetups = null;
private List<EmpLifeCycle> _empLifeCycles = null;
int nMasterCount = 0;
int _payrollTypeID = 0;
int nOrgRowCount;
List<OrganogramBasic> oParentOrganogramNodes = null;
List<OrganogramBasic> _oOrganogramNodes = new List<OrganogramBasic>();
public RegularDataUpload()
{
}
#endregion
#region Properties
public BonusProcess UploadedBonus
{
get { return _BonusProcess; }
set { _BonusProcess = value; }
}
private List<Employee> _employees;
public List<Employee> Employees
{
get { return _employees; }
set { _employees = value; }
}
private List<AllowanceDeduction> _allowanceDeductions;
public List<AllowanceDeduction> AllowanceDeductions
{
get { return _allowanceDeductions; }
set { _allowanceDeductions = value; }
}
//added by Hasib
private List<AccessCard> _accessCards;
public List<AccessCard> AccessCards
{
get { return _accessCards; }
set { _accessCards = value; }
}
private List<AccessCard> _accessCardsErrorList;
public List<AccessCard> AccessCardsErrorList
{
get { return _accessCardsErrorList; }
set { _accessCardsErrorList = value; }
}
public List<UploadErrorOrSuccess> ErrorOrSuccessList
{
get { return _errorOrSuccessList; }
set { _errorOrSuccessList = value; }
}
private List<Employee> _employeesForSave = null;
private BasicDataUploadProcess _basicwithEmployee;
private DataUploadException _uploadException;
private List<EmployeeGradeSalary> oempgradesalarys;
private List<ADParameterEmployee> oadparamemployees;
private List<OpiParameterIndividual> oOpiParameterIndividuals;
private List<EmployeeBankAccount> oempbankaccounts;
private List<EmployeeCostCenter> oempCostCenters;
private List<EmpContact> _empContacts;
private List<LoanIssue> loanissues;
private List<LoanSchedule> loanschs;
private List<SalaryMonthlyDetail> _salaryDetails;
private List<OPIProcessDetailItem> _oPIProcessDetailItem;
private List<OpiParameterIndividual> _oPIParameterIndividual;
private List<OrganogramBasic> _oOrganogramBasics;
private List<OrganogramEmployee> _oOrganogramEmployees;
private List<IncomeTax> _incomeTaxes;
private List<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, List<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();
//// 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 = ExtractFromExcel(path, oColumnDefination.SheetName);
// //_uplodedData = Service.LoadExcelData(path, oColumnDefination.SheetName);
// //_uplodedData = Service.LoadData(path);
// _errorOrSuccessList = oColumnDefination.ValidateUploadedData(_uplodedData);
// this._payrollTypeID = oColumnDefination.PayrollTypeID;
// if (_errorOrSuccessList.Count > 0) return _errorOrSuccessList;
// switch (uploadId)
// {
// //case (int)EnumRegularDataUpload.EmployeeWithBasic:
// // this.ImportEmpBasicInfo();
// // break;
// //case (int)EnumRegularDataUpload.EmployeeDepartmentBasic:
// // this.ImportDeptInfo();
// // break;
// //case (int)EnumRegularDataUpload.Allowance:
// // this.ImportEmpIndividualAllowance(oColumnDefination);
// // break;
// //case (int)EnumRegularDataUpload.LTAdata:
// // this.ImportLTAData(oColumnDefination);
// // break;
// //case (int)EnumRegularDataUpload.ExceptionAllowance:
// // this.ImportEmpExceptionAllowance(oColumnDefination);
// // break;
// //case (int)EnumRegularDataUpload.EmpWorkPlanSetup:
// // this.ImportEmpWorkPlanSetup(oColumnDefination);
// // break;
// //case (int)EnumRegularDataUpload.NotApplicableAllowance:
// // this.ImportEmpNotApplicableAllowance(oColumnDefination);
// // break;
// //case (int)EnumRegularDataUpload.TaxChallan:
// // this.ImportITChallan(oColumnDefination);
// // break;
// //case (int)EnumRegularDataUpload.EmpCardInfo:
// // this.ImportEmpCardInfo(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.WPPFAllowance:
// // this.ImportWPPFAllowance(oColumnDefination);
// // break;
// case (int)EnumRegularDataUpload.TC:
// break;
// //case (int)EnumRegularDataUpload.EmpGradeSalary:
// // this.ImportEmpGradeSalaryAssignment(oColumnDefination);
// // break;
// //case (int)EnumRegularDataUpload.Organogram:
// // this.ImportOrganogram(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;
// //case (int)EnumRegularDataUpload.OrganogramData:
// // this.ImportOrganogramData(oColumnDefination);
// // break;
// case (int)EnumRegularDataUpload.EmployeeLineManagerUpload:
// this.ImportLineManager(oColumnDefination);
// break;
// default:
// this.ImportException(uploadId, oColumnDefination);
// break;
// }
// return _errorOrSuccessList;
//}
private static DataTable ExtractFromExcel(string path, string sheetName = "")
{
ImportHelper iHelper = new ImportHelper();
DataSet dDataSet = iHelper.Import(ImportHelper.Formats.Excel, path, true);
try
{
return string.IsNullOrEmpty(sheetName) ? dDataSet.Tables[0].Copy() : dDataSet.Tables[sheetName].Copy();
}
catch (Exception)
{
if (string.IsNullOrEmpty(sheetName))
{
throw new Exception("No sheet Found in Excel");
}
else
{
throw new Exception("Could not Find sheet with name:" + sheetName);
}
}
}
// public List<UploadErrorOrSuccess> UploadBonusData(int allowance, BonusProcess bProcess, int uploadId, int bonusID, DataUploadColumnDefinition oColumnDefination, string path, bool IsDisbursWithSalary, bool IsTaxProcess, double UsedProcess)
// {
// _uplodedData = ExtractFromExcel(path, oColumnDefination.SheetName);
// //_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 (bonusID.Integer == (int)EnumBATBBonusType.NonMgt_Spring && bProcess!=null)
// //{
// // _BonusProcess = this.ImportSpringAdjBonus(allowance,bProcess, oColumnDefination, IsDisbursWithSalary, IsTaxProcess, UsedProcess, bonusID);
// //}
// //else if (bonusID.Integer == (int)EnumBATBBonusType.NonMgt_Corporate && bProcess != null && oColumnDefination.SelectedItemOneID == (4))
// //{
// // _BonusProcess = this.ImportMgtCorporateIndvPercent(bProcess, oColumnDefination, IsDisbursWithSalary, IsTaxProcess, UsedProcess, bonusID);
// //}
// //else if (bonusID.Integer == (int)EnumBATBBonusType.Management_Corporate && bProcess != null && oColumnDefination.SelectedItemOneID == (0))
// //{
// // _BonusProcess = this.ImportEmpBonusAmount(bProcess, oColumnDefination, IsDisbursWithSalary, IsTaxProcess, UsedProcess, bonusID);
// //}
// //else
// //{
// _BonusProcess = this.ImportEmpBonus(oColumnDefination, IsDisbursWithSalary, IsTaxProcess, UsedProcess, bonusID);
// //}
// 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 = ExtractFromExcel(path, oSt);
// //_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.ChildrenList = 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 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 = ExtractFromExcel(path, oSt);
// //_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 = ExtractFromExcel(path, oSt);
// //_uplodedData = Service.LoadExcelData(path, oSt);
// columnDefination = null;
// switch (oSt)
// {
// case "General":
// columnDefination = new DataUploadColumnDefinition();
// columnDefination.HREmpGeneralInfo();
// 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 List<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);
// //new BasicDataUploadProcess().ProcessBasicData2(_uploadHRData.Tables["General"]);
// ProcessAllBasicData(_uploadHRData);
// 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 void ProcessAllBasicData(DataSet uploadSet)
// {
// foreach (DataTable oDT in uploadSet.Tables)
// {
// if (oDT.TableName == "Spouse")
// {
// foreach (DataRow row in oDT.Rows)
// {
// if (row["Employee No"].ToString() == "") continue;
// if (row["Spouse Level of Education"].ToString() == "") continue;
// EducationLevel oEducationLevel = _EducationLevels.Find(x => x.Description == row["Spouse Level of Education"].ToString());
// if (oEducationLevel == null)
// {
// oEducationLevel = new EducationLevel();
// oEducationLevel.Description = row["Spouse Level of Education"].ToString();
// oEducationLevel.Status = EnumStatus.Active;
// oEducationLevel.Save();
// _EducationLevels.Add(oEducationLevel);
// }
// if (row["Spouse Occupation"].ToString() == "") continue;
// Occupation oOccupation = _Occupations.Find(x => x.Description == row["Spouse Occupation"].ToString());
// if (oOccupation == null)
// {
// oOccupation = new Occupation();
// oOccupation.Description = row["Spouse Occupation"].ToString();
// oOccupation.Status = EnumStatus.Active;
// oOccupation.Save();
// _Occupations.Add(oOccupation);
// }
// }
// }
// else if (oDT.TableName == "General")
// {
// foreach (DataRow row in oDT.Rows)
// {
// if (row["Employee No"].ToString() == "") continue;
// if (row["Mother's Occupation"].ToString() == "") continue;
// Occupation oOccupation = _Occupations.Find(x => x.Description == row["Mother's Occupation"].ToString());
// if (oOccupation == null)
// {
// oOccupation = new Occupation();
// oOccupation.Description = row["Mother's Occupation"].ToString();
// oOccupation.Status = EnumStatus.Active;
// oOccupation.Save();
// _Occupations.Add(oOccupation);
// }
// if (row["Father's Occupation"].ToString() == "") continue;
// oOccupation = _Occupations.Find(x => x.Description == row["Father's Occupation"].ToString());
// if (oOccupation == null)
// {
// oOccupation = new Occupation();
// oOccupation.Description = row["Father's Occupation"].ToString();
// oOccupation.Status = EnumStatus.Active;
// oOccupation.Save();
// _Occupations.Add(oOccupation);
// }
// if (row["Religion"].ToString() == "") continue;
// Religion oReligion = _Religions.Find(x => x.Name == row["Religion"].ToString());
// if (oReligion == null)
// {
// oReligion = new Religion();
// oReligion.Name = row["Religion"].ToString();
// oReligion.Status = EnumStatus.Active;
// oReligion.Save();
// _Religions.Add(oReligion);
// }
// if (row["Category"].ToString() == "") continue;
// Category oCategory = _Categories.Find(x => x.Name == row["Category"].ToString());
// if (oCategory == null)
// {
// oCategory = new Category();
// oCategory.Name = row["Category"].ToString();
// oCategory.Status = EnumStatus.Active;
// oCategory.WagesType = EnumWagesType.Monthly;
// oCategory.Save();
// _Categories.Add(oCategory);
// }
// if (row["Nationality"].ToString() == "") continue;
// Nationality oNationality = _Nationalites.Find(x => x.Description == row["Nationality"].ToString());
// if (oNationality == null)
// {
// oNationality = new Nationality();
// oNationality.Description = row["Nationality"].ToString();
// oNationality.Status = EnumStatus.Active;
// oNationality.Save();
// _Nationalites.Add(oNationality);
// }
// }
// }
// else if (oDT.TableName == "Children")
// {
// foreach (DataRow row in oDT.Rows)
// {
// if (row["Employee No"].ToString() == "") continue;
// if (row["Child's Occupation"].ToString() == "") continue;
// Occupation oOccupation = _Occupations.Find(x => x.Description == row["Child's Occupation"].ToString());
// if (oOccupation == null)
// {
// oOccupation = new Occupation();
// oOccupation.Description = row["Child's Occupation"].ToString();
// oOccupation.Status = EnumStatus.Active;
// oOccupation.Save();
// _Occupations.Add(oOccupation);
// }
// }
// }
// else if (oDT.TableName == "Experience")
// {
// }
// else if (oDT.TableName == "Training")
// {
// foreach (DataRow row in oDT.Rows)
// {
// if (row["Employee No"].ToString() == "") continue;
// if (row["Training Type"].ToString() == "") continue;
// TrainingType oTrainingType = _TrainingTypes.Find(x => x.Name == row["Training Type"].ToString());
// if (oTrainingType == null)
// {
// oTrainingType = new TrainingType();
// oTrainingType.Name = row["Training Type"].ToString();
// oTrainingType.Status = EnumStatus.Active;
// oTrainingType.Save();
// _TrainingTypes.Add(oTrainingType);
// }
// if (row["NAture of Training"].ToString() == "") continue;
// NatureOfTraining oNatureOfTraining = _NatureOfTrainings.Find(x => x.Name == row["Nature of Training"].ToString());
// if (oNatureOfTraining == null)
// {
// oNatureOfTraining = new NatureOfTraining();
// oNatureOfTraining.Name = row["Nature of Training"].ToString();
// oNatureOfTraining.Status = EnumStatus.Active;
// oNatureOfTraining.Save();
// _NatureOfTrainings.Add(oNatureOfTraining);
// }
// if (row["Institution"].ToString() == "") continue;
// Institution oInstitution = _Institutions.Find(x => x.Name == row["Institution"].ToString());
// if (oInstitution == null)
// {
// oInstitution = new Institution();
// oInstitution.Name = row["Institution"].ToString();
// oInstitution.Status = EnumStatus.Active;
// oInstitution.Save();
// _Institutions.Add(oInstitution);
// }
// if (row["Country"].ToString() == "") continue;
// Country oCountry = _Contries.Find(x => x.Name == row["Country"].ToString());
// if (oCountry == null)
// {
// oCountry = new Country();
// oCountry.Name = row["Country"].ToString();
// oCountry.Status = EnumStatus.Active;
// oCountry.Save();
// _Contries.Add(oCountry);
// }
// }
// }
// else if (oDT.TableName == "Academic")
// {
// foreach (DataRow row in oDT.Rows)
// {
// if (row["Employee No"].ToString() == "") continue;
// if (row["Institution (Board/University)"].ToString() == "") continue;
// Institution oInstitution = _Institutions.Find(x => x.Name == row["Institution (Board/University)"].ToString());
// if (oInstitution == null)
// {
// oInstitution = new Institution();
// oInstitution.Name = row["Institution (Board/University)"].ToString();
// oInstitution.Status = EnumStatus.Active;
// oInstitution.Save();
// _Institutions.Add(oInstitution);
// }
// if (row["Degree Title"].ToString() == "") continue;
// EducationLevel oEducationLevel = _EducationLevels.Find(x => x.Description == row["Degree Title"].ToString());
// if (oEducationLevel == null)
// {
// oEducationLevel = new EducationLevel();
// oEducationLevel.Description = row["Degree Title"].ToString();
// oEducationLevel.Status = EnumStatus.Active;
// oEducationLevel.Save();
// _EducationLevels.Add(oEducationLevel);
// }
// if (row["Education Type"].ToString() == "") continue;
// EducationType oEducationType = _EducationTypes.Find(x => x.Description == row["Education Type"].ToString());
// if (oEducationType == null)
// {
// oEducationType = new EducationType();
// oEducationType.Description = row["Education Type"].ToString();
// oEducationType.Status = EnumStatus.Active;
// oEducationType.Save();
// _EducationTypes.Add(oEducationType);
// }
// if (row["Discipline/ Department"].ToString() == "") continue;
// Discipline oDiscipline = _Disciplines.Find(x => x.Description == row["Discipline/ Department"].ToString());
// if (oDiscipline == null)
// {
// oDiscipline = new Discipline();
// oDiscipline.Description = row["Discipline/ Department"].ToString();
// oDiscipline.Status = EnumStatus.Active;
// oDiscipline.Save();
// _Disciplines.Add(oDiscipline);
// }
// if (row["Result"].ToString() == "") continue;
// ResultType oResultType = _ResultTypes.Find(x => x.Description == row["Result"].ToString());
// if (oResultType == null)
// {
// oResultType = new ResultType();
// oResultType.Description = row["Result"].ToString();
// oResultType.Status = EnumStatus.Active;
// oResultType.Save();
// _ResultTypes.Add(oResultType);
// }
// }
// }
// else if (oDT.TableName == "Reference")
// {
// foreach (DataRow row in oDT.Rows)
// {
// if (row["Referee's Occupation"].ToString() == "") continue;
// Occupation oOccupation = _Occupations.Find(x => x.Description == row["Referee's Occupation"].ToString());
// if (oOccupation == null)
// {
// oOccupation = new Occupation();
// oOccupation.Description = row["Referee's Occupation"].ToString();
// oOccupation.Status = EnumStatus.Active;
// oOccupation.Save();
// _Occupations.Add(oOccupation);
// }
// if (row["Relation"].ToString() == "") continue;
// Relation oRelation = _Relations.Find(x => x.Description == row["Relation"].ToString());
// if (oRelation == null)
// {
// oRelation = new Relation();
// oRelation.Description = row["Relation"].ToString();
// oRelation.Status = EnumStatus.Active;
// oRelation.Save();
// _Relations.Add(oRelation);
// }
// }
// }
// else if (oDT.TableName == "Nominee")
// {
// foreach (DataRow row in oDT.Rows)
// {
// if (row["Nominee's Occupation"].ToString() == "") continue;
// Occupation oOccupation = _Occupations.Find(x => x.Description == row["Nominee's Occupation"].ToString());
// if (oOccupation == null)
// {
// oOccupation = new Occupation();
// oOccupation.Description = row["Nominee's Occupation"].ToString();
// oOccupation.Status = EnumStatus.Active;
// oOccupation.Save();
// _Occupations.Add(oOccupation);
// }
// if (row["Relation"].ToString() == "") continue;
// Relation oRelation = _Relations.Find(x => x.Description == row["Relation"].ToString());
// if (oRelation == null)
// {
// oRelation = new Relation();
// oRelation.Description = row["Relation"].ToString();
// oRelation.Status = EnumStatus.Active;
// oRelation.Save();
// _Relations.Add(oRelation);
// }
// if (row["Nomination Purpose"].ToString() == "") continue;
// NominationPurpose oNominationPurpose = _NominationPurposes.Find(x => x.Description == row["Nomination Purpose"].ToString());
// if (oNominationPurpose == null)
// {
// oNominationPurpose = new NominationPurpose();
// oNominationPurpose.Description = row["Nomination Purpose"].ToString();
// oNominationPurpose.Status = EnumStatus.Active;
// oNominationPurpose.Save();
// _NominationPurposes.Add(oNominationPurpose);
// }
// }
// }
// else if (oDT.TableName == "Hospitalization")
// {
// foreach (DataRow row in oDT.Rows)
// {
// if (row["Registered Person's Occupation"].ToString() == "") continue;
// Occupation oOccupation = _Occupations.Find(x => x.Description == row["Registered Person's Occupation"].ToString());
// if (oOccupation == null)
// {
// oOccupation = new Occupation();
// oOccupation.Description = row["Registered Person's Occupation"].ToString();
// oOccupation.Status = EnumStatus.Active;
// oOccupation.Save();
// _Occupations.Add(oOccupation);
// }
// if (row["Relation"].ToString() == "") continue;
// Relation oRelation = _Relations.Find(x => x.Description == row["Relation"].ToString());
// if (oRelation == null)
// {
// oRelation = new Relation();
// oRelation.Description = row["Relation"].ToString();
// oRelation.Status = EnumStatus.Active;
// oRelation.Save();
// _Relations.Add(oRelation);
// }
// }
// }
// else if (oDT.TableName == "Relative in this Company")
// {
// foreach (DataRow row in oDT.Rows)
// {
// if (row["Relation"].ToString() == "") continue;
// Relation oRelation = _Relations.Find(x => x.Description == row["Relation"].ToString());
// if (oRelation == null)
// {
// oRelation = new Relation();
// oRelation.Description = row["Relation"].ToString();
// oRelation.Status = EnumStatus.Active;
// oRelation.Save();
// _Relations.Add(oRelation);
// }
// }
// }
// else if (oDT.TableName == "Contacts")
// {
// foreach (DataRow row in oDT.Rows)
// {
// if (row["Permanent District"].ToString() == "") continue;
// District oDistrict = _Districts.Find(x => x.Name == row["Permanent District"].ToString());
// if (oDistrict == null)
// {
// oDistrict = new District();
// oDistrict.Name = row["Permanent District"].ToString();
// oDistrict.Status = EnumStatus.Active;
// oDistrict.Save();
// _Districts.Add(oDistrict);
// }
// if (row["Permanent Thana"].ToString() == "") continue;
// Thana oThana = _Thanas.Find(x => x.Name == row["Permanent Thana"].ToString());
// if (oThana == null)
// {
// oThana = new Thana();
// oThana.Name = row["Permanent Thana"].ToString();
// oThana.DistrictID = oDistrict.ID;
// oThana.Status = EnumStatus.Active;
// oThana.Save();
// _Thanas.Add(oThana);
// }
// if (row["Present District"].ToString() == "") continue;
// oDistrict = _Districts.Find(x => x.Name == row["Present District"].ToString());
// if (oDistrict == null)
// {
// oDistrict = new District();
// oDistrict.Name = row["Present District"].ToString();
// oDistrict.Status = EnumStatus.Active;
// oDistrict.Save();
// _Districts.Add(oDistrict);
// }
// if (row["Present Thana"].ToString() == "") continue;
// oThana = _Thanas.Find(x => x.Name == row["Present Thana"].ToString());
// if (oThana == null)
// {
// oThana = new Thana();
// oThana.Name = row["Present Thana"].ToString();
// oThana.DistrictID = oDistrict.ID;
// oThana.Status = EnumStatus.Active;
// oThana.Save();
// _Thanas.Add(oThana);
// }
// if (row["Relation"].ToString() == "") continue;
// Relation oRelation = _Relations.Find(x => x.Description == row["Relation"].ToString());
// if (oRelation == null)
// {
// oRelation = new Relation();
// oRelation.Description = row["Relation"].ToString();
// oRelation.Status = EnumStatus.Active;
// oRelation.Save();
// _Relations.Add(oRelation);
// }
// }
// }
// 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")
// {
// foreach (DataRow row in oDT.Rows)
// {
// if (row["Occupation"].ToString() == "") continue;
// Occupation oOccupation = _Occupations.Find(x => x.Description == row["Occupation"].ToString());
// if (oOccupation == null)
// {
// oOccupation = new Occupation();
// oOccupation.Description = row["Occupation"].ToString();
// oOccupation.Status = EnumStatus.Active;
// oOccupation.Save();
// _Occupations.Add(oOccupation);
// }
// if (row["Relation"].ToString() == "") continue;
// Relation oRelation = _Relations.Find(x => x.Description == row["Relation"].ToString());
// if (oRelation == null)
// {
// oRelation = new Relation();
// oRelation.Description = row["Relation"].ToString();
// oRelation.Status = EnumStatus.Active;
// oRelation.Save();
// _Relations.Add(oRelation);
// }
// }
// }
// }
// }
// 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 List<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 = ExtractFromExcel(path, oSt);
// //_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 = ExtractFromExcel(path, oSt);
// //_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 List<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 = ExtractFromExcel(path, oSt);
// //_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 List<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.Allowance:
case (int)EnumRegularDataUpload.ExceptionAllowance:
case (int)EnumRegularDataUpload.NotApplicableAllowance:
// {
// this.SaveEmpIndividualAllowance();
// break;
// }
//case (int)EnumRegularDataUpload.EmployeeWithBasic:
// {
// this.SaveEmpBasicInformation();
// break;
// }
//case (int)EnumRegularDataUpload.EmployeeDepartmentBasic:
// {
// this.SaveEmpDeptInformation();
// break;
// }
//case (int)EnumRegularDataUpload.EmpCardInfo:
// {
// this.SaveEmpCardInformation();
// break;
// }
//case (int)EnumRegularDataUpload.Bonus:
// {
// //this.SaveBonusInformation();
// 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.EmpWorkPlanSetup:
// {
// this.SaveEmployeeWorkPlanSetupInfo();
// 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:
//case (int)EnumRegularDataUpload.WPPFAllowance:
// {
// _basicwithEmployee.SaveTaxData();
// //this.SaveEmpTaxData(_incomeTaxes,EnumIncomeTaxDataFrom.ProcessTempData);
// break;
// }
case (int)EnumRegularDataUpload.TC:
{
break;
}
//case (int)EnumRegularDataUpload.EmpGradeSalary:
// {
// //this.SaveEmpGradeSalaryAssignment();
// this.SaveGradeSalary(_empLifeCycles);
// 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;
// }
//case (int)EnumRegularDataUpload.LTAdata:
// {
// this.SaveLTAData(aProcessDetailItems);
// break;
// }
//case (int)EnumRegularDataUpload.OrganogramData:
// {
// this.SaveOrganogramData();
// break;
// }
//case (int)EnumRegularDataUpload.EmployeeLineManagerUpload:
// {
// this.SaveEmpLineManager2();
// 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 ExtractFromExcel(filePath);
// }
// #endregion
// #region Import LTA Data
// public void ImportLTAData(DataUploadColumnDefinition _columnDefinition)
// {
// List<ArrearProcessDetail> arrearProcessDetails = null;
// List<Employee> oemployees = Employee.Get();
// ArrearProcessDetailItem apDetailItem = null;
// ArrearProcessDetailItem apDetailItemTemp = new ArrearProcessDetailItem();
// ArrearProcessDetailItemMonthly apItemMonthly = null;
// List<ArrearProcessDetailItemMonthly> apIMonthlys = null;
// string sEmpIDs = string.Empty;
// Employee oemployee = null;
// int nRow = 0;
// string processID = string.Empty;
// try
// {
// aProcessDetailItems = new List<ArrearProcessDetailItem>();
// apIMonthlys = new List<ArrearProcessDetailItemMonthly>();
// foreach (DataRow dr in _uplodedData.Rows)
// {
// nRow = nRow + 1;
// oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["EmpCode"].ToString(); });
// //sEmpIDs += oemployee.ID.ToString() + ",";
// if (oemployee != null)
// {
// int componentID = Convert.ToInt32(dr["ItemID"]);
// processID = dr["ProcessID"].ToString();
// arrearProcessDetails = new List<ArrearProcessDetail>();
// if (processID == string.Empty)
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Arrear Process ID.", nRow, "(" + dr["ProcessID"].ToString() + ")" + "Arrear Process int not found in the current context"));
// continue;
// }
// if (dr["ItemType"].ToString() == string.Empty)
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Item Type.", nRow, "(" + dr["ItemType"].ToString() + ")" + "Item Type not found in the current context"));
// continue;
// }
// if (dr["ItemID"].ToString() == string.Empty)
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Item ID.", nRow, "(" + dr["ItemID"].ToString() + ")" + "Item int not found in the current context"));
// continue;
// }
// if (dr["Description"].ToString() == string.Empty)
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Description.", nRow, "(" + dr["Description"].ToString() + ")" + "Description not found in the current context"));
// continue;
// }
// if (dr["Month"].ToString() == string.Empty)
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Month.", nRow, "(" + dr["Month"].ToString() + ")" + "Month not found in the current context"));
// continue;
// }
// if (dr["Amount"].ToString() == string.Empty)
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Amount.", nRow, "(" + dr["Amount"].ToString() + ")" + "Amount not found in the current context"));
// continue;
// }
// enumPayrollComponentType itemType = (enumPayrollComponentType)Convert.ToInt32(dr["ItemType"]);
// int arrearProcessDetailID = Convert.ToInt32(processID);
// apItemMonthly = new ArrearProcessDetailItemMonthly();
// apItemMonthly.ItemType = itemType;
// apItemMonthly.ItemID = componentID;
// apItemMonthly.Description = dr["Description"].ToString();
// apItemMonthly.CalculatedAmount = dr["Amount"].ToString() != string.Empty ? Convert.ToDouble(dr["Amount"]) : 0.0;
// apItemMonthly.ChangedAmount = apItemMonthly.CalculatedAmount;
// apItemMonthly.SalaryMonth = Convert.ToDateTime(dr["Month"]);
// apItemMonthly.DummyEmpID = oemployee.ID.Integer;
// apItemMonthly.IsUploaded = true;
// apIMonthlys.Add(apItemMonthly);
// apDetailItem = new ArrearProcessDetailItem();
// apDetailItem.ItemType = itemType;
// apDetailItem.ItemID = componentID;
// apDetailItem.Description = dr["Description"].ToString();
// apDetailItem.TempEmpID = oemployee.ID.Integer;
// arrearProcessDetails = new List<ArrearProcessDetail>();
// arrearProcessDetails = ArrearProcess.GetDetails((arrearProcessDetailID), apDetailItem.TempEmpID);
// if (arrearProcessDetails.Count == 0 || arrearProcessDetails == null)
// {
// continue;
// }
// apDetailItem.ArrearProcessDetailID = arrearProcessDetails[0].ID;
// //aProcessDetailItems.Add(apDetailItem);
// apDetailItemTemp = aProcessDetailItems.Find(o => o.TempEmpID == apDetailItem.TempEmpID && o.ItemType == apDetailItem.ItemType && o.ItemID == apDetailItem.ItemID && o.ChangedAmount == apDetailItem.ChangedAmount);
// if (apDetailItemTemp == null)
// {
// int count = apIMonthlys.Where(o => o.DummyEmpID == apDetailItem.TempEmpID && o.ItemType == apDetailItem.ItemType && o.ItemID == apDetailItem.ItemID).ToObjectsTemplate().Count();
// if (count == 1)
// {
// apDetailItem.ArrearProcessDetailItemMonthlys = apIMonthlys.Where(o => o.DummyEmpID == apDetailItem.TempEmpID && o.ItemType == apDetailItem.ItemType && o.ItemID == apDetailItem.ItemID).ToObjectsTemplate();
// apDetailItem.CalculatedAmount = apIMonthlys.Where(o => o.DummyEmpID == apDetailItem.TempEmpID && o.ItemType == apDetailItem.ItemType && o.ItemID == apDetailItem.ItemID).ToObjectsTemplate().Sum(o => o.ChangedAmount);
// apDetailItem.ChangedAmount = apDetailItem.CalculatedAmount;
// }
// else
// {
// aProcessDetailItems.RemoveAll((x) => x.TempEmpID == apDetailItem.TempEmpID && x.ItemType == apDetailItem.ItemType && x.ItemID == apDetailItem.ItemID);
// apDetailItem.ArrearProcessDetailItemMonthlys = apIMonthlys.Where(o => o.DummyEmpID == apDetailItem.TempEmpID && o.ItemType == apDetailItem.ItemType && o.ItemID == apDetailItem.ItemID).ToObjectsTemplate();
// apDetailItem.CalculatedAmount = apIMonthlys.Where(o => o.DummyEmpID == apDetailItem.TempEmpID && o.ItemType == apDetailItem.ItemType && o.ItemID == apDetailItem.ItemID).ToObjectsTemplate().Sum(o => o.ChangedAmount);
// apDetailItem.ChangedAmount = apDetailItem.CalculatedAmount;
// }
// apDetailItem.IsUploaded = true;
// aProcessDetailItems.Add(apDetailItem);
// }
// }
// else
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["EmpCode"].ToString() + ")" + "Employee not found for in the existing data"));
// }
// }
// }
// catch (Exception ex)
// {
// throw new ServiceException("Error occurred on row:" + nRow + " Reason:" + ex.Message);
// }
// //List<ArrearProcessDetail> arrearProcessDetails = null;
// //List<Employee> oemployees = Employee.GetAllEmps();
// //ArrearProcessDetailItem apDetailItem = null;
// //ArrearProcessDetailItem apDetailItemTemp = new ArrearProcessDetailItem();
// //ArrearProcessDetailItemMonthly apItemMonthly = null;
// //List<ArrearProcessDetailItemMonthly> apIMonthlys = null;
// //string sEmpIDs = string.Empty;
// //Employee oemployee = null;
// //List<ArrearProcessDetailItemMonthly> groupItem = new List<ArrearProcessDetailItemMonthly>();
// //int nRow = 0;
// //string processID = string.Empty;
// //try
// //{
// // apIMonthlys = new List<ArrearProcessDetailItemMonthly>();
// // foreach (DataRow dr in _uplodedData.Rows)
// // {
// // nRow = nRow + 1;
// // oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["EmpCode"].ToString(); });
// // sEmpIDs += oemployee.ID.ToString() + ",";
// // if (oemployee != null)
// // {
// // int componentID = Convert.ToInt32(dr["ItemID"]);
// // processID = dr["ProcessID"].ToString();
// // arrearProcessDetails = new List<ArrearProcessDetail>();
// // if (processID == string.Empty)
// // {
// // _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Arrear Process ID.", nRow, "(" + dr["ProcessID"].ToString() + ")" + "Arrear Process int not found in the current context"));
// // continue;
// // }
// // if (dr["ItemType"].ToString() == string.Empty)
// // {
// // _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Item Type.", nRow, "(" + dr["ItemType"].ToString() + ")" + "Item Type not found in the current context"));
// // continue;
// // }
// // if (dr["ItemID"].ToString() == string.Empty)
// // {
// // _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Item ID.", nRow, "(" + dr["ItemID"].ToString() + ")" + "Item int not found in the current context"));
// // continue;
// // }
// // if (dr["Description"].ToString() == string.Empty)
// // {
// // _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Description.", nRow, "(" + dr["Description"].ToString() + ")" + "Description not found in the current context"));
// // continue;
// // }
// // if (dr["Month"].ToString() == string.Empty)
// // {
// // _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Month.", nRow, "(" + dr["Month"].ToString() + ")" + "Month not found in the current context"));
// // continue;
// // }
// // if (dr["Amount"].ToString() == string.Empty)
// // {
// // _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Amount.", nRow, "(" + dr["Amount"].ToString() + ")" + "Amount not found in the current context"));
// // continue;
// // }
// // enumPayrollComponentType itemType = (enumPayrollComponentType)Convert.ToInt32(dr["ItemType"]);
// // int arrearProcessDetailID = Convert.ToInt32(processID);
// // apItemMonthly = new ArrearProcessDetailItemMonthly();
// // apItemMonthly.ItemType = itemType;
// // apItemMonthly.ItemID = componentID;
// // apItemMonthly.Description = dr["Description"].ToString();
// // apItemMonthly.CalculatedAmount = dr["Amount"].ToString() != string.Empty ? Convert.ToDouble(dr["Amount"]) : 0.0;
// // apItemMonthly.ChangedAmount = apItemMonthly.CalculatedAmount;
// // apItemMonthly.SalaryMonth = Convert.ToDateTime(dr["Month"]);
// // apItemMonthly.DummyEmpID = oemployee.ID.Integer;
// // apIMonthlys.Add(apItemMonthly);
// // if (groupItem.FirstOrDefault(x => x.ItemType == itemType && x.ItemID == componentID) == null)
// // {
// // groupItem.Add(apItemMonthly);
// // }
// // }
// // else
// // {
// // _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["EmpCode"].ToString() + ")" + "Employee not found for in the existing data"));
// // }
// // }
// // if (_errorOrSuccessList.Count == 0)
// // {
// // List<ArrearProcessDetail> processedDetails = ArrearProcess.Service.GetArrearProcessDetails((Convert.ToInt32(processID)));
// // aProcessDetailItems = new List<ArrearProcessDetailItem>();
// // foreach (ArrearProcessDetailItemMonthly item in groupItem)
// // {
// // apDetailItem = new ArrearProcessDetailItem();
// // apDetailItem.ItemType = item.ItemType;
// // apDetailItem.ItemID = item.ItemID;
// // apDetailItem.Description = item.Description;
// // // apDetailItem.TempEmpID = oemployee.ID.Integer;
// // ArrearProcessDetail pdetail = processedDetails.FirstOrDefault(x => x.EmployeeID.Integer == item.DummyEmpID);
// // if (pdetail == null)
// // {
// // _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee int : " + " Not Found in the Arrear Process", 0, "" + "Employee not found for in the existing data"));
// // continue;
// // }
// // apDetailItem.ArrearProcessDetailItemMonthlys = apIMonthlys.FindAll(x => item.ItemType == x.ItemType && x.ItemID == item.ItemID).ToObjectsTemplate();
// // apDetailItem.CalculatedAmount = apDetailItem.ArrearProcessDetailItemMonthlys.Sum(x => x.CalculatedAmount);
// // apDetailItem.ChangedAmount = apDetailItem.CalculatedAmount;
// // apDetailItem.ArrearProcessDetailID = pdetail.ID;
// // aProcessDetailItems.Add(apDetailItem);
// // }
// // }
// //}
// //catch (Exception ex)
// //{
// // throw new ServiceException("Error occurred on row:" + nRow + " Reason:" + ex.Message);
// //}
// }
// #endregion
// #region Import Individual Employee Allowances
// public void ImportEmpIndividualAllowance(DataUploadColumnDefinition _columnDefinition)
// {
// List<Employee> oemployees = Employee.Get();
// List<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; //(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;
// }
// List<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!=(14))
// //{
// if (oadparamemp.Periodicity == EnumPeriodicity.OneOff)
// {
// oadparamemp.FormDate = Payroll.BO.PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(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.PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(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.PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(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.PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(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);
// }
// }
// public void ImportEmpWorkPlanSetup(DataUploadColumnDefinition _columnDefinition)
// {
// List<Employee> oemployees = Employee.Get();
// List<Employee> tempEmployees = new List<Employee>();
// Employee tempEmployee = null;
// Employee oemployee = null;
// EmployeeWorkPlanSetup empWPSetup = null;
// List<WorkPlanGroup> _workPlanGroups = WorkPlanGroup.Get();
// List<Shift> _shifts = Shift.Get();
// Shift shift = null;
// WorkPlanGroup workPlanGroup = null;
// _employeeWorkPlanSetups = new List<EmployeeWorkPlanSetup>();
// List<ShiftRotation> _shiftRotations = ShiftRotation.Get(EnumStatus.Active);
// ShiftRotation sRotation = 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)
// {
// tempEmployee = tempEmployees.Where(o => o.int == oemployee.ID).FirstOrDefault();
// if (tempEmployee != null)
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Duplicate Employee Entry Found"));
// continue;
// }
// tempEmployees.Add(oemployee);
// empWPSetup = new EmployeeWorkPlanSetup();
// empWPSetup.EmployeeID = oemployee.ID;
// if (dr["WorkPlanGroup"].ToString().Trim() == "")
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("WorkplanGroup : " + dr["WorkPlanGroup"].ToString() + " Row : ", nRow, " WorkPlanGroup Can't Be Empty"));
// continue;
// }
// if (dr["StartDate"].ToString().Trim() == "")
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("StartDate : " + dr["StartDate"].ToString() + " Row : ", nRow, " Start Date Can't Be Empty"));
// continue;
// }
// workPlanGroup = _workPlanGroups.Where(o => o.Name == dr["WorkPlanGroup"].ToString().Trim()).FirstOrDefault();
// if (workPlanGroup == null)
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("WorkplanGroup : " + dr["WorkplanGroup"].ToString() + " Row : ", nRow, dr["WorkplanGroup"].ToString() + " WorkplanGroup Is Not Valid"));
// continue;
// }
// if (workPlanGroup.WorkPlanGroupType != EnumWorkPlanGroupType.Fixed)
// {
// if (dr["Start Shift"].ToString().Trim() == "")
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Start Shift : " + dr["Start Shift"].ToString() + " Row : ", nRow, " Start Shift Can't Be Empty for " + workPlanGroup.Name));
// continue;
// }
// shift = _shifts.Where(o => o.ShortName == dr["Start Shift"].ToString().Trim()).FirstOrDefault();
// if (shift == null)
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Start Shift : " + dr["Start Shift"].ToString() + " Row : ", nRow, dr["Start Shift"].ToString() + " Start Shift Is Not Valid"));
// continue;
// }
// sRotation = _shiftRotations.Where(o => o.ShiftID == shift.int && o.WorkPlanType == workPlanGroup.WorkPlanGroupType).FirstOrDefault();
// if (sRotation == null)
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Start Shift : " + dr["Start Shift"].ToString() + " Row : ", nRow, dr["Start Shift"].ToString() + " Start Shift Is Not Found In Shift Rotation"));
// continue;
// }
// }
// empWPSetup.WorkPlanGroupID = workPlanGroup.ID;
// empWPSetup.StartDate = Convert.ToDateTime(dr["StartDate"]);
// if (workPlanGroup.WorkPlanGroupType != EnumWorkPlanGroupType.Fixed)
// empWPSetup.ShiftID = shift.ID;
// else
// {
// empWPSetup.SaturdayShiftID = workPlanGroup.SaturdayShiftID;
// empWPSetup.SundayShiftID = workPlanGroup.SundayShiftID;
// empWPSetup.MondayShiftID = workPlanGroup.MondayShiftID;
// empWPSetup.TuesdayShiftID = workPlanGroup.TuesdayShiftID;
// empWPSetup.WednesdayShiftID = workPlanGroup.WednesdayShiftID;
// empWPSetup.ThursdayShiftID = workPlanGroup.ThursdayShiftID;
// empWPSetup.FridayShiftID = workPlanGroup.FridayShiftID;
// empWPSetup.WeekEndOn = workPlanGroup.WeekEndOn;
// empWPSetup.WeekEndOn2 = workPlanGroup.WeekEndOn2;
// }
// _employeeWorkPlanSetups.Add(empWPSetup);
// }
// 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 ImportEmpExceptionAllowance(DataUploadColumnDefinition _columnDefinition)
// {
// List<Employee> oemployees = Employee.Get();
// List<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; //(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;
// }
// List<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!=(14))
// //{
// if (oadparamemp.Periodicity == EnumPeriodicity.OneOff)
// {
// oadparamemp.FormDate = Payroll.BO.PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
// oadparamemp.TillDate = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
// }
// else if (oadparamemp.Periodicity == EnumPeriodicity.Monthly && oparamter.EntitleType == EnumEntitleType.Grade)
// {
// // 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.PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(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.PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(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.PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(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.Exception;
// 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);
// }
// }
// public void ImportEmpNotApplicableAllowance(DataUploadColumnDefinition _columnDefinition)
// {
// List<Employee> oemployees = Employee.Get();
// List<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 = 0.0;
// oadparamemp.AllowDeductID = _columnDefinition.SelectedItemOneID; //(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;
// }
// List<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!=(14))
// //{
// if (oadparamemp.Periodicity == EnumPeriodicity.OneOff)
// {
// oadparamemp.FormDate = Payroll.BO.PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
// oadparamemp.TillDate = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
// }
// else if (oadparamemp.Periodicity == EnumPeriodicity.Monthly && oparamter.EntitleType == EnumEntitleType.Grade)
// {
// oadparamemp.FormDate = Payroll.BO.PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
// }
// else
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No :" + dr["Employee No"].ToString() + " Row : ", nRow, "Employee applicable parameter is defined greade wise"));
// continue;
// }
// //}
// oadparamemp.ADEmpType = EnumADEmpType.NotApplicable;
// 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 Individual Employee Deductions
// public void ImportEmpIndividualDeduction(DataUploadColumnDefinition _columnDefinition)
// {
// List<Employee> oemployees = Employee.Get();
// 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; //(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<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.PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(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.PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(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.PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(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.PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(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<GradeSalaryChangeType> gstypes = new List<GradeSalaryChangeType>();
// gstypes = GradeSalaryChangeType.Get();
// _empLifeCycles = new List<EmpLifeCycle>();
// GradeSalaryChangeType empStatus = null;
// List<Employee> tempEmployee = new List<Employee>();
// EmpLifeCycle empLifeCycle = new EmpLifeCycle();
// if (_columnDefinition.SelectedItemOneID == null)
// {
// throw new ServiceException("No event has been selected. Please select an event first ");
// }
// empStatus = gstypes.Where(o => o.int == _columnDefinition.SelectedItemOneID).FirstOrDefault();
// List<Employee> oemployees = Employee.Get();
// Employee oemployee = null;
// List<Grade> ogrades = Grade.Get(EnumStatus.Active);
// Grade ograde = null;
// int nRow = 0;
// int empCount = 0;
// oempgradesalarys = new List<EmployeeGradeSalary>();
// 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)
// {
// tempEmployee.Add(oemployee);
// empCount = tempEmployee.Where(o => o.EmployeeNo == oemployee.EmployeeNo).ToList().Count();
// if (empCount > 1)
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "Employee No: (" + dr["Employee No"].ToString() + ")" + " is used twice in this Sheet"));
// continue;
// }
// #region new Method Using EmpLifeCycle object
// tempEmployee.Add(oemployee);
// empLifeCycle = new EmpLifeCycle();
// empLifeCycle.EmployeeID = oemployee.ID;
// ograde = ogrades.Find(delegate(Grade grd) { return grd.Code == dr["Grade"].ToString(); });
// if (ograde != null)
// {
// empLifeCycle.GradeID = ograde.ID;
// }
// else
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Grade.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee grade id not found."));
// continue;
// }
// if (dr["Effect Date"].ToString() == string.Empty)
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Effect Date.", nRow, "(" + dr["Effect Date"].ToString() + ")" + "Effect Date not found in the current context"));
// continue;
// }
// empLifeCycle.DesignationID = oemployee.DesignationID;
// empLifeCycle.EffectDate = Convert.ToDateTime(dr["Effect Date"]);
// empLifeCycle.SalaryMonth = PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(empLifeCycle.EffectDate);
// empLifeCycle.BasicSalary = dr["Basic"].ToString() != string.Empty ? Convert.ToDouble(dr["Basic"]) : 0.0;
// empLifeCycle.StatusDetailID = empStatus.ID;
// if (User.CurrentUser.LogInPayrollTypeID.Integer != 1)
// empLifeCycle.IncrementNo = Convert.ToInt32(dr["IncrementNo"]);
// EmployeeGradeSalary ogs = new EmployeeGradeSalary();
// ogs.BasicSalary = (double)empLifeCycle.BasicSalary;
// if (ograde != null)
// {
// ogs.GradeID = ograde.ID;
// }
// else
// {
// ogs.GradeID = oemployee.GradeID;
// }
// ogs.EmployeeID = empLifeCycle.EmployeeID;
// ogs.GradeSalaryTypeID = empStatus.ID;
// ogs.EffectDate = empLifeCycle.EffectDate;
// empLifeCycle.EmployeeGradeSalary = ogs;
// HREmployee oHr = new HREmployee();
// oHr.BasicSalary = (double)empLifeCycle.BasicSalary;
// oHr.GradeID = empLifeCycle.GradeID;
// oHr.DesignationID = oemployee.DesignationID;
// oHr.DepartmentID = oemployee.DepartmentID;
// oHr.CategoryID = oemployee.CategoryID;
// oHr.LocationID = oemployee.LocationID;
// oHr.DescriptionText = "Grade & Salary Change From Interface";
// empLifeCycle.HREmployee = oHr;
// _empLifeCycles.Add(empLifeCycle);
// #endregion
// }
// 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 CreateChildNodes(string parentPositionNo, DataTable dtOld, List<Employee> oemployees, List<Designation> oDesignations)
// {
// string ss = "";
// try
// {
// if (nMasterCount == 152)
// nMasterCount = 152;
// int nRowCount = 1;
// //DataTable dtChilds = dtOld.Clone();
// DataTable dtChilds = null;
// var accItems = dtOld.AsEnumerable().Where(x => x["Line Manager No"].ToString().Trim() == parentPositionNo);
// if (accItems.Count() > 0)
// dtChilds = accItems.CopyToDataTable();
// //dtChilds = GetChilds(parentPositionNo, dtOld);
// if (parentPositionNo == "MT9136")
// parentPositionNo = "MT9136";
// if (dtChilds != null)
// {
// foreach (DataRow dr in dtChilds.Rows)
// {
// if (dr["Employee No"].ToString() == "07187")
// ss = "";
// //UpdateprocessStatus("Creating node : " + dr["Position_No"].ToString() + ". Record fetched " + nRowCount.ToString() + "/" + dtChilds.Rows.Count.ToString());
// //UpdateProgressStatus(EnumProcessStatus.PerformStep);
// OrganogramBasic oOrganogramBasic3 = _oOrganogramBasics.Find(delegate(OrganogramBasic oItem) { return oItem.PositionNo.ToUpper().Trim() == dr["Employee No"].ToString().ToUpper().Trim(); });
// Employee oEmp = oemployees.Find(x => x.EmployeeNo == dr["Employee No"].ToString());
// if (oEmp != null)
// {
// if (oOrganogramBasic3 == null)
// {
// Designation oDeg = oDesignations.Find(x => x.int == oEmp.DesignationID);
// OrganogramBasic oOrganogramBasic = new OrganogramBasic();
// oOrganogramBasic.PositionNo = dr["Employee No"].ToString().Trim();
// oOrganogramBasic.PositionName = oDeg == null ? "" : oDeg.Name;
// oOrganogramBasic.DepartmentID = oEmp.DepartmentID == null ? (1) : oEmp.DepartmentID;
// oOrganogramBasic.LocationID = oEmp.LocationID == null ? (1) : oEmp.LocationID;
// oOrganogramBasic.GradeID = oEmp.GradeID == null ? (1) : oEmp.GradeID;
// oOrganogramBasic.DesignationID = oEmp.DesignationID == null ? (1) : oEmp.DesignationID;
// oOrganogramBasic.FunctionID = (1);
// oOrganogramBasic.CompanyID = (1);
// OrganogramBasic oOrganogramBasic2 = _oOrganogramBasics.Find(delegate(OrganogramBasic oItem) { return oItem.PositionNo.ToUpper().Trim() == dr["Line Manager No"].ToString().ToUpper().Trim(); });
// if (oOrganogramBasic2 != null)
// {
// oOrganogramBasic.ParentID = oOrganogramBasic2.ID;
// oOrganogramBasic.Tier = oOrganogramBasic2.Tier + 1;
// }
// //else
// // SetErrorSuccessObjects(EnumReceiveStatus.Error, oErrorLogDetails, oSuccessLogDetails, "Parent position no:" + dr["Parent_Position_No"].ToString().Trim() + " not found.Sheet name=" + dtOld.TableName + " ,Row no=" + nOrgRowCount.ToString(), new HREmployee(), EnumErrorType.Organogram);
// oOrganogramBasic.RevisionDate = DateTime.Today;
// oOrganogramBasic.Save();
// _oOrganogramBasics.Add(oOrganogramBasic);
// //SetErrorSuccessObjects(EnumReceiveStatus.Success, oErrorLogDetails, oSuccessLogDetails, "Position_No: " + dr["Position_No"].ToString().Trim() + ",Name: " + dr["Position_Name"].ToString().Trim(), new HREmployee(), EnumErrorType.Organogram);
// }
// nMasterCount++;
// CreateChildNodes(dr["Employee No"].ToString().Trim(), dtOld, oemployees, oDesignations);
// }
// else
// {
// int n = 1;
// }
// //nOrgRowCount++;
// }
// }
// }
// catch (Exception exp)
// {
// nMasterCount++;
// throw new Exception(exp.Message + ss);
// }
// }
// public void ImportOrganogram(DataUploadColumnDefinition _columnDefinition)
// {
// #region Create Organogram
// List<Employee> oemployees = Employee.Get();
// List<Designation> oDesignations = Designation.Get(EnumStatus.Active);
// try
// {
// OrganogramBasic oOrg = new OrganogramBasic();
// oOrg.DeleteAll();
// _oOrganogramBasics = new List<OrganogramBasic>();
// _oOrganogramBasics = OrganogramBasic.Get(EnumStatus.Regardless);
// List<OrganogramBasic> oParentOrganogramNodes = new List<OrganogramBasic>();
// //oParentOrganogramNodes = _oOrganogramNodes.FindAll(delegate(OrganogramBasic oItem) { return oItem.ParentID == null || oItem.ParentID.IsUnassigned; });
// //nOrgRowCount = 1;
// if (_uplodedData == null) return;
// if (_uplodedData.Rows.Count == 0) return;
// DataTable dtOrg = null;
// var accItems = _uplodedData.AsEnumerable().Where(x => x["Line Manager No"].ToString().Trim() == "");
// if (accItems.Count() > 0)
// dtOrg = accItems.CopyToDataTable();
// foreach (DataRow oDr in dtOrg.Rows)
// {
// //ss = oDr["Employee No"].ToString().Trim();
// //UpdateprocessStatus("Creating node : " + oDr["Employee No"].ToString() + ". Record fetched " + nOrgRowCount.ToString() + "/" + dtOrg.Rows.Count.ToString());
// //UpdateProgressStatus(EnumProcessStatus.PerformStep);
// if (oDr["Employee No"].ToString() == "")
// {
// //SetErrorSuccessObjects(EnumReceiveStatus.Error, oErrorLogDetails, oSuccessLogDetails, "Position_No and Position Name must have value. Sheet name=" + oDTable.TableName + ", Row no=" + nOrgRowCount.ToString(), new HREmployee(), EnumErrorType.BasicData);
// }
// else
// {
// OrganogramBasic oOrganogramBasic = _oOrganogramBasics.Find(delegate(OrganogramBasic oItem) { return oItem.PositionNo.ToUpper().Trim() == oDr["Employee No"].ToString().ToUpper().Trim(); });
// //if (oDr["Parent_Position_No"].ToString() == "")
// //{
// Employee oEmp = oemployees.Find(x => x.EmployeeNo == oDr["Employee No"].ToString());
// if (oEmp != null)
// {
// Designation oDeg = oDesignations.Find(x => x.int == oEmp.DesignationID);
// if (oOrganogramBasic == null)
// {
// oOrganogramBasic = new OrganogramBasic();
// oOrganogramBasic.PositionNo = oDr["Employee No"].ToString().Trim();
// oOrganogramBasic.PositionName = oDeg == null ? "" : oDeg.Name;
// oOrganogramBasic.DepartmentID = oEmp.DepartmentID;
// oOrganogramBasic.LocationID = oEmp.LocationID;
// oOrganogramBasic.GradeID = oEmp.GradeID;
// oOrganogramBasic.DesignationID = oEmp.DesignationID;
// oOrganogramBasic.RevisionDate = DateTime.Today;
// oOrganogramBasic.ParentID = null;
// oOrganogramBasic.Tier = 1;
// oOrganogramBasic.FunctionID = (1);
// oOrganogramBasic.CompanyID = (1);
// oOrganogramBasic.Save();
// _oOrganogramBasics.Add(oOrganogramBasic);
// oParentOrganogramNodes.Add(oOrganogramBasic);
// //SetErrorSuccessObjects(EnumReceiveStatus.Success, oErrorLogDetails, oSuccessLogDetails, "Position_No: " + oDr["Position_No"].ToString().Trim() + ",Name: " + oDr["Position_Name"].ToString().Trim(), new HREmployee(), EnumErrorType.BasicData);
// //nOrgRowCount++;
// }
// else
// {
// oParentOrganogramNodes.Add(oOrganogramBasic);
// }
// }
// //}
// }
// //nOrgRowCount++;
// }
// //DataView view = new DataView(oDTable);
// //DataTable dtParents = view.ToTable(true, "Parent_Position_No");
// //int nCount = 1;
// foreach (OrganogramBasic org in oParentOrganogramNodes)
// {
// CreateChildNodes(org.PositionNo, _uplodedData, oemployees, oDesignations);
// }
// }
// catch (Exception ex)
// {
// throw new ServiceException(ex.Message);
// }
// #endregion
// foreach (DataRow oDr in _uplodedData.Rows)
// {
// Employee oEmp = oemployees.Find(x => x.EmployeeNo == oDr["Employee No"].ToString());
// OrganogramBasic org = _oOrganogramBasics.Find(x => x.PositionNo == oDr["Employee No"].ToString().Trim());
// if (org != null && oEmp != null)
// {
// OrganogramEmployee orgEmp = new OrganogramEmployee();
// orgEmp.NodeID = org.ID;
// orgEmp.EmployeeID = oEmp.ID;
// orgEmp.AssignDate = oEmp.JoiningDate;
// orgEmp.Save();
// }
// }
// }
// private void ImportOrganogramData(DataUploadColumnDefinition oColumnDefination)
// {
// this.SaveOrganogram(_uplodedData);
// }
// private void SaveOrganogram(DataTable oDTable)
// {
// OrganogramEmployee.DeleteAll();
// OrganogramBasic oOrga = new OrganogramBasic();
// oOrga.DeleteAll();
// int nRow = 0;
// string ss = "";
// PayrollPayrollGlobalFunctions.SetProgressbarMaxValue = oDTable.Rows.Count;
// PayrollPayrollGlobalFunctions.TotalEmployeeCount = oDTable.Rows.Count;
// OrganogramBasic oOrg = new OrganogramBasic();
// _oOrganogramNodes = new List<OrganogramBasic>();
// List<Designation> oDesignations = Designation.Get(EnumStatus.Regardless);
// //_oOrganogramNodes = OrganogramBasic.Get(EnumStatus.Regardless);
// oParentOrganogramNodes = new List<OrganogramBasic>();
// try
// {
// //foreach (DataRow dr in oDTable.Rows)
// //{
// // nRow = nRow + 1;
// // ss = dr["Position No"].ToString();
// // OrganogramBasic oOrganogramBasic3 = _oOrganogramNodes.Find(delegate(OrganogramBasic oItem) { return oItem.PositionNo.ToUpper().Trim() == dr["Position No"].ToString().ToUpper().Trim(); });
// // if (oOrganogramBasic3 == null)
// // {
// // OrganogramBasic oOrganogramBasic = new OrganogramBasic();
// // oOrganogramBasic.PositionNo = dr["Position No"].ToString().Trim();
// // oOrganogramBasic.PositionName = dr["Position No"].ToString().Trim();
// // oOrganogramBasic.DepartmentID = (1);
// // oOrganogramBasic.LocationID = (1);
// // oOrganogramBasic.GradeID = (1);
// // oOrganogramBasic.DesignationID = (1);
// // oOrganogramBasic.FunctionID = (1);
// // oOrganogramBasic.CompanyID = (1);
// // OrganogramBasic oOrganogramBasic2 = _oOrganogramNodes.Find(delegate(OrganogramBasic oItem) { return oItem.PositionNo.ToUpper().Trim() == dr["Parent Position No"].ToString().ToUpper().Trim(); });
// // if (oOrganogramBasic2 != null)
// // {
// // oOrganogramBasic.ParentID = oOrganogramBasic2.ID;
// // oOrganogramBasic.Tier = oOrganogramBasic2.Tier + 1;
// // }
// // //else
// // // _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Parent Position No.", nRow, "Parent position no:" + dr["Parent Position No"].ToString().Trim() + " not found."));
// // oOrganogramBasic.RevisionDate = DateTime.Today;
// // oOrganogramBasic.Save();
// // _oOrganogramNodes.Add(oOrganogramBasic);
// // }
// //}
// nOrgRowCount = 1;
// if (oDTable == null) return;
// if (oDTable.Rows.Count == 0) return;
// DataTable dtOrg = null;
// var accItems = oDTable.AsEnumerable().Where(x => x["Parent Position No"].ToString().Trim() == "");
// if (accItems.Count() > 0)
// dtOrg = accItems.CopyToDataTable();
// foreach (DataRow oDr in dtOrg.Rows)
// {
// ss = oDr["Position No"].ToString().Trim();
// if (oDr["Position No"].ToString() == "")
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Position No.", nOrgRowCount, "Position No must have value"));
// }
// else
// {
// OrganogramBasic oOrganogramBasic = _oOrganogramNodes.Find(delegate(OrganogramBasic oItem) { return oItem.PositionNo.ToUpper().Trim() == oDr["Position No"].ToString().ToUpper().Trim(); });
// if (oOrganogramBasic == null)
// {
// oOrganogramBasic = new OrganogramBasic();
// Designation oDeg = oDesignations.Find(x => x.Name.ToLower().Trim() == oDr["Designation"].ToString().ToLower().Trim());
// oOrganogramBasic.PositionNo = oDr["Position No"].ToString().Trim();
// oOrganogramBasic.PositionName = oDeg == null ? "" : oDeg.Name;
// oOrganogramBasic.DepartmentID = (1);
// oOrganogramBasic.LocationID = (1);
// oOrganogramBasic.GradeID = (1);
// oOrganogramBasic.DesignationID =oDeg==null? (1):oDeg.ID;
// oOrganogramBasic.RevisionDate = DateTime.Today;
// oOrganogramBasic.ParentID = null;
// oOrganogramBasic.Tier = 1;
// oOrganogramBasic.FunctionID = (1);
// oOrganogramBasic.CompanyID = (1);
// oOrganogramBasic.Save();
// _oOrganogramNodes.Add(oOrganogramBasic);
// oParentOrganogramNodes.Add(oOrganogramBasic);
// }
// else
// {
// oParentOrganogramNodes.Add(oOrganogramBasic);
// }
// //}
// }
// nOrgRowCount++;
// }
// foreach (OrganogramBasic org in oParentOrganogramNodes)
// {
// CreateChildNodes(org.PositionNo, oDTable, oDesignations);
// }
// ImportPosting(oDTable);
// }
// catch (Exception exp)
// {
// throw new Exception(exp.Message + ss);
// }
// }
// public void ImportPosting(DataTable oDTable)
// {
// try
// {
// //new OrganogramEmployee().DeleteAll();
// DataTable tablePosting = new DataTable("OrganEmployee");
// // construct DataTable
// tablePosting.Columns.Add(new DataColumn("OrganEmpID", typeof(Int64)));
// tablePosting.Columns.Add(new DataColumn("NodeID", typeof(Int64)));
// tablePosting.Columns.Add(new DataColumn("EmployeeID", typeof(Int64)));
// tablePosting.Columns.Add(new DataColumn("AssignDate", typeof(string)));
// tablePosting.Columns.Add(new DataColumn("CreatedBy", typeof(int)));
// tablePosting.Columns.Add(new DataColumn("CreationDate", typeof(DateTime)));
// tablePosting.Columns.Add(new DataColumn("ModifiedBy", typeof(int)));
// tablePosting.Columns.Add(new DataColumn("ModifiedDate", typeof(DateTime)));
// List<OrganogramEmployee> oOrganEmployees = new List<OrganogramEmployee>();
// OrganogramEmployee oOrganEmp = null;
// List<OrganogramEmployee> oPostings = OrganogramEmployee.Get();
// List<HREmployee> oExistingHREmployees = HREmployee.Get();
// DataTable dtOrganogramEmployee = null;
// dtOrganogramEmployee = oDTable;
// List<OrganogramEmployee> AssignOrganograms = OrganogramEmployee.Get();
// OrganogramEmployee oOrganogramEmployee = null;
// PayrollPayrollGlobalFunctions.SetProgressbarMaxValue = dtOrganogramEmployee.Rows.Count;
// PayrollPayrollGlobalFunctions.TotalEmployeeCount = dtOrganogramEmployee.Rows.Count;
// if (dtOrganogramEmployee != null)
// {
// int nPosCount = 1;
// long nID = 1;
// foreach (DataRow oDrOrg in dtOrganogramEmployee.Rows)
// {
// HREmployee oIsOld = oExistingHREmployees.Find(delegate(HREmployee oee) { return oee.EmployeeNo == oDrOrg["Position No"].ToString(); });
// //OrganogramEmployee oOldOrganogramEmployee = AssignOrganograms.Find(delegate(OrganogramEmployee oee1) { return oee1.Position.PositionNo == oDrOrg["Position_No"].ToString(); });
// if (oIsOld != null)
// {
// DateTime dTempDate;
// oOrganogramEmployee = new OrganogramEmployee();
// oOrganogramEmployee.AssignDate = DateTime.Today;
// OrganogramBasic oOrg = _oOrganogramNodes.Find(delegate(OrganogramBasic oItem) { return oItem.PositionNo.ToUpper().Trim() == oDrOrg["Position No"].ToString().ToUpper().Trim(); });
// if (oOrg != null)
// {
// oOrganogramEmployee.NodeID = oOrg.ID;
// oOrganogramEmployee.EmployeeID = oIsOld.ID;
// oOrganEmployees.Add(oOrganogramEmployee);
// nID++;
// }
// //else
// //SetErrorSuccessObjects(EnumReceiveStatus.Error, oErrorLogDetails, oSuccessLogDetails, "Position_No: " + oDrOrg["Position_No"].ToString().Trim() + " not found.Sheet name=" + dtOrganogramEmployee.TableName + ", Row no=" + nPosCount.ToString(), oIsOld, EnumErrorType.BasicData);
// }
// //else
// //SetErrorSuccessObjects(EnumReceiveStatus.Error, oErrorLogDetails, oSuccessLogDetails, "Employee PIN: " + oDrOrg["Employee_PIN"].ToString().Trim() + " not found.Sheet name=" + dtOrganogramEmployee.TableName + ", Row no=" + nPosCount.ToString(), new HREmployee(), EnumErrorType.BasicData);
// nPosCount++;
// }
// OrganogramEmployee.Save(oOrganEmployees);
// //new HREmployee().RunQuery("OrganEmployeeTemp", "OrganEmployee");
// }
// }
// catch (Exception ex)
// {
// //SetErrorSuccessObjects(EnumReceiveStatus.Error, oErrorLogDetails, oSuccessLogDetails, "System Error: " + ex.Message, new HREmployee(), EnumErrorType.SystemError);
// throw new ServiceException(ex.Message);
// }
// }
// private void CreateChildNodes(string parentPositionNo, DataTable dtOld, List<Designation> oDesignations)
// {
// string ss = "";
// int nRow = 0;
// try
// {
// DataTable dtChilds = null;
// var accItems = dtOld.AsEnumerable().Where(x => x["Parent Position No"].ToString().ToLower().Trim() == parentPositionNo.ToLower().Trim());
// if (accItems.Count() > 0)
// dtChilds = accItems.CopyToDataTable();
// if (dtChilds != null)
// {
// foreach (DataRow dr in dtChilds.Rows)
// {
// nRow = nRow + 1;
// ss = dr["Position No"].ToString();
// OrganogramBasic oOrganogramBasic3 = _oOrganogramNodes.Find(delegate(OrganogramBasic oItem) { return oItem.PositionNo.ToUpper().Trim() == dr["Position No"].ToString().ToUpper().Trim(); });
// if (oOrganogramBasic3 == null)
// {
// OrganogramBasic oOrganogramBasic = new OrganogramBasic();
// Designation oDeg = oDesignations.Find(x => x.Name.ToLower().Trim() == dr["Designation"].ToString().ToLower().Trim());
// oOrganogramBasic.PositionNo = dr["Position No"].ToString().Trim();
// oOrganogramBasic.PositionName = oDeg == null ? "" : oDeg.Name;
// oOrganogramBasic.DepartmentID = (1);
// oOrganogramBasic.LocationID = (1);
// oOrganogramBasic.GradeID = (1);
// oOrganogramBasic.DesignationID = oDeg == null ? (1) : oDeg.ID;
// oOrganogramBasic.FunctionID = (1);
// oOrganogramBasic.CompanyID = (1);
// OrganogramBasic oOrganogramBasic2 = _oOrganogramNodes.Find(delegate(OrganogramBasic oItem) { return oItem.PositionNo.ToUpper().Trim() == dr["Parent Position No"].ToString().ToUpper().Trim(); });
// if (oOrganogramBasic2 != null)
// {
// oOrganogramBasic.ParentID = oOrganogramBasic2.ID;
// oOrganogramBasic.Tier = oOrganogramBasic2.Tier + 1;
// }
// else
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Parent Position No.", nRow, "Parent position no:" + dr["Parent Position No"].ToString().Trim() + " not found."));
// oOrganogramBasic.RevisionDate = DateTime.Today;
// oOrganogramBasic.Save();
// _oOrganogramNodes.Add(oOrganogramBasic);
// }
// CreateChildNodes(dr["Position No"].ToString().Trim(), dtOld, oDesignations);
// nOrgRowCount++;
// }
// }
// }
// catch (Exception exp)
// {
// throw new Exception(exp.Message + ss);
// }
// }
// #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;
// string nvalue = ConfigurationManager.GetStringValue("loan", "adjustfractionmonth", EnumConfigurationType.Logic);
// //_Method = ConfigurationManager.GetStringValue("loan", "method", EnumConfigurationType.Logic);
// if (Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer == 1)
// {
// _Method = ConfigurationManager.GetStringValue("loan", "method", EnumConfigurationType.Logic);
// }
// else
// {
// _Method = ConfigurationManager.GetStringValue("loan", "methodnmgt", EnumConfigurationType.Logic);
// }
// 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.PayrollLastDateOfMonth(loanissue.IssueDate);
// _Fractionate = EnumLoanFraction.WithFraction;
// 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;
// }
// 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;
// case "L2MID":
// loanissue.PrepareL2MIDSchedule(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);
// }
// }
// #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.PayrollLastDateOfMonth(loansch.DueInstallmentDate).ToString("dd MMM yyyy") == Ease.CoreV35.Utility.Global.DateFunctions.PayrollLastDateOfMonth((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.PayrollLastDateOfMonth((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;
// List<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 = PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(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();
// List<SalaryMonthlyDetail> osalaryDetails = new List<SalaryMonthlyDetail>();
// _incomeTaxes = new List<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."));
// continue;
// }
// 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 Basic Information
//public void ImportEmpBasicInfo()
//{
// _basicwithEmployee = new BasicDataUploadProcess();
// _basicwithEmployee.ImportEmpBasicInfo(_uplodedData,_payrollTypeID);
// _errorOrSuccessList = _basicwithEmployee.ErrorOrSuccessList;
//}
//#endregion
// public void ImportDeptInfo()
// {
// _basicwithEmployee = new BasicDataUploadProcess();
// _basicwithEmployee.ImportDeptInfo(_uplodedData);
// _errorOrSuccessList = _basicwithEmployee.ErrorOrSuccessList;
// }
// public List<HREmployee> ImportAllEmpGeneralInfoIDLC(DataTable oDTable)
// {
// int nRow = 0;
// try
// {
// //List<EmpContact> oEmployee
// _CheckHREmployees = HREmployee.Get();
// EmpContact oEmpContact = null;
// List<Thana> oParmanentsThanas = null;
// List<Thana> oPresentThanas = null;
// //HREmployee oHREmployee=null;
// List<EmpContact> oEmpContacts = new List<EmpContact>();
// _HREmployees = new List<HREmployee>();
// if (_errorOrSuccessList == null)
// _errorOrSuccessList = new List<UploadErrorOrSuccess>();
// _HREmployee.Contacts = new List<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 List<EmpContact>();
// oHREmp.ChildrenList = new List<EmpChildren>();
// oHREmp.Experiences = new List<EmpExperience>();
// oHREmp.Spouses = new List<EmpSpouse>();
// oHREmp.Experiences = new List<EmpExperience>();
// oHREmp.Trainings = new List<EmpTraining>();
// oHREmp.Academics = new List<EmpAcademic>();
// oHREmp.Achievements = new List<EmpAchievement>();
// oHREmp.OtherTalents = new List<EmpOtherTalent>();
// oHREmp.CurricularActivities = new List<EmpCurricularActivity>();
// oHREmp.Hobbies = new List<EmpHobby>();
// oHREmp.References = new List<EmpReference>();
// oHREmp.Allergies = new List<EmpAllergy>();
// oHREmp.Publications = new List<EmpPublication>();
// oHREmp.Nominees = new List<EmpNominee>();
// oHREmp.Hospitalizations = new List<EmpHospitalization>();
// oHREmp.Guarantors = new List<EmpGuarantor>();
// oHREmp.WorkPlanSetup = new EmpWorkPlanSetup();
// oHREmp.EmpLanguages = new List<EmpLanguage>();
// oHREmp.EmpRelatives = new List<EmpRelative>();
// oHREmp.EmpMemberships = new List<EmpMembership>();
// oHREmp.EmpRelations = new List<EmpRelation>();
// oHREmp.EmpHRQuestionAnswers = new List<EmpHRQuestionAnswer>();
// oHREmp.CreditCards = new List<EmpCreditCard>();
// if (oHREmp != null)
// {
// _HREmployee = oHREmp;
// _HREmployee.Contacts = new List<EmpContact>();
// //if(_HREmployee.Contacts.Count>0)
// //{
// //_HREmployee.Contacts = new List<EmpContact>();
// //}
// }
// else
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("EmployeeID", nRow, "EmployeeID : " + oDr["EmployeeID"].ToString() + " Not found in the database"));
// _HREmployee = new HREmployee();
// continue;
// }
// 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.PermanentAddress = 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.PermanentDistrictID = 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.PermanentThanaID = oThanaPar.ID;
// else
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Thana", nRow, "Permanent Thana is not valid for employee " + oDTable.TableName + " Information."));
// oEmpContact.PermanentTelephone = oDr["Permanent Telephone No"].ToString();
// oEmpContact.PermanentMobile = 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;
// List<EmpContact> oContacts = null;
// oContacts = HREmployee.GetEmpContacts();
// _Districts = District.Get();
// _Thanas = Thana.Get();
// _Relations = Relation.Get();
// _empContacts = new List<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.PermanentAddress = 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(); });
// List<Thana> oParmanentsThanas = Thana.GetByDistID(oDisPar.ID);
// if (oDisPar != null)
// oEmpContact.PermanentDistrictID = 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.PermanentThanaID = oThanaPar.ID;
// else
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Thana", nRow, "Permanent Thana is not valid for employee " + _uplodedData.TableName + " Information."));
// }
// }
// oEmpContact.PermanentTelephone = string.IsNullOrEmpty(oDr["Permanent Telephone No"].ToString().Trim()) ? oEmpContact.PermanentTelephone : oDr["Permanent Telephone No"].ToString().Trim();
// oEmpContact.PermanentMobile = string.IsNullOrEmpty(oDr["PerMobile No"].ToString().Trim()) ? oEmpContact.PermanentMobile : 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(); });
// List<Thana> oParmanentsThanas = Thana.GetByDistID(oDisPre.ID);
// if (oDisPre != null)
// oEmpContact.PermanentDistrictID = 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.PermanentThanaID = 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;
// }
// public void ImportWPPFAllowance(DataUploadColumnDefinition columnDefinition)
// {
// _basicwithEmployee = new BasicDataUploadProcess();
// _basicwithEmployee.ImportWPPFAllowance(_uplodedData, columnDefinition);
// _errorOrSuccessList = _basicwithEmployee.ErrorOrSuccessList;
// }
// #endregion
// #region Import Bonus Information
// #region Import Bonus Information
// public BonusProcess ImportEmpBonus(DataUploadColumnDefinition _columnDefinition, bool IsDisburshWithSalry, bool IsTaxProcess, double UsedProcess, int bonusID)
// {
// 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 List<BonusProcess.BonusProcessDetail>();
// List<EnmSetupManagerTranType> setupTypes = SetupDetail.GetTypes(EnumParameterSetup.Bonus);
// List<SetupDetail> setupDetails = SetupDetail.GetParameters(EnumParameterSetup.Bonus);
// List<BonusParameter> bonusParameters = BonusParameter.Get(EnumStatus.Regardless);
// 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(); });
// if (oemployee != null)
// {
// List<BonusParameter> oParams = BonusParameter.ApplicableParameters(oemployee, bonusID, setupTypes, setupDetails, bonusParameters);
// if (oParams != null)
// {
// foreach (BonusParameter oBonusParm in oParams)
// {
// oProssBonus.BonusID = oBonusParm.BonusID;
// oProssBonus.BasicOnMonth = PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(SystemInformation.CurrentSysInfo.LastPayProcessDate);
// oProssBonus.BonusMonth = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
// oProssBonus.DisburseDate = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
// oProssBonus.IsDisburseWithSalary = IsDisburshWithSalry;
// oProssBonus.IsTaxProcess = IsTaxProcess;
// oProssBonus.UsedProcess = UsedProcess;
// EmployeeGradeSalary ogs = EmployeeGradeSalary.GetBasicOnDate(oemployee.ID, PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(SystemInformation.CurrentSysInfo.LastPayProcessDate));
// 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 = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
// if (_columnDefinition.SelectedItemOneID == (0))
// {
// oBPDetail.BonusAmount = Convert.ToDouble(dr["Value"]);
// }
// else if (_columnDefinition.SelectedItemOneID == (1))
// {
// oBPDetail.BonusAmount = (nBasicSalary * Convert.ToDouble(dr["Value"])) / 100;
// }
// else if (_columnDefinition.SelectedItemOneID == (2))
// {
// BonusCalculator ob = new BonusCalculator();
// double dailyAmount = ob.ConvertToDailyRate(nBasicSalary, oBPDetail.BonusMonth);
// oBPDetail.BonusAmount = dailyAmount * Convert.ToDouble(dr["Value"]);
// }
// oBPDetail.ChangeBonusAmount = PayrollPayrollGlobalFunctions.Round(oBPDetail.BonusAmount);
// oBPDetail.CalculatedAdjustAmount = BonusAdjustAmount;
// oBPDetail.CalculatedSalaryItemAmount = BonusSalaryItemAmount;
// oBPDetail.ChangeAdjustAmount = BonusAdjustAmount;
// oBPDetail.ChangeSalaryItemAmount = BonusSalaryItemAmount;
// 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();
// List<Employee> oEmployees = new List<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;
// }
// public BonusProcess ImportEmpBonuswithTax(DataUploadColumnDefinition _columnDefinition, bool IsDisburshWithSalry, bool IsTaxProcess, double UsedProcess, int bonusID)
// {
// 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 List<BonusProcess.BonusProcessDetail>();
// List<EnmSetupManagerTranType> setupTypes = SetupDetail.GetTypes(EnumParameterSetup.Bonus);
// List<SetupDetail> setupDetails = SetupDetail.GetParameters(EnumParameterSetup.Bonus);
// List<BonusParameter> bonusParameters = BonusParameter.Get(EnumStatus.Regardless);
// 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(); });
// if (oemployee != null)
// {
// List<BonusParameter> oParams = BonusParameter.ApplicableParameters(oemployee, bonusID, setupTypes, setupDetails, bonusParameters);
// if (oParams != null)
// {
// foreach (BonusParameter oBonusParm in oParams)
// {
// oProssBonus.BonusID = oBonusParm.BonusID;
// oProssBonus.BasicOnMonth = PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(SystemInformation.CurrentSysInfo.LastPayProcessDate);
// oProssBonus.BonusMonth = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
// oProssBonus.DisburseDate = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
// oProssBonus.IsDisburseWithSalary = IsDisburshWithSalry;
// oProssBonus.IsTaxProcess = IsTaxProcess;
// oProssBonus.UsedProcess = UsedProcess;
// EmployeeGradeSalary ogs = EmployeeGradeSalary.GetBasicOnDate(oemployee.ID, PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(SystemInformation.CurrentSysInfo.LastPayProcessDate));
// 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 = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
// oBPDetail.BonusAmount = Convert.ToDouble(dr["Value"]);
// oBPDetail.ChangeBonusAmount = PayrollPayrollGlobalFunctions.Round(oBPDetail.BonusAmount);
// oBPDetail.CalculatedAdjustAmount = BonusAdjustAmount;
// oBPDetail.CalculatedSalaryItemAmount = BonusSalaryItemAmount;
// oBPDetail.ChangeAdjustAmount = BonusAdjustAmount;
// oBPDetail.ChangeSalaryItemAmount = BonusSalaryItemAmount;
// oBPDetail.TaxAmount = Convert.ToDouble(dr["Tax"]);
// oBPDetail.ChangeTaxAmount = Convert.ToDouble(dr["Tax"]);
// 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();
// List<Employee> oEmployees = new List<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);
// if (SystemInformation.CurrentSysInfo.TaxParamID == null) throw new ServiceException("Current year Tax paramter setup not found.");
// TaxParameter oparamter = TaxParameter.Get(SystemInformation.CurrentSysInfo.TaxParamID);
// //List<ADParameter> oParams = ADParameter.Get(EnumStatus.Regardless, EnumAllowOrDeduct.Allowance);
// //List<IncomeTax> oTaxes = IncomeTax.Get(EnumIncomeTaxDataFrom.ProcessTempData);
// double nTaxAmount = 0;
// int nCount = 0;
// EnumIncomeTaxDataFrom datafrom = IncomeTax.GetEnumForSalaryIT();
// if (datafrom == EnumIncomeTaxDataFrom.SalaryITTempData)
// {
// throw new ServiceException("Current month salary is processed and not yet finalized. Tax calculation "
// + " is not allowed middle of this process. You have to Undo or finalize the salary to calculate tax.");
// }
// TaxCalculator oCalculator = new TaxCalculator();
// oCalculator.TaxParameter = oparamter;
// foreach (BonusProcess.BonusProcessDetail item in oProssBonus.BonusProcessDetails)
// {
// nCount++;
// oCalculator.Employee = oEmployees.GetItem(item.EmployeeID);
// if (item.ChangeBonusAmount > 0)
// {
// //List<TaxRawItem> oTaxRowItems = new List<TaxRawItem>();
// List<IncomeTax> oIncomeTaxs = IncomeTax.Get(item.EmployeeID, EnumIncomeTaxDataFrom.ProcessTempData);
// IncomeTax it = oIncomeTaxs.FirstOrDefault(x => x.ItemGroup == EnumIncomeTaxItemGroup.Bonus && x.ItemID == (int)EnumIncomeTaxItemGroup.Bonus);
// // if(it==null) throw exception here
// it.ThisMonthAmount = it.ThisMonthAmount + item.BonusAmount;
// IncomeTax itx = oIncomeTaxs.FirstOrDefault(x => x.ItemGroup == EnumIncomeTaxItemGroup.Tax_Deducted && x.ItemID == (int)EnumIncomeTaxItemGroup.Tax_Deducted);
// // if(it==null) throw exception here
// itx.ThisMonthAmount = itx.ThisMonthAmount + item.TaxAmount;
// //IncomeTax oIncomeTax = new IncomeTax();
// //oIncomeTax.Description = oItem.Name;
// //oIncomeTax.ItemID = oItem.ID.Integer;
// //oIncomeTax.TaxParameterID = oparamter.ID;
// //oIncomeTax.EmployeeID = item.EmployeeID;
// //oIncomeTax.TotalAmount = item.TaxAmount;
// //oIncomeTax.Side = EnumIncomeTaxSide.Inc_SalaryIncome;
// //oIncomeTax.ItemGroup= EnumIncomeTaxItemGroup.Bonus;
// //oIncomeTax.ThisMonthAmount = item.TaxAmount;
// //oIncomeTax.ProjectedAmount = 0;
// //oIncomeTaxs.Add(oIncomeTax);
// //oTaxRowItems.Add(TaxRawItem.Create(oItem.Name, item.TaxAmount, enumIncomeTaxItemType.Bonus, item.BonusID.Integer));
// item.IncomeTaxcoll = oIncomeTaxs;// oCalculator.CalculateBonus(oTaxRowItems, ref nTaxAmount, oParams, oTaxes);
// }
// }
// }
// }
// catch (Exception ex)
// {
// throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
// }
// return oProssBonus;
// }
// #endregion
// //public BonusProcess ImportEmpBonus(DataUploadColumnDefinition _columnDefinition,bool IsDisburshWithSalry,bool IsTaxProcess,double UsedProcess, int bonusID)
// //{
// // 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 List<BonusProcess.BonusProcessDetail>();
// // 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(); });
// // if (oemployee != null)
// // {
// // List<BonusParameter> oParams = BonusParameter.ApplicableParameters(oemployee, bonusID);
// // if (oParams != null)
// // {
// // foreach (BonusParameter oBonusParm in oParams)
// // {
// // oProssBonus.BonusID = oBonusParm.BonusID;
// // oProssBonus.BasicOnMonth = PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(SystemInformation.CurrentSysInfo.LastPayProcessDate);
// // oProssBonus.BonusMonth = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
// // oProssBonus.DisburseDate = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
// // oProssBonus.IsDisburseWithSalary = IsDisburshWithSalry;
// // oProssBonus.IsTaxProcess = IsTaxProcess;
// // oProssBonus.UsedProcess = UsedProcess;
// // EmployeeGradeSalary ogs = EmployeeGradeSalary.GetBasicOnDate(oemployee.ID, PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(SystemInformation.CurrentSysInfo.LastPayProcessDate));
// // if (ogs == null)
// // {
// // nBasicSalary = oemployee.BasicSalary;
// // nGrossSalary = oemployee.GrossSalary;
// // }
// // else
// // {
// // nBasicSalary = ogs.BasicSalary;
// // nGrossSalary = ogs.GrossSalary;
// // }
// // BonusProcess.BonusProcessDetail oBPDetail = new BonusProcess.BonusProcessDetail();
// // oBPDetail.BonusProcessAdjustItems = new List<BonusProcess.BonusProcessDetail.BonusProcessAdjustItem>();
// // oBPDetail.BonusID = oBonusParm.BonusID;
// // oBPDetail.EmployeeID = oemployee.ID;
// // oBPDetail.BasicSalary = nBasicSalary;
// // oBPDetail.BonusMonth = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
// // if (_columnDefinition.SelectedItemOneID==(0))
// // {
// // oBPDetail.BonusAmount = Convert.ToDouble(dr["Value"]);
// // }
// // else if(_columnDefinition.SelectedItemOneID==(1))
// // {
// // oBPDetail.BonusAmount = (nBasicSalary * Convert.ToDouble(dr["Value"]))/100;
// // }
// // else if (_columnDefinition.SelectedItemOneID == (2))
// // {
// // BonusCalculator ob = new BonusCalculator();
// // double dailyAmount = ob.ConvertToDailyRate(nBasicSalary, oBPDetail.BonusMonth);
// // oBPDetail.BonusAmount = dailyAmount*Convert.ToDouble(dr["Value"]);
// // }
// // oBPDetail.ChangeBonusAmount = PayrollPayrollGlobalFunctions.Round(oBPDetail.BonusAmount);
// // oBPDetail.CalculatedAdjustAmount = BonusAdjustAmount;
// // oBPDetail.CalculatedSalaryItemAmount = BonusSalaryItemAmount;
// // oBPDetail.ChangeAdjustAmount = BonusAdjustAmount;
// // oBPDetail.ChangeSalaryItemAmount = BonusSalaryItemAmount;
// // #region MyRegion
// // BonusProcess.BonusProcessDetail.BonusProcessAdjustItem oBPAItem = new BonusProcess.BonusProcessDetail.BonusProcessAdjustItem();
// // oBPAItem.AdjustAmount = Convert.ToDouble(dr["Value"]);
// // oBPAItem.BonusAdjustID = 5;
// // oBPDetail.BonusProcessAdjustItems.Add(oBPAItem);
// // #endregion
// // 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"));
// // }
// // }
// // catch (Exception ex)
// // {
// // throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
// // }
// // return oProssBonus;
// //}
// //public BonusProcess ImportEmpBonusAmount(BonusProcess bProcess,DataUploadColumnDefinition _columnDefinition, bool IsDisburshWithSalry, bool IsTaxProcess, double UsedProcess, int bonusID)
// //{
// // double BonusAdjustAmount;
// // double BonusSalaryItemAmount;
// // double nBasicSalary = 0;
// // double nGrossSalary = 0;
// // List<Employee> oemployees = Employee.GetAllEmps();
// // Employee oemployee = null;
// // BonusProcess oProssBonus = bProcess;
// // //oProssBonus.BonusProcessDetails = new List<BonusProcess.BonusProcessDetail>();
// // 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(); });
// // if (oemployee != null)
// // {
// // if (oProssBonus.BonusProcessDetails.Any(o => o.EmployeeID == oemployee.ID))
// // {
// // oProssBonus.BonusProcessDetails.Remove(oProssBonus.BonusProcessDetails.FirstOrDefault(o => o.EmployeeID == oemployee.ID));
// // }
// // EmployeeGradeSalary ogs = EmployeeGradeSalary.GetBasicOnDate(oemployee.ID, PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(SystemInformation.CurrentSysInfo.LastPayProcessDate));
// // if (ogs == null)
// // {
// // nBasicSalary = oemployee.BasicSalary;
// // nGrossSalary = oemployee.GrossSalary;
// // }
// // else
// // {
// // nBasicSalary = ogs.BasicSalary;
// // nGrossSalary = ogs.GrossSalary;
// // }
// // BonusProcess.BonusProcessDetail oBPDetail = new BonusProcess.BonusProcessDetail();
// // oBPDetail.BonusProcessAdjustItems = new List<BonusProcess.BonusProcessDetail.BonusProcessAdjustItem>();
// // oBPDetail.BonusID = oProssBonus.BonusID;
// // oBPDetail.EmployeeID = oemployee.ID;
// // oBPDetail.BasicSalary = nBasicSalary;
// // oBPDetail.BonusMonth = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
// // if (_columnDefinition.SelectedItemOneID == (0))
// // {
// // oBPDetail.BonusAmount = Convert.ToDouble(dr["Value"]);
// // }
// // else if (_columnDefinition.SelectedItemOneID == (1))
// // {
// // oBPDetail.BonusAmount = (nBasicSalary * Convert.ToDouble(dr["Value"])) / 100;
// // }
// // else if (_columnDefinition.SelectedItemOneID == (2))
// // {
// // BonusCalculator ob = new BonusCalculator();
// // double dailyAmount = ob.ConvertToDailyRate(nBasicSalary, oBPDetail.BonusMonth);
// // oBPDetail.BonusAmount = dailyAmount * Convert.ToDouble(dr["Value"]);
// // }
// // oBPDetail.ChangeBonusAmount = PayrollPayrollGlobalFunctions.Round(oBPDetail.BonusAmount);
// // oBPDetail.CalculatedAdjustAmount = BonusAdjustAmount;
// // oBPDetail.CalculatedSalaryItemAmount = BonusSalaryItemAmount;
// // oBPDetail.ChangeAdjustAmount = BonusAdjustAmount;
// // oBPDetail.ChangeSalaryItemAmount = BonusSalaryItemAmount;
// // oProssBonus.BonusProcessDetails.Add(oBPDetail);
// // }
// // 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);
// // }
// // return oProssBonus;
// //}
// //public BonusProcess ImportSpringAdjBonus(int allowance, BonusProcess bProcess, DataUploadColumnDefinition _columnDefinition, bool IsDisburshWithSalry, bool IsTaxProcess, double UsedProcess, int bonusID)
// //{
// // //double BonusAdjustAmount;
// // //double BonusSalaryItemAmount;
// // //double nBasicSalary = 0;
// // //double nGrossSalary = 0;
// // List<Employee> oemployees = Employee.Get();
// // Employee oemployee = null;
// // BonusProcess oProssBonus = bProcess;
// // //oProssBonus.BonusProcessDetails = new List<BonusProcess.BonusProcessDetail>();
// // 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(); });
// // if (oemployee != null)
// // {
// // BonusProcess.BonusProcessDetail oBPDetail = oProssBonus.BonusProcessDetails.FirstOrDefault(o => o.EmployeeID == oemployee.ID);
// // if (oBPDetail != null)
// // {
// // BonusProcess.BonusProcessDetail.BonusProcessAdjustItem oBPAItem = new BonusProcess.BonusProcessDetail.BonusProcessAdjustItem();
// // if (oBPDetail.BonusProcessAdjustItems == null)
// // {
// // oBPDetail.BonusProcessAdjustItems = new List<BonusProcess.BonusProcessDetail.BonusProcessAdjustItem>();
// // }
// // oBPAItem.AdjustAmount = Convert.ToDouble(dr["Value"]);
// // //this.ItemOneComboData.Add((3), "Mosque Fund");
// // //this.ItemOneComboData.Add((4), "GC Percent");
// // //this.ItemOneComboData.Add((5), "Benovolent Fund");
// // //this.ItemOneComboData.Add((6), "Co-Operative");
// // if (allowance == 3)
// // {
// // oBPAItem.BonusAdjustID = 5;
// // }
// // else if (allowance==5)
// // {
// // oBPAItem.BonusAdjustID = 6;
// // }
// // else if (allowance == 6)
// // {
// // oBPAItem.BonusAdjustID = 10;
// // }
// // // oBPAItem.Side = EnumTranSide.Debit;
// // //oBPDetail.BonusAmount = oBPDetail.BonusAmount - oBPAItem.AdjustAmount;
// // oBPDetail.ChangeBonusAmount = oBPDetail.ChangeBonusAmount - oBPAItem.AdjustAmount;
// // oBPDetail.BonusProcessAdjustItems.Add(oBPAItem);
// // }
// // }
// // 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);
// // }
// // return oProssBonus;
// //}
// //public BonusProcess ImportMgtCorporateIndvPercent(BonusProcess bProcess, DataUploadColumnDefinition _columnDefinition, bool IsDisburshWithSalry, bool IsTaxProcess, double UsedProcess, int bonusID)
// //{
// // //double BonusAdjustAmount;
// // //double BonusSalaryItemAmount;
// // //double nBasicSalary = 0;
// // //double nGrossSalary = 0;
// // List<Employee> oemployees = Employee.Get();
// // Employee oemployee = null;
// // BonusProcess oProssBonus = bProcess;
// // //oProssBonus.BonusProcessDetails = new List<BonusProcess.BonusProcessDetail>();
// // int nRow = 0;
// // try
// // {
// // foreach (DataRow dr in _uplodedData.Rows)
// // {
// // nRow = nRow + 1;
// // //BonusAdjustAmount = 0.0;
// // //BonusSalaryItemAmount = 0.0;
// // DateTime dCuttOfDate = PayrollPayrollGlobalFunctions.LastDateOfYear(oProssBonus.BonusMonth.AddYears(-1));
// // oemployee = oemployees.Find(delegate(Employee emp) { return emp.EmployeeNo == dr["Employee No"].ToString(); });
// // if (oemployee != null)
// // {
// // BonusProcess.BonusProcessDetail oBPDetail = oProssBonus.BonusProcessDetails.FirstOrDefault(o => o.EmployeeID == oemployee.ID);
// // if (oBPDetail != null)
// // {
// // BonusProcess.BonusProcessDetail.BonusProcessAdjustItem oBPAItem = new BonusProcess.BonusProcessDetail.BonusProcessAdjustItem();
// // oBPAItem.AdjustAmount = Convert.ToDouble(dr["Value"]);
// // oBPAItem.BonusAdjustID = 9;
// // oBPDetail.ChangeBonusAmount = oBPDetail.CalculatedSalaryItemAmount * oBPAItem.AdjustAmount / 100;
// // oBPDetail.ChangeBonusAmount = this.CaculatedProratedAmount(oemployee, oBPDetail.ChangeBonusAmount, dCuttOfDate);
// // oBPDetail.BonusAmount = oBPDetail.ChangeBonusAmount;
// // // oBPAItem.Side = EnumTranSide.Debit;
// // oBPDetail.BonusProcessAdjustItems.Add(oBPAItem);
// // }
// // }
// // 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);
// // }
// // return oProssBonus;
// //}
// public double CaculatedProratedAmount(Employee oEmp, double TotalBonusAmount, DateTime dCuttOffDate)
// {
// double BonusProAmount = 0.0;
// DateTime JoiningDate = oEmp.JoiningDate;
// DateTime CompareDate = DateTime.Now;
// DateTime FirstDateofYear = Ease.CoreV35.Utility.Global.DateFunctions.FirstDateOfYear(dCuttOffDate);
// DateTime LastDateofYear = Ease.CoreV35.Utility.Global.DateFunctions.LastDateOfYear(dCuttOffDate);
// if (oEmp.JoiningDate <= FirstDateofYear)
// {
// CompareDate = FirstDateofYear;
// }
// if (CompareDate <= FirstDateofYear)
// {
// BonusProAmount = TotalBonusAmount;
// }
// else if (JoiningDate > FirstDateofYear)
// {
// int nDays = (LastDateofYear - JoiningDate).Days + 1;
// BonusProAmount = (TotalBonusAmount * nDays) / 365;
// }
// return BonusProAmount;
// }
// #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;
// List<OpiParameterIndividual> oopiParameterInd = new List<OpiParameterIndividual>();
// //OpiParameterIndividual oOPIParameter = null;
// int nRow = 0;
// _oPIProcessDetailItem = new List<OPIProcessDetailItem>();
// _incomeTaxes = new List<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 List<OpiParameterIndividual>();
// OpiParameterIndividual oopiParamIndividual = null;
// List<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; //(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.PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(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.PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(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.PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(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.PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(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);
// }
// }
// public void ImportOPIData(DataUploadColumnDefinition _columnDefinition)
// {
// List<Employee> oemployees = Employee.Get();
// List<OPIProcessDetailItem> oOPIDetailItems = new List<OPIProcessDetailItem>();
// _incomeTaxes = new List<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)
// {
// List<OpiParameterIndividual> oOPIParamIndividuals = new List<OpiParameterIndividual>();
// List<Employee> oemployees = Employee.Get();
// List<OpiParameter> oPIParameters = OpiParameter.Get();
// _incomeTaxes = new List<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 = PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(SystemInformation.CurrentSysInfo.NextPayProcessDate);
// if (oEmpParamIndividual.OpiPeriodicity == EnumOpiPeriodicity.OnceOff)
// {
// oEmpParamIndividual.ToDate = PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(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);
// }
// }
// #endregion
//public void UploadException(int uploadId, DataTable _uploadData, DataUploadColumnDefinition oColumnDefinition)
//{
// switch (uploadId)
// {
// case (int)42:
// {
// this.UploadAppraisalPoint(_uploadData, oColumnDefinition);
// break;
// }
// default:
// break;
// }
//}
// #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 List<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 = PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(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 = PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(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 = PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(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 = PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(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 List<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 Employee Card Info
// public void ImportEmpCardInfo(DataUploadColumnDefinition _columnDefinition)
// {
// List<Employee> oemployees = Employee.Get();
// Employee oemployee = null;
// int nRow = 0;
// List<AccessCard> oAccessCards = AccessCard.Get();
// DateTime dLastCardOperation = DateTime.MinValue;
// AccessCard accCard = null;
// _CardOperations = new List<CardOperation>();
// CardOperation cOperation = null;
// List<Employee> tempEmployees = new List<Employee>();
// Employee tempEmployee = 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)
// {
// tempEmployee = tempEmployees.Where(o => o.int == oemployee.ID).FirstOrDefault();
// if (tempEmployee != null)
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Duplicate Employee Entry Found"));
// continue;
// }
// tempEmployees.Add(oemployee);
// cOperation = new CardOperation();
// if (oemployee.CardDate != null)
// dLastCardOperation = (DateTime)oemployee.CardDate;
// else
// dLastCardOperation = DateTime.MinValue;
// accCard = oAccessCards.Where(o => o.CardNumber == dr["Card No"].ToString()).FirstOrDefault();
// if (dr["Card No"].ToString() == string.Empty)
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Card No Can't be empty"));
// continue;
// }
// if (accCard != null && accCard.Status != EnumCardStatus.Free)
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Card No.", nRow, "(" + dr["Card No"].ToString() + ")" + "The Card Number Exists and its status is not 'Free'"));
// continue;
// }
// if (dr["Assign Date"].ToString() == string.Empty)
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Assign Date Can't be empty"));
// continue;
// }
// if (Convert.ToDateTime(dr["Assign Date"]) < dLastCardOperation)
// {
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No.", nRow, "(" + dr["Employee No"].ToString() + ")" + "Assignment date can not be less than last card operation date(" + dLastCardOperation.ToString("dd MMM yyyy") + ") of this employee" + dLastCardOperation));
// continue;
// }
// cOperation.CardNumber = dr["Card No"].ToString();
// cOperation.EmployeeID = oemployee.ID;
// cOperation.Status = Payroll.BO.EnumCardStatus.Attached;
// cOperation.AssignDate = Convert.ToDateTime(dr["Assign Date"]);
// cOperation.Comments = string.Empty;
// cOperation.CreatedBy = User.CurrentUser.ID;
// cOperation.CreatedDate = DateTime.Now;
// _CardOperations.Add(cOperation);
// }
// 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.GetWithDiscontinue();
// EmployeeTaxInvestment oEmpTaxInvest = null;
// _EmployeeTaxInvestments = new List<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 List<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 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 List<EmpContact> ImportEmpContactInfo(DataTable oDTable)
// {
// int nRow = 0;
// EmpContact oEmpContact = null;
// List<Thana> oParmanentsThanas = null;
// List<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.PermanentAddress = 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.PermanentDistrictID = 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.PermanentThanaID = oThanaPar.ID;
// else
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Thana", nRow, "Permanent Thana is not valid for employee " + oDTable.TableName + " Information."));
// oEmpContact.PermanentTelephone = oDr["Permanent Telephone No"].ToString();
// oEmpContact.PermanentMobile = 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 List<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 List<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.ChildrenList.Add(oEmpChildren);
// }
// }
// }
// catch (Exception ex)
// {
// throw new ServiceException("Error occured on row:" + nRow + " Reason:" + ex.Message);
// }
// return _HREmployee.ChildrenList;
// }
// #endregion
// #region Import Employee Experience Information
// public List<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 List<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.Achievements = oDr["Achievements"].ToString() != string.Empty ? oDr["Achievements"].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 List<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 List<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 List<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 List<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 List<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 List<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 List<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 List<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 List<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 List<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 List<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 List<HREmployee> ImportAllEmpGeneralInfo(DataTable oDTable)
// {
// int nRow = 0;
// try
// {
// List<HREmployee> oEmps = HREmployee.Get();
// _HREmployees = new List<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();
// if (oDr["Employee No"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No", nRow, "Employee No is not valid for employee " + oDTable.TableName + " Information."));
// HREmployee emp = oEmps.Find(x => x.EmployeeNo == oDr["Employee No"].ToString());
// if (emp != null)
// _HREmployee = emp;
// _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;
// if (oDr["Gender"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Gender", nRow, "Gender is not valid for employee from " + oDTable.TableName + " Information."));
// else
// _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() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Blood Group", nRow, "Blood Group is not valid for employee from " + oDTable.TableName + " Information."));
// else
// {
// 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
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Joining Date", nRow, "Please enter employee Joining Date " + oDTable.TableName + " Information."));
// //_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("Date of Birth", nRow, "Please enter employee Date of Birth " + 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 == null ? "" : 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 == null ? "" : 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);
// }
// else
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("First Name", nRow, "First Name is not valid for employee " + oDTable.TableName + " Information."));
// }
// }
// catch (Exception ex)
// {
// throw new ServiceException("Error occured at sheet general 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;
// List<Thana> oParmanentsThanas = null;
// List<Thana> oPresentThanas = null;
// try
// {
// foreach (DataRow oDr in oDTable.Rows)
// {
// if (oDr["Permanent Address"].ToString().Trim() != string.Empty)
// {
// if (oDr["Employee No"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No", nRow, "Employee No is not valid for employee " + oDTable.TableName + " Information."));
// HREmployee oHREmployee = _HREmployees.Find(delegate(HREmployee oItem) { return oItem.EmployeeNo == oDr["Employee No"].ToString(); });
// if (oHREmployee != null)
// {
// nRow = nRow + 1;
// oEmpContact = new EmpContact();
// if (oDr["Permanent Address"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Permanent Address", nRow, "Permanent Address is not valid for employee " + oDTable.TableName + " Information."));
// else
// oEmpContact.PermanentAddress = oDr["Permanent Address"].ToString();
// District oDisPar = _Districts.Find(delegate(District oItem) { return oItem.Name.ToUpper() == oDr["Permanent District"].ToString().ToUpper(); });
// oParmanentsThanas = _Thanas.FindAll(x => x.DistrictID == oDisPar.ID).ToObjectsTemplate();// Thana.GetByDistID(oDisPar.ID);
// if (oDisPar != null)
// oEmpContact.PermanentDistrictID = oDisPar.ID;
// else
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("District", nRow, "Permanent District is not valid for employee " + oDTable.TableName + " Information."));
// Thana oThanaPar = _Thanas.Find(delegate(Thana oItem) { return oItem.Name.ToUpper().Trim() == oDr["Permanent Thana"].ToString().ToUpper().Trim(); });
// if (oThanaPar != null)
// oEmpContact.PermanentThanaID = oThanaPar.ID;
// else
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Thana", nRow, "Permanent Thana is not valid for employee " + oDTable.TableName + " Information."));
// oEmpContact.PermanentTelephone = oDr["Permanent Telephone No"].ToString();
// oEmpContact.PermanentMobile = oDr["PerMobile No"].ToString();
// if (oDr["Present Address"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Present Address", nRow, "Present Address is not valid for employee " + oDTable.TableName + " Information."));
// else
// 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 = _Thanas.FindAll(x => x.DistrictID == oPerDis.ID).ToObjectsTemplate();// 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 = _Thanas.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();
// if (oDr["Emergency Contact Address"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Emergency Contact Address", nRow, "Emergency Contact Address is not valid for employee " + oDTable.TableName + " Information."));
// else
// oEmpContact.EmergencyContactAddress = oDr["Emergency Contact Address"].ToString();
// if (oDr["Emergency Contact Person"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Emergency Contact Person", nRow, "Emergency Contact Person is not valid for employee " + oDTable.TableName + " Information."));
// else
// oEmpContact.EmergencyContactPerson = oDr["Emergency Contact Person"].ToString();
// oEmpContact.EmergencyTelephone = oDr["Emergency Telephone No"].ToString();
// if (oDr["EmeMobile No"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("EmeMobile No", nRow, "EmeMobile No is not valid for employee " + oDTable.TableName + " Information."));
// else
// 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 at sheet contacts 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)
// {
// if (oDr["Employee No"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No", nRow, "Employee No is not valid for employee " + oDTable.TableName + " Information."));
// 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 Marriage"].ToString(), out dTemBDate))
// oEmpSpouse.MarriageDate = dTemBDate;//Convert.ToDateTime(oDr["Date of Birth"].ToString());
// else
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Date of Marriage", nRow, "Date of Marriage is not valid for employee " + oDTable.TableName + " Information."));
// oHREmployee.Spouses.Add(oEmpSpouse);
// }
// }
// else
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Spouse Name", nRow, "Spouse Name is not valid for employee " + oDTable.TableName + " Information."));
// }
// }
// catch (Exception ex)
// {
// throw new ServiceException("Error occured at sheet spouse 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)
// {
// if (oDr["Employee No"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No", nRow, "Employee No is not valid for employee " + oDTable.TableName + " Information."));
// 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
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Child's Date of Birth", nRow, "Child's Date of Birth is not valid for employee " + oDTable.TableName + " Information."));
// 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."));
// if (oDr["Child's Marital Status"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Child's Marital Status", nRow, "Child's Marital Status is not valid for employee " + oDTable.TableName + " Information."));
// else
// {
// 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.ChildrenList.Add(oEmpChildren);
// }
// }
// else
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Child's Name", nRow, "Child's Name is not valid for employee " + oDTable.TableName + " Information."));
// }
// }
// catch (Exception ex)
// {
// throw new ServiceException("Error occured at sheet children on row:" + nRow + " Reason:" + ex.Message);
// }
// //return _HREmployee.ChildrenList;
// }
// #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)
// {
// if (oDr["Employee No"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No", nRow, "Employee No is not valid for employee " + oDTable.TableName + " Information."));
// 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();
// if (oDr["Contact Person"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Contact Person", nRow, "Contact Person is not valid for employee " + oDTable.TableName + " Information."));
// else
// 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
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employed From Date", nRow, "Employed From Date is not valid for employee " + oDTable.TableName + " Information."));
// DateTime dTempDate;
// if (DateTime.TryParse(oDr["Employed To Date"].ToString(), out dTempDate))
// oEmpExperience.ToDate = dTempDate;
// else
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employed To Date", nRow, "Employed To Date is not valid for employee " + oDTable.TableName + " Information."));
// oHREmployee.Experiences.Add(oEmpExperience);
// }
// }
// else
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employer", nRow, "Employer is not valid for employee " + oDTable.TableName + " Information."));
// }
// }
// catch (Exception ex)
// {
// throw new ServiceException("Error occured at sheet experinence 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)
// {
// if (oDr["Employee No"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No", nRow, "Employee No is not valid for employee " + oDTable.TableName + " Information."));
// 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.Achievements = oDr["Achievements"].ToString() != string.Empty ? oDr["Achievements"].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);
// }
// }
// else
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Training Title", nRow, "Training Title is not valid for employee " + oDTable.TableName + " Information."));
// }
// }
// catch (Exception ex)
// {
// throw new ServiceException("Error occured at sheet training 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)
// {
// if (oDr["Employee No"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No", nRow, "Employee No is not valid for employee " + oDTable.TableName + " Information."));
// 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();
// if (oDr["Exam Held on"].ToString() != "")
// oEmpAcademic.ExamDate = Convert.ToInt16(oDr["Exam Held on"]);
// if (oDr["Passing Year"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Passing Year", nRow, "Passing Year is not valid for employee " + oDTable.TableName + " Information."));
// else
// oEmpAcademic.PassingYear = Convert.ToInt16(oDr["Passing Year"].ToString());
// 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);
// }
// }
// else
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Education Type", nRow, "Education Type is not valid for employee " + oDTable.TableName + " Information."));
// }
// }
// catch (Exception ex)
// {
// throw new ServiceException("Error occured at sheet academic 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)
// {
// if (oDr["Employee No"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No", nRow, "Employee No is not valid for employee " + oDTable.TableName + " Information."));
// 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."));
// }
// if (oDr["Address"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Address", nRow, "Address is not valid for employee " + oDTable.TableName + " Information."));
// else
// 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);
// }
// }
// else
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Referee's Name", nRow, "Referee's Name is not valid for employee " + oDTable.TableName + " Information."));
// }
// }
// catch (Exception ex)
// {
// throw new ServiceException("Error occured at sheet reference 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)
// {
// if (oDr["Employee No"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No", nRow, "Employee No is not valid for employee " + oDTable.TableName + " Information."));
// 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();
// if (oDr["Publication Type"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Publication Type", nRow, "Publication Type is not valid for employee " + oDTable.TableName + " Information."));
// else
// oEmpPublication.PublicationType = oDr["Publication Type"].ToString();
// if (oDr["Publication Name"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Publication Name", nRow, "Publication Name is not valid for employee " + oDTable.TableName + " Information."));
// else
// oEmpPublication.PublishersName = oDr["Publication Name"].ToString() != string.Empty ? oDr["Publication Name"].ToString() : "";
// if (oDr["Description"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Description", nRow, "Description is not valid for employee " + oDTable.TableName + " Information."));
// else
// 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
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Date of Publication", nRow, "Date of Publication is not valid for employee " + oDTable.TableName + " Information."));
// oHREmployee.Publications.Add(oEmpPublication);
// }
// }
// else
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Publication Title", nRow, "Publication Title is not valid for employee " + oDTable.TableName + " Information."));
// }
// }
// catch (Exception ex)
// {
// throw new ServiceException("Error occured at sheet publication 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)
// {
// if (oDr["Employee No"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No", nRow, "Employee No is not valid for employee " + oDTable.TableName + " Information."));
// 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
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Date Of Nomination", nRow, "Date Of Nomination is not valid for employee " + oDTable.TableName + " Information."));
// if (oDr["Nominee's Name"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Nominee's Name", nRow, "Nominee's Name is not valid for employee " + oDTable.TableName + " Information."));
// else
// 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."));
// }
// if (oDr["Percentage"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Percentage", nRow, "Percentage is not valid for employee " + oDTable.TableName + " Information."));
// else
// 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
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Nominee's Date of Birth", nRow, "Nominee's Date of Birth is not valid for employee " + oDTable.TableName + " Information."));
// 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."));
// }
// if (oDr["Address"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Address", nRow, "Address is not valid for employee " + oDTable.TableName + " Information."));
// else
// 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);
// }
// }
// else
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Nomination Purpose", nRow, "Nomination Purpose is not valid for employee " + oDTable.TableName + " Information."));
// }
// }
// catch (Exception ex)
// {
// throw new ServiceException("Error occured at sheet Nominee 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)
// {
// if (oDr["Employee No"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No", nRow, "Employee No is not valid for employee " + oDTable.TableName + " Information."));
// 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 at sheet language 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)
// {
// if (oDr["Employee No"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No", nRow, "Employee No is not valid for employee " + oDTable.TableName + " Information."));
// 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 at sheet relative in this company 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)
// {
// if (oDr["Employee No"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No", nRow, "Employee No is not valid for employee " + oDTable.TableName + " Information."));
// 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 at sheet membership 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)
// {
// if (oDr["Employee No"].ToString() == "")
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No", nRow, "Employee No is not valid for employee " + oDTable.TableName + " Information."));
// 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 == null ? "" : 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 at sheet immediate family on row:" + nRow + " Reason:" + ex.Message);
// }
// //return _HREmployee.EmpRelations;
// }
// #endregion
// #region Import Employee Question Information
// public List<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 List<HREmployee> ImportAllEmpGeneralInForNavana(DataTable oDTable)
// {
// int nRow = 0;
// try
// {
// //List<EmpContact> oEmployee
// _CheckHREmployees = HREmployee.Get();
// EmpContact oEmpContact = null;
// List<Thana> oParmanentsThanas = null;
// List<Thana> oPresentThanas = null;
// //HREmployee oHREmployee=null;
// List<EmpContact> oEmpContacts = new List<EmpContact>();
// _HREmployees = new List<HREmployee>();
// if (_errorOrSuccessList == null)
// _errorOrSuccessList = new List<UploadErrorOrSuccess>();
// _HREmployee.Contacts = new List<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 List<EmpContact>();
// oHREmp.ChildrenList = new List<EmpChildren>();
// oHREmp.Experiences = new List<EmpExperience>();
// oHREmp.Spouses = new List<EmpSpouse>();
// oHREmp.Experiences = new List<EmpExperience>();
// oHREmp.Trainings = new List<EmpTraining>();
// oHREmp.Academics = new List<EmpAcademic>();
// oHREmp.Achievements = new List<EmpAchievement>();
// oHREmp.OtherTalents = new List<EmpOtherTalent>();
// oHREmp.CurricularActivities = new List<EmpCurricularActivity>();
// oHREmp.Hobbies = new List<EmpHobby>();
// oHREmp.References = new List<EmpReference>();
// oHREmp.Allergies = new List<EmpAllergy>();
// oHREmp.Publications = new List<EmpPublication>();
// oHREmp.Nominees = new List<EmpNominee>();
// oHREmp.Hospitalizations = new List<EmpHospitalization>();
// oHREmp.Guarantors = new List<EmpGuarantor>();
// oHREmp.WorkPlanSetup = new EmpWorkPlanSetup();
// oHREmp.EmpLanguages = new List<EmpLanguage>();
// oHREmp.EmpRelatives = new List<EmpRelative>();
// oHREmp.EmpMemberships = new List<EmpMembership>();
// oHREmp.EmpRelations = new List<EmpRelation>();
// oHREmp.EmpHRQuestionAnswers = new List<EmpHRQuestionAnswer>();
// oHREmp.CreditCards = new List<EmpCreditCard>();
// _HREmployee = oHREmp;
// _HREmployee.Contacts = new List<EmpContact>();
// //if(_HREmployee.Contacts.Count>0)
// //{
// //_HREmployee.Contacts = new List<EmpContact>();
// //}
// }
// else
// {
// //_HREmployee = oHREmp;
// //_HREmployee.Contacts = new List<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.PermanentAddress = 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.PermanentDistrictID = 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.PermanentThanaID = oThanaPar.ID;
// else
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Thana", nRow, "Permanent Thana is not valid for employee " + oDTable.TableName + " Information."));
// oEmpContact.PermanentTelephone = oDr["Permanent Telephone No"].ToString();
// oEmpContact.PermanentMobile = 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 List<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;
// List<Thana> oParmanentsThanas = null;
// List<Thana> oPresentThanas = null;
// List<EmpContact> oEmpContacts = new List<EmpContact>();
// _HREmployees = new List<HREmployee>();
// if (_errorOrSuccessList == null)
// _errorOrSuccessList = new List<UploadErrorOrSuccess>();
// _HREmployee.Contacts = new List<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 List<EmpContact>();
// oHREmp.ChildrenList = new List<EmpChildren>();
// oHREmp.Experiences = new List<EmpExperience>();
// oHREmp.Spouses = new List<EmpSpouse>();
// oHREmp.Experiences = new List<EmpExperience>();
// oHREmp.Trainings = new List<EmpTraining>();
// oHREmp.Academics = new List<EmpAcademic>();
// oHREmp.Achievements = new List<EmpAchievement>();
// oHREmp.OtherTalents = new List<EmpOtherTalent>();
// oHREmp.CurricularActivities = new List<EmpCurricularActivity>();
// oHREmp.Hobbies = new List<EmpHobby>();
// oHREmp.References = new List<EmpReference>();
// oHREmp.Allergies = new List<EmpAllergy>();
// oHREmp.Publications = new List<EmpPublication>();
// oHREmp.Nominees = new List<EmpNominee>();
// oHREmp.Hospitalizations = new List<EmpHospitalization>();
// oHREmp.Guarantors = new List<EmpGuarantor>();
// oHREmp.WorkPlanSetup = new EmpWorkPlanSetup();
// oHREmp.EmpLanguages = new List<EmpLanguage>();
// oHREmp.EmpRelatives = new List<EmpRelative>();
// oHREmp.EmpMemberships = new List<EmpMembership>();
// oHREmp.EmpRelations = new List<EmpRelation>();
// oHREmp.EmpHRQuestionAnswers = new List<EmpHRQuestionAnswer>();
// oHREmp.CreditCards = new List<EmpCreditCard>();
// _HREmployee = oHREmp;
// _HREmployee.Contacts = new List<EmpContact>();
// //if(_HREmployee.Contacts.Count>0)
// //{
// //_HREmployee.Contacts = new List<EmpContact>();
// //}
// }
// else
// {
// //_HREmployee = oHREmp;
// //_HREmployee.Contacts = new List<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.PermanentAddress = 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.PermanentDistrictID = 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.PermanentThanaID = oThanaPar.ID;
// else
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Thana", nRow, "Permanent Thana is not valid for employee " + oDTable.TableName + " Information."));
// oEmpContact.PermanentTelephone = oDr["Permanent Telephone No"].ToString();
// oEmpContact.PermanentMobile = 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.ChildrenList.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.Achievements = oDr["Achievements"].ToString() != string.Empty ? oDr["Achievements"].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 List<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 List<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 List<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 Import LineManager
public void ImportLineManager(DataUploadColumnDefinition _columnDefinition)
{
List<Employee> _oemployees = new List<Employee>(); //Employee.GetAllEmps();
// List<Employee> _oemployees = Employee.Get(false);
_employeesForSave = new List<Employee>();
Employee oemployee = null;
Employee lineManager = 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)
{
if (dr["Line Manager"].ToString() == string.Empty)
{
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Line Manager", nRow, "(" + dr["Line Manager"].ToString() + ")" + "Line Manager not found in the current context"));
continue;
}
lineManager = _oemployees.Where(o => o.EmployeeNo == dr["Line Manager"].ToString().Trim()).FirstOrDefault();
if (lineManager == null)
{
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Line Manager", nRow, "(" + dr["Line Manager"].ToString() + ")" + "Line Manager is not found in Employee List."));
continue;
}
oemployee.LineManagerID = lineManager.ID;
//if (dr["Second Line Manager"].ToString() == string.Empty)
//{
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Second Line Manager.", nRow, "(" + dr["Second Line Manager"].ToString() + ")" + "Second Line Manager not found in the current context"));
// continue;
//}
//lineManager = _oemployees.Where(o => o.EmployeeNo == dr["Second Line Manager"].ToString().Trim()).FirstOrDefault();
//if (lineManager == null)
//{
// _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Second Line Manager.", nRow, "(" + dr["Second Line Manager"].ToString() + ")" + "Second Line Manager is not found in Employee List."));
// continue;
//}
//oemployee.SecondLineManagerID = lineManager.ID;
if (dr["Second Line Manager"].ToString() != string.Empty)
{
lineManager = _oemployees.Where(o => o.EmployeeNo == dr["Second Line Manager"].ToString().Trim()).FirstOrDefault();
if (lineManager == null)
{
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Second Line Manager.", nRow, "(" + dr["Second Line Manager"].ToString() + ")" + "Second Line Manager is not found in Employee List."));
continue;
}
oemployee.SecondLineManagerID = lineManager.ID;
}
_employeesForSave.Add(oemployee);
}
else _errorOrSuccessList.Add(UploadErrorOrSuccess.Create("Employee No", nRow, "(" + dr["Employee No"].ToString() + ")" + "Employee not found in the Employee List"));
}
}
catch (Exception ex)
{
throw new ServiceException("Error occurred on row:" + nRow + " Reason:" + ex.Message);
}
}
#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 SaveEmpDeptInformation()
// {
// try
// {
// _basicwithEmployee.SaveDept();
// }
// catch (Exception ex)
// {
// throw new ServiceException(ex.Message);
// }
// }
// #endregion
// #region Save Employee WorkPlanSetup Information
// public void SaveEmployeeWorkPlanSetupInfo()
// {
// try
// {
// new EmployeeWorkPlanSetup().Save(_employeeWorkPlanSetups);
// }
// catch (Exception ex)
// {
// throw new ServiceException(ex.Message);
// }
// }
// #endregion
// #region Save Employee Card Information
// public void SaveEmpCardInformation()
// {
// try
// {
// CardOperation.AssignCardToEmployee(_CardOperations);
// }
// catch (Exception ex)
// {
// throw new ServiceException(ex.Message);
// }
// }
// #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 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
// {
// List<HREmployee> hrEmps = HREmployee.Get();
// List<EmpLifeCycle> cycles = new List<EmpLifeCycle>();
// foreach (EmployeeGradeSalary oGradeSalary in oempgradesalarys)
// {
// EmpLifeCycle cyc = new EmpLifeCycle();
// cyc.EmployeeID = oGradeSalary.EmployeeID;
// cyc.EffectDate = oGradeSalary.EffectDate;
// cyc.GradeID = oGradeSalary.GradeID;
// cyc.Status = EnumEmployeeStatus.Live;
// cyc.StatusDetailID = oGradeSalary.GradeSalaryTypeID;
// cyc.CreatedBy = User.CurrentUser.ID;
// cyc.CreatedDate = DateTime.Today;
// cyc.EmployeeGradeSalary = oGradeSalary;
// cyc.HREmployee = hrEmps.Find(delegate(HREmployee emp) { return emp.ID.Integer == oGradeSalary.EmployeeID.Integer; });
// cycles.Add(cyc);
// // oGradeSalary.Save();
// }
// EmpLifeCycle savecycle = new EmpLifeCycle();
// savecycle.Save(cycles);
// }
// 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
// {
// new LoanIssue().SaveAll(loanissues);
// }
// catch (Exception ex)
// {
// throw new ServiceException(ex.Message);
// }
// }
// #endregion]
// #region Save Bonus Data
// public void SaveBonusInformation()
// {
// try
// {
// _BonusProcess.Save();
// }
// 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(List<Category> categorys, List<Grade> grades, List<Department> departments, List<Location> locations,
// List<Religion> religions, List<Designation> designations, List<Bank> banks, List<Branch> branches, List<Employee> employees, List<AccessCard> accessCards)
// {
// RegularDataUpload.Service.Save(categorys, grades, departments, locations, religions, designations, banks, branches, employees, accessCards, SystemInformation.CurrentSysInfo.PayrollTypeID);
// }
// public static void Save2(List<Department> departments, List<Employee> employees)
// {
// RegularDataUpload.Service.Save2(departments, employees);
// }
// #endregion
// #region Save Employee Tax Data
// public void SaveEmpTaxData(List<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(List<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(List<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(List<HREmployee> oEmployees)
// {
// try
// {
// new HREmployee().Save(oEmployees);
// }
// catch (Exception ex)
// {
// throw new ServiceException(ex.Message);
// }
// }
// public void SaveHREmpContactData(List<EmpContact> oEmpContacts)
// {
// try
// {
// HREmployee.SaveMultipleEmployeeContacts(oEmpContacts);
// }
// catch (Exception ex)
// {
// throw new ServiceException(ex.Message);
// }
// }
// public void SaveLTAData(List<ArrearProcessDetailItem> oArrearProcessDetailItems)
// {
// try
// {
// ArrearProcess arrearProcess = new ArrearProcess();
// arrearProcess.SaveDetailItem(oArrearProcessDetailItems);
// }
// catch (Exception ex)
// {
// throw new ServiceException(ex.Message);
// }
// }
// public void SaveGradeSalary(List<EmpLifeCycle> empLifeCycles)
// {
// try
// {
// EmpLifeCycle savecycle = new EmpLifeCycle();
// savecycle.Save(empLifeCycles);
// }
// 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);
// }
// }
// #endregion
// #region OPI Data
// public void SaveOPIData()
// {
// try
// {
// OPIProcess ob = new OPIProcess();
// ob.UpdateOPIDetail(_oPIProcessDetailItem);
// }
// catch (Exception ex)
// {
// throw new ServiceException(ex.Message);
// }
// }
// #endregion
// private void SaveOrganogramData()
// {
// throw new NotImplementedException();
// }
//public void SaveEmpLineManager2()
//{
// try
// {
// new Employee().UpdateLM2(_employeesForSave);
// }
// catch (Exception ex)
// {
// throw new ServiceException(ex.Message);
// }
//}
// #endregion
//}
//#region IRegularDataUploadServices
//public interface IRegularDataUploadService
//{
// //DataTable LoadData(string filePath);
// //DataTable LoadData(string filePath, string sheetName);
// //DataSet LoadExcelData(string filePath, List<string> sheetName);
// void Save(List<Category> categorys, List<Grade> grades, List<Department> departments, List<Location> locations,
// List<Religion> religions, List<Designation> designations, List<Bank> banks,
// List<Branch> branches, List<Employee> employees, List<AccessCard> accessCards, int payrollTypeID);
// void Save2(List<Department> departments, List<Employee> employees);
//}
}
}