public int CreateExcelupload(ExcelUploadEntities ExcelUploadEntity) { //if (ExcelUploadEntity.SUBDIVISION!=null) //{ // ExcelUploadEntity.SUBDIVISION = Getsubdivisionid(ExcelUploadEntity.SUB_DIVISIONNAME); //} //if (ExcelUploadEntity.SECTION != null) //{ // ExcelUploadEntity.SECTION = Getsectionid(ExcelUploadEntity.SECTIONNAME); //} if (ExcelUploadEntity.gradename != null) { ExcelUploadEntity.GRADE = Getdgradeid(ExcelUploadEntity.gradename); } if (ExcelUploadEntity.departmentname != null) { ExcelUploadEntity.DEPARTMENT = Getdepartmentid(ExcelUploadEntity.departmentname); } if (ExcelUploadEntity.designationname != null) { ExcelUploadEntity.DESIGNATION = Getdesigid(ExcelUploadEntity.designationname); } //if (ExcelUploadEntity.bloodgroup != null) //{ // ExcelUploadEntity.BLOOD_GROUP = Getbloodgid(ExcelUploadEntity.bloodgroup); //} var bsicinfo = new TBL_EMP_BASICINFO { DESIGNATION = ExcelUploadEntity.DESIGNATION, JOINING_DATE = ExcelUploadEntity.JOINING_DATE, EMPLOYEE_CODE = ExcelUploadEntity.EMPLOYEE_CODE, EMPLOYEE_FIRSTNAME = ExcelUploadEntity.EMPLOYEE_FIRSTNAME, EMPLOYEE_MIDDLENAME = ExcelUploadEntity.EMPLOYEE_MIDDLENAME, EMPLOYEE_LASTNAME = ExcelUploadEntity.EMPLOYEE_LASTNAME, DATE_OF_BIRTH = ExcelUploadEntity.DATE_OF_BIRTH, AGE = ExcelUploadEntity.AGE, SEX = ExcelUploadEntity.SEX, MATERIAL_STATUS = ExcelUploadEntity.MATERIAL_STATUS, WEDDING_ANNIVERSARY = ExcelUploadEntity.WEDDING_ANNIVERSARY, REPORTING_TO = ExcelUploadEntity.REPORTING_TO, GRADE = ExcelUploadEntity.GRADE, DIVISION = ExcelUploadEntity.DIVISION, SUBDIVISION = ExcelUploadEntity.SUBDIVISION, SECTION = ExcelUploadEntity.SECTION, BLOOD_GROUP = ExcelUploadEntity.BLOOD_GROUP, HEIGHT = ExcelUploadEntity.HEIGHT, WEIGHT = ExcelUploadEntity.WEIGHT, MEDICLAIM_NUMBER = ExcelUploadEntity.MEDICLAIM_NUMBER, ESIC_NO = ExcelUploadEntity.ESIC_NO, PF_UNID_NUMBER = ExcelUploadEntity.PF_UNID_NUMBER, INDUCTION = ExcelUploadEntity.INDUCTION, IDENTIFICATION_MARK = ExcelUploadEntity.IDENTIFICATION_MARK, LAST_MAJOR_ILLNESS_SURGERY = ExcelUploadEntity.LAST_MAJOR_ILLNESS_SURGERY, ALLERGY_HISTORY = ExcelUploadEntity.ALLERGY_HISTORY, PHYSICAL_DISABILITY = ExcelUploadEntity.PHYSICAL_DISABILITY, HIRING_TYPE = ExcelUploadEntity.HIRING_TYPE, CV_TYPE = ExcelUploadEntity.CV_TYPE, YEAR_OF_EXPERIENCE = ExcelUploadEntity.YEAR_OF_EXPERIENCE, EXIT_DATE = ExcelUploadEntity.EXIT_DATE, EXIT_TYPE = ExcelUploadEntity.EXIT_TYPE, REFERENCE = ExcelUploadEntity.REFERENCE, DEPARTMENT = ExcelUploadEntity.DEPARTMENT, FULL_N_FINAL_STATUS = ExcelUploadEntity.FULL_N_FINAL_STATUS, MOTHERTOUNGE = ExcelUploadEntity.MOTHERTOUNGE, WORKLOCATION = ExcelUploadEntity.WORKLOCATION, RELIGION = ExcelUploadEntity.RELIGION, STATUS = ExcelUploadEntity.STATUS, EMPIMG = ExcelUploadEntity.EMPIMG }; _UOW.EMP_BASICINFORepository.Insert(bsicinfo); _UOW.Save(); TBL_EMP_TRANSFER_DETAILS tr = new TBL_EMP_TRANSFER_DETAILS(); tr.EMPLOYEE_ID = Convert.ToDecimal(bsicinfo.ID); tr.DESIGNATION_ID = ExcelUploadEntity.DESIGNATION; tr.WORK_LOCATION = ExcelUploadEntity.WORKLOCATION; tr.DIVISION = ExcelUploadEntity.DIVISION; tr.SUB_DIVISION = ExcelUploadEntity.SUBDIVISION; tr.SECTION = ExcelUploadEntity.SECTION; tr.DEPARTMENT = ExcelUploadEntity.DEPARTMENT; tr.REPORTINGPERNAME = ExcelUploadEntity.REPORTING_TO; //tr.REPORTING_PERSON = Convert.ToDecimal(ExcelUploadEntity.REPORTING_TO); tr.FROM_DATE = ExcelUploadEntity.JOINING_DATE; tr.TO_DATE = ExcelUploadEntity.EXIT_DATE; tr.STATUS = ExcelUploadEntity.STATUS; _UOW.TRANSFER_DETAILSMASTERRepository.Insert(tr); _UOW.Save(); if (ExcelUploadEntity.Account != null) { foreach (var item in ExcelUploadEntity.Account) { TBL_EMP_SALARYACCOUNTDETAILS sal = new TBL_EMP_SALARYACCOUNTDETAILS(); sal.EMPLOYEE_ID = Convert.ToDecimal(bsicinfo.ID); sal.ACCOUNTNO = item.ACCOUNTNO; sal.IFSCCODE = item.IFSCCODE; sal.BRANCH = item.BRANCH; sal.BANKNAME = item.BANKNAME; sal.CTC = item.CTC; _UOW.SALARYACCOUNTDETAILSRepository.Insert(sal); _UOW.Save(); } } if (ExcelUploadEntity.Relationship != null) { foreach (var item in ExcelUploadEntity.Relationship) { TBL_EMP_RELATIONSHIP_DETAILS rel = new TBL_EMP_RELATIONSHIP_DETAILS(); rel.EMPLOYEE_ID = Convert.ToDecimal(bsicinfo.ID); rel.RELATIVE_NAME = item.RELATIVE_NAME; rel.RELATIONSHIP = item.RELATIONSHIP; rel.DATE_OF_BIRTH = item.DATE_OF_BIRTH; _UOW.RELATIONSHIP_DETAILSRepository.Insert(rel); _UOW.Save(); } } if (ExcelUploadEntity.Communication != null) { foreach (var item in ExcelUploadEntity.Communication) { TBL_EMP_COMMUNICATION_DETAILS rel = new TBL_EMP_COMMUNICATION_DETAILS(); rel.EMPLOYEE_ID = Convert.ToDecimal(bsicinfo.ID); rel.PERMANENT_ADDRESS = item.PERMANENT_ADDRESS; rel.MOBILE_NUMBER = item.MOBILE_NUMBER; rel.PANCARD_NUMBER = item.PANCARD_NUMBER; rel.EMERGENCY_CONTACT_NUMBER = item.EMERGENCY_CONTACT_NUMBER; rel.OFFICIAL_MOBILE_NUMBER = item.OFFICIAL_MOBILE_NUMBER; rel.OFFICIAL_EMAIL = item.OFFICIAL_EMAIL; rel.PERSONAL_EMAIL = item.PERSONAL_EMAIL; rel.AADHAR_NUMBER = item.AADHAR_NUMBER; //rel.DATE_OF_BIRTH = item.DATE_OF_BIRTH; _UOW.EMP_COMMUNICATION_DETAILSRepository.Insert(rel); _UOW.Save(); } } if (ExcelUploadEntity.qualification != null) { foreach (var item in ExcelUploadEntity.qualification) { TBL_EMP_QUALIFICATION_DETAILS qual = new TBL_EMP_QUALIFICATION_DETAILS(); qual.EMPLOYEE_ID = Convert.ToDecimal(bsicinfo.ID); qual.EXAM_DEGREE_TYPE = item.EXAM_DEGREE_TYPE; qual.END_DATE = item.END_DATE; _UOW.EMP_QUALIFICATION_DETAILSRepository.Insert(qual); _UOW.Save(); } } if (ExcelUploadEntity.Employment != null) { foreach (var item in ExcelUploadEntity.Employment) { TBL_EMP_EMPLOYMENT_RECORD qual = new TBL_EMP_EMPLOYMENT_RECORD(); qual.EMPLOYEE_ID = Convert.ToDecimal(bsicinfo.ID); qual.ORGANISATION_NAME = item.ORGANISATION_NAME; _UOW.EMPLOYMENT_RECORDRepository.Insert(qual); _UOW.Save(); } } return(Convert.ToInt32(bsicinfo.ID)); }
public int CreateEmployeebasicinfo(BasicInformaionEntities BasicinfoEntities) { int status = 0; if (BasicinfoEntities != null) { try { var project = _UOW.EMP_BASICINFORepository.GetByID(Convert.ToInt32(BasicinfoEntities.ID)); if (project != null) { if (BasicinfoEntities.JOININGDATE != null) { var joiningdate = DateTime.ParseExact(BasicinfoEntities.JOININGDATE, "dd/MM/yyyy", CultureInfo.InvariantCulture); project.JOINING_DATE = joiningdate; } if (BasicinfoEntities.EMPLOYEE_CODE != "" && BasicinfoEntities.EMPLOYEE_CODE != null) { project.EMPLOYEE_CODE = BasicinfoEntities.EMPLOYEE_CODE; } if (BasicinfoEntities.EMPLOYEE_FIRSTNAME != "" && BasicinfoEntities.EMPLOYEE_FIRSTNAME != null) { project.EMPLOYEE_FIRSTNAME = BasicinfoEntities.EMPLOYEE_FIRSTNAME; } if (BasicinfoEntities.EMPLOYEE_MIDDLENAME != "" && BasicinfoEntities.EMPLOYEE_MIDDLENAME != null) { project.EMPLOYEE_MIDDLENAME = BasicinfoEntities.EMPLOYEE_MIDDLENAME; } if (BasicinfoEntities.EMPLOYEE_LASTNAME != "" && BasicinfoEntities.EMPLOYEE_LASTNAME != null) { project.EMPLOYEE_LASTNAME = BasicinfoEntities.EMPLOYEE_LASTNAME; } if (BasicinfoEntities.DOB != null && BasicinfoEntities.DOB != "") { var DOB = DateTime.ParseExact(BasicinfoEntities.DOB, "dd/MM/yyyy", CultureInfo.InvariantCulture); project.DATE_OF_BIRTH = DOB; } if (BasicinfoEntities.AGE != null) { project.AGE = BasicinfoEntities.AGE; } if (BasicinfoEntities.SEX != "" && BasicinfoEntities.SEX != null) { project.SEX = BasicinfoEntities.SEX; } if (BasicinfoEntities.MATERIAL_STATUS != "" && BasicinfoEntities.MATERIAL_STATUS != null) { project.MATERIAL_STATUS = BasicinfoEntities.MATERIAL_STATUS; } if (BasicinfoEntities.WEDDING != null && BasicinfoEntities.WEDDING != "") { var WEDDING = DateTime.ParseExact(BasicinfoEntities.WEDDING, "dd/MM/yyyy", CultureInfo.InvariantCulture); project.WEDDING_ANNIVERSARY = WEDDING; } if (BasicinfoEntities.REPORTING_TO != "" && BasicinfoEntities.REPORTING_TO != "0") { project.REPORTING_TO = BasicinfoEntities.REPORTING_TO; } if (BasicinfoEntities.DEPARTMENT != null && BasicinfoEntities.DEPARTMENT != 0) { project.DEPARTMENT = BasicinfoEntities.DEPARTMENT; } if (BasicinfoEntities.DESIGNATION != null && BasicinfoEntities.DESIGNATION != 0) { project.DESIGNATION = BasicinfoEntities.DESIGNATION; } if (BasicinfoEntities.GRADE != null && BasicinfoEntities.GRADE != 0) { project.GRADE = BasicinfoEntities.GRADE; } if (BasicinfoEntities.DIVISION != "" && BasicinfoEntities.DIVISION != "0") { project.DIVISION = BasicinfoEntities.DIVISION; } if (BasicinfoEntities.SUBDIVISION != "" && BasicinfoEntities.SUBDIVISION != "0") { project.SUBDIVISION = BasicinfoEntities.SUBDIVISION; } if (BasicinfoEntities.SECTION != "" && BasicinfoEntities.SECTION != "0") { project.SECTION = BasicinfoEntities.SECTION; } if (BasicinfoEntities.BLOOD_GROUP != null && BasicinfoEntities.BLOOD_GROUP != 0) { project.BLOOD_GROUP = BasicinfoEntities.BLOOD_GROUP; } if (BasicinfoEntities.HEIGHT != null) { project.HEIGHT = BasicinfoEntities.HEIGHT; } if (BasicinfoEntities.WEIGHT != null) { project.WEIGHT = BasicinfoEntities.WEIGHT; } if (BasicinfoEntities.MEDICLAIM_NUMBER != "" && BasicinfoEntities.MEDICLAIM_NUMBER != null) { project.MEDICLAIM_NUMBER = BasicinfoEntities.MEDICLAIM_NUMBER; } if (BasicinfoEntities.ESIC_NO != "" && BasicinfoEntities.ESIC_NO != null) { project.ESIC_NO = BasicinfoEntities.ESIC_NO; } if (BasicinfoEntities.PF_UNID_NUMBER != "" && BasicinfoEntities.PF_UNID_NUMBER != null) { project.PF_UNID_NUMBER = BasicinfoEntities.PF_UNID_NUMBER; } if (BasicinfoEntities.INDUCTION != "" && BasicinfoEntities.INDUCTION != null) { project.INDUCTION = BasicinfoEntities.INDUCTION; } if (BasicinfoEntities.IDENTIFICATION_MARK != "" && BasicinfoEntities.IDENTIFICATION_MARK != null) { project.IDENTIFICATION_MARK = BasicinfoEntities.IDENTIFICATION_MARK; } if (BasicinfoEntities.LAST_MAJOR_ILLNESS_SURGERY != "" && BasicinfoEntities.LAST_MAJOR_ILLNESS_SURGERY != null) { project.LAST_MAJOR_ILLNESS_SURGERY = BasicinfoEntities.LAST_MAJOR_ILLNESS_SURGERY; } if (BasicinfoEntities.ALLERGY_HISTORY != "" && BasicinfoEntities.ALLERGY_HISTORY != null) { project.ALLERGY_HISTORY = BasicinfoEntities.ALLERGY_HISTORY; } if (BasicinfoEntities.PHYSICAL_DISABILITY != "" && BasicinfoEntities.PHYSICAL_DISABILITY != null) { project.PHYSICAL_DISABILITY = BasicinfoEntities.PHYSICAL_DISABILITY; } if (BasicinfoEntities.HIRING_TYPE != "" && BasicinfoEntities.HIRING_TYPE != "0") { project.HIRING_TYPE = BasicinfoEntities.HIRING_TYPE; } if (BasicinfoEntities.CV_TYPE != "" && BasicinfoEntities.CV_TYPE != "0") { project.CV_TYPE = BasicinfoEntities.CV_TYPE; } if (BasicinfoEntities.YEAR_OF_EXPERIENCE != null) { project.YEAR_OF_EXPERIENCE = BasicinfoEntities.YEAR_OF_EXPERIENCE; } if (BasicinfoEntities.EXITDATE != null && BasicinfoEntities.EXITDATE != null) { var EXITDATE = DateTime.ParseExact(BasicinfoEntities.EXITDATE, "dd/MM/yyyy", CultureInfo.InvariantCulture); project.EXIT_DATE = EXITDATE; var trdtls = _UOW.TRANSFER_DETAILSMASTERRepository.GetManyQueryable(x => x.EMPLOYEE_ID == BasicinfoEntities.ID).OrderBy(y => y.ID).LastOrDefault(); if (trdtls != null) { trdtls.TO_DATE = EXITDATE; trdtls.STATUS = "Inactive"; } _UOW.TRANSFER_DETAILSMASTERRepository.Update(trdtls); _UOW.Save(); project.STATUS = "Inactive"; } if (BasicinfoEntities.RESIGNATIONDATE != "" && BasicinfoEntities.RESIGNATIONDATE != null) { var resigndate = DateTime.ParseExact(BasicinfoEntities.RESIGNATIONDATE, "dd/MM/yyyy", CultureInfo.InvariantCulture); project.RESIGNATIONDATE = resigndate; } if (BasicinfoEntities.LEAVEENCASHMENT != "" && BasicinfoEntities.LEAVEENCASHMENT != null) { project.LEAVEENCASHMENT = BasicinfoEntities.LEAVEENCASHMENT; } if (BasicinfoEntities.EXIT_TYPE != null && BasicinfoEntities.EXIT_TYPE != 0) { project.EXIT_TYPE = BasicinfoEntities.EXIT_TYPE; } if (BasicinfoEntities.REFERENCE != "" && BasicinfoEntities.REFERENCE != null) { project.REFERENCE = BasicinfoEntities.REFERENCE; } if (BasicinfoEntities.FULL_N_FINAL_STATUS != "0" && BasicinfoEntities.FULL_N_FINAL_STATUS != null) { project.FULL_N_FINAL_STATUS = BasicinfoEntities.FULL_N_FINAL_STATUS; } if (BasicinfoEntities.WORKLOCATION != null && BasicinfoEntities.WORKLOCATION != 0) { project.WORKLOCATION = BasicinfoEntities.WORKLOCATION; } if (BasicinfoEntities.RELIGION != "" && BasicinfoEntities.RELIGION != null) { project.RELIGION = BasicinfoEntities.RELIGION; } if (BasicinfoEntities.MOTHERTOUNGE != "" && BasicinfoEntities.MOTHERTOUNGE != null) { project.MOTHERTOUNGE = BasicinfoEntities.MOTHERTOUNGE; } if (BasicinfoEntities.DOMICILE_STATUS != "" && BasicinfoEntities.DOMICILE_STATUS != null) { project.DOMICILE_STATUS = BasicinfoEntities.DOMICILE_STATUS; } if (BasicinfoEntities.EXITCATAGORY != null) { project.EXITCATAGORY = BasicinfoEntities.EXITCATAGORY; } //cache.Remove(CacheKey); _UOW.EMP_BASICINFORepository.Update(project); _UOW.Save(); status = Convert.ToInt32(BasicinfoEntities.ID); } else { var joiningdate = (DateTime?)null; //DateTime joiningdate = Convert.ToDateTime(BasicinfoEntities.JOININGDATE); if (BasicinfoEntities.JOININGDATE != null) { joiningdate = DateTime.ParseExact(BasicinfoEntities.JOININGDATE, "dd/MM/yyyy", CultureInfo.InvariantCulture); } //var joiningdate = DateTime.ParseExact(BasicinfoEntities.JOININGDATE, "dd/MM/yyyy", CultureInfo.InvariantCulture); var bsicinfo = new TBL_EMP_BASICINFO { DESIGNATION = BasicinfoEntities.DESIGNATION, JOINING_DATE = joiningdate, EMPLOYEE_CODE = BasicinfoEntities.EMPLOYEE_CODE, EMPLOYEE_FIRSTNAME = BasicinfoEntities.EMPLOYEE_FIRSTNAME, EMPLOYEE_MIDDLENAME = BasicinfoEntities.EMPLOYEE_MIDDLENAME, EMPLOYEE_LASTNAME = BasicinfoEntities.EMPLOYEE_LASTNAME, DATE_OF_BIRTH = BasicinfoEntities.DATE_OF_BIRTH, AGE = BasicinfoEntities.AGE, SEX = BasicinfoEntities.SEX, MATERIAL_STATUS = BasicinfoEntities.MATERIAL_STATUS, WEDDING_ANNIVERSARY = BasicinfoEntities.WEDDING_ANNIVERSARY, REPORTING_TO = BasicinfoEntities.REPORTING_TO, GRADE = BasicinfoEntities.GRADE, DIVISION = BasicinfoEntities.DIVISION, SUBDIVISION = BasicinfoEntities.SUBDIVISION, SECTION = BasicinfoEntities.SECTION, BLOOD_GROUP = BasicinfoEntities.BLOOD_GROUP, HEIGHT = BasicinfoEntities.HEIGHT, WEIGHT = BasicinfoEntities.WEIGHT, MEDICLAIM_NUMBER = BasicinfoEntities.MEDICLAIM_NUMBER, ESIC_NO = BasicinfoEntities.ESIC_NO, PF_UNID_NUMBER = BasicinfoEntities.PF_UNID_NUMBER, INDUCTION = BasicinfoEntities.INDUCTION, IDENTIFICATION_MARK = BasicinfoEntities.IDENTIFICATION_MARK, LAST_MAJOR_ILLNESS_SURGERY = BasicinfoEntities.LAST_MAJOR_ILLNESS_SURGERY, ALLERGY_HISTORY = BasicinfoEntities.ALLERGY_HISTORY, PHYSICAL_DISABILITY = BasicinfoEntities.PHYSICAL_DISABILITY, HIRING_TYPE = BasicinfoEntities.HIRING_TYPE, CV_TYPE = BasicinfoEntities.CV_TYPE, YEAR_OF_EXPERIENCE = BasicinfoEntities.YEAR_OF_EXPERIENCE, EXIT_DATE = BasicinfoEntities.EXIT_DATE, EXIT_TYPE = BasicinfoEntities.EXIT_TYPE, REFERENCE = BasicinfoEntities.REFERENCE, DEPARTMENT = BasicinfoEntities.DEPARTMENT, FULL_N_FINAL_STATUS = BasicinfoEntities.FULL_N_FINAL_STATUS, MOTHERTOUNGE = BasicinfoEntities.MOTHERTOUNGE, WORKLOCATION = BasicinfoEntities.WORKLOCATION, RELIGION = BasicinfoEntities.RELIGION, STATUS = "Active", }; //cache.Remove(CacheKey); _UOW.EMP_BASICINFORepository.Insert(bsicinfo); _UOW.Save(); TBL_EMP_TRANSFER_DETAILS tr = new TBL_EMP_TRANSFER_DETAILS(); tr.EMPLOYEE_ID = Convert.ToDecimal(bsicinfo.ID); tr.DESIGNATION_ID = BasicinfoEntities.DESIGNATION; tr.WORK_LOCATION = BasicinfoEntities.WORKLOCATION; tr.DIVISION = BasicinfoEntities.DIVISION; tr.SUB_DIVISION = BasicinfoEntities.SUBDIVISION; tr.SECTION = BasicinfoEntities.SECTION; tr.DEPARTMENT = BasicinfoEntities.DEPARTMENT; tr.REPORTINGPERNAME = BasicinfoEntities.REPORTING_TO; tr.FROM_DATE = joiningdate; _UOW.TRANSFER_DETAILSMASTERRepository.Insert(tr); _UOW.Save(); status = Convert.ToInt32(bsicinfo.ID); } } catch (Exception ex) { log.Debug("Debug error logging", ex); log.Info("Info error logging", ex); log.Warn("Warn error logging", ex); log.Error("Error error logging", ex); log.Fatal("Fatal error logging", ex); var outputLines = new List <string>(); //foreach (var eve in ex.Message) //{ outputLines.Add(string.Format( "{0}: Entity of type \"{1}\" in state \"{2}\" has the following validation errors:", DateTime.Now, ex.Message, ex.StackTrace, ex.InnerException, ex.HelpLink)); //foreach (var ve in eve.ValidationErrors) //{ // outputLines.Add(string.Format("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage)); //} //} System.IO.File.AppendAllLines(@"D:\errors.txt", outputLines); } } return(status); }