using System; using System.Collections.Generic; using System.Linq; using System.Text; using Payroll.BO; using System.Data; using Ease.CoreV35.Model; using System.IO; namespace Payroll.Report { public class rptEmployeeAllInfo { public DataSet ShowEmployeeAllInformation(HREmployee employee) { PayrollDataSet.PayrollDataSet.EmpAcademicBackgroundDataTable dTAcademicBackGround = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpAcademicBackgroundDataTable(); PayrollDataSet.PayrollDataSet.EmpPersonalInformationDataTable dTPersonalInformation = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpPersonalInformationDataTable(); foreach (EmpAcademic tmpEmpAcademic in employee.Academics) { DataRow ndr = dTAcademicBackGround.NewRow(); ndr["QualificationDegree"] = tmpEmpAcademic.EducationLevel.Description; ndr["DivisionClass"] = tmpEmpAcademic.ResultType.Description; ndr["InstitutionAndPlace"] = tmpEmpAcademic.InstituteName; ndr["Year"] = tmpEmpAcademic.PassingYear; ndr["Subject"] = tmpEmpAcademic.Discipline.Description; dTAcademicBackGround.Rows.Add(ndr); } ObjectsTemplate allQAns = employee.EmpHRQuestionAnswers; ObjectsTemplate _oPhotoPaths = PhotoPath.Get(); string photoPath = string.Empty; if (_oPhotoPaths.Count >= 1) photoPath = _oPhotoPaths[0].EmployeePhoto + "\\" + employee.PhotoPath; PayrollDataSet.PayrollDataSet.EmployeePhotoPathDataTable dTphotoPAth = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmployeePhotoPathDataTable(); DataRow ePhotoPath = dTphotoPAth.NewRow(); ePhotoPath["path"] = photoPath; dTphotoPAth.Rows.Add(dTphotoPAth); DataRow dr = dTPersonalInformation.NewRow(); dr["Name"] = employee.Name; dr["FatherName"] = employee.FatherName; dr["MotherName"] = employee.MotherName; dr["DateOfBirth"] = employee.BirthDate; dr["PlaceOfBirth"] = employee.BirthPlace; dr["Sex"] = employee.Gender.ToString(); dr["Telephone"] = employee.MobileNo; dr["Religion"] = employee.Religion.Name; dr["BloodGroup"] = employee.BloodGroup.ToString(); dr["Nationality"] = employee.Nationality.Description; dr["MaritalStatus"] = employee.MaritalStatus.ToString(); dr["NameOfSpouse"] = string.Empty; dr["SpouseOccupation"] = string.Empty; if (employee.Spouses.Count != 0) { dr["NameOfSpouse"] = employee.Spouses[0].Name; dr["SpouseOccupation"] = employee.Spouses[0].Occupation.Description; } dr["NumberOfChildren"] = employee.Childrens.Count; dr["NumberOfDependants"] = string.Empty; foreach (EmpHRQuestionAnswer empQ in allQAns) { if (empQ.QuestionNo == "Q14") { dr["NumberOfDependants"] = empQ.QAnswer; break; } } dTPersonalInformation.Rows.Add(dr); PayrollDataSet.PayrollDataSet.EmpPermanentAndMailingAddressDataTable dTEmployeeAddress = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpPermanentAndMailingAddressDataTable(); DataRow adataRow = dTEmployeeAddress.NewRow(); if (employee.Contacts.Count >= 1) { adataRow["PermanentAddress"] = employee.Contacts[0].ParmanentAddress; adataRow["PermanentThana"] = employee.Contacts[0].ParmanentThana.Name; adataRow["PermanentDistrict"] = employee.Contacts[0].ParmanentDistrict.Name; adataRow["PresentAddress"] = employee.Contacts[0].PresentAddress; adataRow["PresentThana"] = employee.Contacts[0].PresentThana.Name; adataRow["PresentDistrict"] = employee.Contacts[0].PresentDistrict.Name; dTEmployeeAddress.Rows.Add(adataRow); } else { adataRow["PermanentAddress"] = string.Empty; adataRow["PermanentThana"] = string.Empty; adataRow["PermanentDistrict"] = string.Empty; adataRow["PresentAddress"] = string.Empty; adataRow["PresentThana"] = string.Empty; adataRow["PresentDistrict"] = string.Empty; dTEmployeeAddress.Rows.Add(adataRow); } ObjectsTemplate allRelations = Relation.Get(); Dictionary mapRelations = new Dictionary(); foreach (Relation rel in allRelations) { mapRelations.Add(rel.ID.Integer, rel.Description); } PayrollDataSet.PayrollDataSet.EmpMembershipInSocietiesClubsAssociationsDataTable dTEmploymentMembership = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpMembershipInSocietiesClubsAssociationsDataTable(); foreach (EmpMembership emp in employee.EmpMemberships) { DataRow ndr = dTEmploymentMembership.NewRow(); ndr["OrganizationAndPlace"] = emp.Organization; ndr["NatureOfActivities"] = emp.Activity; ndr["PeriodFromTo"] = emp.FromDate.ToString("dd MMM yyyy") + " - " + emp.EndDate.ToString("dd MMM yyyy"); dTEmploymentMembership.Rows.Add(ndr); } PayrollDataSet.PayrollDataSet.EmpExtraCaricularActivitiesDataTable dTEmpExtraCaricularActivities = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpExtraCaricularActivitiesDataTable(); foreach (EmpCurricularActivity empextra in employee.CurricularActivities) { DataRow ndr = dTEmpExtraCaricularActivities.NewRow(); ExtraCurricularActivity objExtra = ExtraCurricularActivity.Get(empextra.CurricularActivityID); ndr["Description"] = objExtra.Description; dTEmpExtraCaricularActivities.Rows.Add(ndr); } PayrollDataSet.PayrollDataSet.EmpCloseRelationsDataTable dTEmpCloseRelations = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpCloseRelationsDataTable(); foreach (EmpRelation emprelation in employee.EmpRelations) { DataRow ndr = dTEmpCloseRelations.NewRow(); ndr["Name"] = emprelation.Name; ndr["Relation"] = emprelation.Relation.Description; ndr["OccupationAndOrganization"] = emprelation.Occupation.Description; dTEmpCloseRelations.Rows.Add(ndr); } PayrollDataSet.PayrollDataSet.EmpReferencesDataTable dTEmpRef = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpReferencesDataTable(); foreach (EmpReference empRef in employee.References) { DataRow ndr = dTEmpRef.NewRow(); ndr["Name"] = empRef.Name; ndr["Occupation"] = empRef.Occupation.Description; ndr["Address"] = empRef.Address; ndr["Telephone"] = empRef.Telephone; dTEmpRef.Rows.Add(ndr); } PayrollDataSet.PayrollDataSet.EmpEmploymentHistoryDataTable dTEmpEmploymentExperience = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpEmploymentHistoryDataTable(); foreach (EmpExperience empExperience in employee.Experiences) { DataRow ndr = dTEmpEmploymentExperience.NewRow(); ndr["Organization"] = empExperience.Employer; // ndr["Year"] = empExperience.ToDate.Year - (empExperience.FromDate.Year); TimeSpan dif = empExperience.ToDate.Subtract(empExperience.FromDate); Decimal years = Math.Round((dif.Days / (Decimal)365.00)); ndr["Year"] = Convert.ToInt32(years); ndr["LastJobTitle"] = empExperience.Designation; ndr["Responsibilities"] = empExperience.JobDescription; dTEmpEmploymentExperience.Rows.Add(ndr); } PayrollDataSet.PayrollDataSet.EmpWorkingRelativesAnsDataTable dTEmpRelativeAns = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpWorkingRelativesAnsDataTable(); DataRow andr = dTEmpRelativeAns.NewRow(); andr["Ans"] = "NO"; bool flag = false; if (employee.EmpRelatives.Count > 0) { flag = true; andr["Ans"] = "YES"; } dTEmpRelativeAns.Rows.Add(andr); PayrollDataSet.PayrollDataSet.EmpOtherProfessionalQualificationsDataTable empOtherProQ = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpOtherProfessionalQualificationsDataTable(); DataRow nndr = empOtherProQ.NewRow(); foreach (EmpHRQuestionAnswer empQ in allQAns) { if (empQ.QuestionNo == "Q15") { nndr["Description"] = empQ.QAnswer; break; } } empOtherProQ.Rows.Add(nndr); PayrollDataSet.PayrollDataSet.EmpLanguageKnownDataTable emplagKnown = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpLanguageKnownDataTable(); foreach (EmpLanguage empLan in employee.EmpLanguages) { DataRow adr = emplagKnown.NewRow(); adr["LanguageKnownName"] = empLan.LanguageName; adr["Spoken"] = empLan.SpokenStatus.ToString(); adr["Written"] = empLan.WrittenStatus.ToString(); emplagKnown.Rows.Add(adr); } PayrollDataSet.PayrollDataSet.EmpDescribeInDetailsPresentJobResponsibilitiesDataTable empDetailsPersonalJobResponsibilities= new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpDescribeInDetailsPresentJobResponsibilitiesDataTable(); DataRow aadr = empDetailsPersonalJobResponsibilities.NewRow(); foreach (EmpHRQuestionAnswer empQ in allQAns) { if (empQ.QuestionNo == "Q16") { aadr["Description"] = empQ.QAnswer; break; } } empDetailsPersonalJobResponsibilities.Rows.Add(aadr); PayrollDataSet.PayrollDataSet.EmpReasonForLeavingCurrentJobDataTable empReasonForLeavingCurrentJob = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpReasonForLeavingCurrentJobDataTable(); DataRow ardr = empReasonForLeavingCurrentJob.NewRow(); foreach (EmpHRQuestionAnswer empQ in allQAns) { if (empQ.QuestionNo == "Q17") { ardr["Ans"] = empQ.QAnswer; break; } } empReasonForLeavingCurrentJob.Rows.Add(ardr); PayrollDataSet.PayrollDataSet.EmpListOfRelativeWorkingInCompanyDataTable empRelativeWorkingInRelatives = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpListOfRelativeWorkingInCompanyDataTable(); if (!flag) { DataRow aradr = empRelativeWorkingInRelatives.NewRow(); empRelativeWorkingInRelatives.Rows.Add(aradr); } else { foreach (EmpRelative emprel in employee.EmpRelatives) { DataRow aradr = empRelativeWorkingInRelatives.NewRow(); aradr["Name"] = emprel.Name; aradr["Relationship"] = String.Empty; if (mapRelations.ContainsKey(emprel.RelationID.Integer)) { aradr["Relationship"] = mapRelations[emprel.RelationID.Integer]; } aradr["Designation"] = emprel.Designation; aradr["PeriodOfService"] = Convert.ToDateTime(emprel.FromDateString).ToString("dd MMM yyyy") + " - " + emprel.EndDate.ToString("dd MMM yyyy"); empRelativeWorkingInRelatives.Rows.Add(aradr); } } PayrollDataSet.PayrollDataSet.EmpAnsDataTable empQA = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpAnsDataTable(); string presentEmployerAns = String.Empty; string pastEmployerAns = String.Empty; DataRow aradrk = empQA.NewRow(); aradrk["PresentEmployer"] = String.Empty; aradrk["PastEmployer"] = String.Empty; int count = 0; foreach (EmpHRQuestionAnswer empQ in allQAns) { if (empQ.QuestionNo == "Q11") { aradrk["PresentEmployer"] = empQ.QAnswer; count++; } if (empQ.QuestionNo == "Q12") { aradrk["PastEmployer"] = empQ.QAnswer; count++; } if (count == 2) break; } empQA.Rows.Add(aradrk); PayrollDataSet.PayrollDataSet.EmpAdditionalInformationDataTable empAdditionalInfo = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpAdditionalInformationDataTable(); DataRow aradrkk = empAdditionalInfo.NewRow(); foreach (EmpHRQuestionAnswer empQ in allQAns) { if (empQ.QuestionNo == "Q20") { aradrkk["Description"] = empQ.QAnswer; break; } } empAdditionalInfo.Rows.Add(aradrkk); DataSet ds = new DataSet(); empRelativeWorkingInRelatives.TableName = "PayrollDataSet_EmpListOfRelativeWorkingInCompany"; ds.Tables.Add(empRelativeWorkingInRelatives); dTphotoPAth.TableName = "PayrollDataSet_EmployeePhotoPath"; ds.Tables.Add(dTphotoPAth); empQA.TableName = "PayrollDataSet_EmpAns"; ds.Tables.Add(empQA); dTEmployeeAddress.TableName = "PayrollDataSet_EmpPermanentAndMailingAddress"; ds.Tables.Add(dTEmployeeAddress); empAdditionalInfo.TableName = "PayrollDataSet_EmpAdditionalInformation"; ds.Tables.Add(empAdditionalInfo); empReasonForLeavingCurrentJob.TableName = "PayrollDataSet_EmpReasonForLeavingCurrentJob"; ds.Tables.Add(empReasonForLeavingCurrentJob); empDetailsPersonalJobResponsibilities.TableName = "PayrollDataSet_EmpDescribeInDetailsPresentJobResponsibilities"; ds.Tables.Add(empDetailsPersonalJobResponsibilities); emplagKnown.TableName = "PayrollDataSet_EmpLanguageKnown"; ds.Tables.Add(emplagKnown); empOtherProQ.TableName = "PayrollDataSet_EmpOtherProfessionalQualifications"; ds.Tables.Add(empOtherProQ); dTAcademicBackGround.TableName = "PayrollDataSet_EmpAcademicBackground"; ds.Tables.Add(dTAcademicBackGround); dTPersonalInformation.TableName = "PayrollDataSet_EmpPersonalInformation"; ds.Tables.Add(dTPersonalInformation); dTEmploymentMembership.TableName = "PayrollDataSet_EmpMembershipInSocietiesClubsAssociations"; ds.Tables.Add(dTEmploymentMembership); dTEmpExtraCaricularActivities.TableName = "PayrollDataSet_EmpExtraCaricularActivities"; ds.Tables.Add(dTEmpExtraCaricularActivities); dTEmpCloseRelations.TableName = "PayrollDataSet_EmpCloseRelations"; ds.Tables.Add(dTEmpCloseRelations); dTEmpRef.TableName = "PayrollDataSet_EmpReferences"; ds.Tables.Add(dTEmpRef); dTEmpEmploymentExperience.TableName = "PayrollDataSet_EmpEmploymentHistory"; ds.Tables.Add(dTEmpEmploymentExperience); dTEmpRelativeAns.TableName = "PayrollDataSet_EmpWorkingRelativesAns"; ds.Tables.Add(dTEmpRelativeAns); //DataTable dt = new DataTable(); //DataRow dtr = dt.NewRow(); //dr["photoPath"] = employee.PhotoPath; //dt.Rows.Add(dtr); //ds.Tables.Add(dt); return ds; } } }