Exemplo n.º 1
0
        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 CreateCommunicationDetails(CommunicationDetailsEntities CommunicationDetailsEntities)
        {
            if (CommunicationDetailsEntities != null)
            {
                var CommunicationDetails = _UOW.EMP_COMMUNICATION_DETAILSRepository.GetAll().ToList().Where(x => x.EMPLOYEE_ID == CommunicationDetailsEntities.EMPLOYEE_ID).FirstOrDefault();
                if (CommunicationDetails != null)
                {
                    if (CommunicationDetailsEntities.PERMANENT_ADDRESS != "" && CommunicationDetailsEntities.PERMANENT_ADDRESS != null)
                    {
                        CommunicationDetails.PERMANENT_ADDRESS = CommunicationDetailsEntities.PERMANENT_ADDRESS;
                    }
                    if (CommunicationDetailsEntities.PERMANENT_ADDRESS_CITY != "" && CommunicationDetailsEntities.PERMANENT_ADDRESS_CITY != null)
                    {
                        CommunicationDetails.PERMANENT_ADDRESS_CITY = CommunicationDetails.PERMANENT_ADDRESS_CITY;
                    }
                    if (CommunicationDetailsEntities.PERMANENT_ADDRESS_STATE != null)
                    {
                        CommunicationDetails.PERMANENT_ADDRESS_STATE = CommunicationDetailsEntities.PERMANENT_ADDRESS_STATE;
                    }
                    if (CommunicationDetailsEntities.PERMANENT_ADDRESS_PIN != null)
                    {
                        CommunicationDetails.PERMANENT_ADDRESS_PIN = CommunicationDetailsEntities.PERMANENT_ADDRESS_PIN;
                    }
                    if (CommunicationDetailsEntities.MAILING_ADDRESS != null && CommunicationDetailsEntities.MAILING_ADDRESS != "")
                    {
                        CommunicationDetails.MAILING_ADDRESS = CommunicationDetailsEntities.MAILING_ADDRESS;
                    }
                    if (CommunicationDetailsEntities.MAILING_ADDRESS_CITY != null && CommunicationDetailsEntities.MAILING_ADDRESS_CITY != "")
                    {
                        CommunicationDetails.MAILING_ADDRESS_CITY = CommunicationDetailsEntities.MAILING_ADDRESS_CITY;
                    }
                    if (CommunicationDetailsEntities.MAILING_ADDRESS_STATE != null)
                    {
                        CommunicationDetails.MAILING_ADDRESS_STATE = CommunicationDetailsEntities.MAILING_ADDRESS_STATE;
                    }
                    if (CommunicationDetailsEntities.MAILING_ADDRESS_PIN != null)
                    {
                        CommunicationDetails.MAILING_ADDRESS_PIN = CommunicationDetailsEntities.MAILING_ADDRESS_PIN;
                    }
                    if (CommunicationDetailsEntities.PHONE_NUMBER != "" && CommunicationDetailsEntities.PHONE_NUMBER != null)
                    {
                        CommunicationDetails.PHONE_NUMBER = CommunicationDetailsEntities.PHONE_NUMBER;
                    }
                    if (CommunicationDetailsEntities.MOBILE_NUMBER != "" && CommunicationDetailsEntities.MOBILE_NUMBER != null)
                    {
                        CommunicationDetails.MOBILE_NUMBER = CommunicationDetailsEntities.MOBILE_NUMBER;
                    }
                    if (CommunicationDetailsEntities.PASSPORT_NUMBER != null && CommunicationDetailsEntities.PASSPORT_NUMBER != "")
                    {
                        CommunicationDetails.PASSPORT_NUMBER = CommunicationDetailsEntities.PASSPORT_NUMBER;
                    }
                    if (CommunicationDetailsEntities.EMERGENCY_CONTACT_NUMBER != "" && CommunicationDetailsEntities.EMERGENCY_CONTACT_NUMBER != null)
                    {
                        CommunicationDetails.EMERGENCY_CONTACT_NUMBER = CommunicationDetailsEntities.EMERGENCY_CONTACT_NUMBER;
                    }
                    if (CommunicationDetailsEntities.RELATIONSHIP != "" && CommunicationDetailsEntities.RELATIONSHIP != null)
                    {
                        CommunicationDetails.RELATIONSHIP = CommunicationDetailsEntities.RELATIONSHIP;
                    }
                    if (CommunicationDetailsEntities.VALIDITY != null)
                    {
                        var VALdate = DateTime.ParseExact(CommunicationDetailsEntities.VALIDITY, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                        CommunicationDetails.PASSPORT_VALIDITY = VALdate;
                    }
                    if (CommunicationDetailsEntities.DRIVING_LICENCE_NUMBER != null && CommunicationDetailsEntities.DRIVING_LICENCE_NUMBER != "")
                    {
                        CommunicationDetails.DRIVING_LICENCE_NUMBER = CommunicationDetailsEntities.DRIVING_LICENCE_NUMBER;
                    }
                    if (CommunicationDetailsEntities.PANCARD_NUMBER != null && CommunicationDetailsEntities.PANCARD_NUMBER != "")
                    {
                        CommunicationDetails.PANCARD_NUMBER = CommunicationDetailsEntities.PANCARD_NUMBER;
                    }
                    if (CommunicationDetailsEntities.AADHAR_NUMBER != "" && CommunicationDetailsEntities.AADHAR_NUMBER != "")
                    {
                        CommunicationDetails.AADHAR_NUMBER = CommunicationDetailsEntities.AADHAR_NUMBER;
                    }
                    if (CommunicationDetailsEntities.PERSONAL_EMAIL != "" && CommunicationDetailsEntities.PERSONAL_EMAIL != "")
                    {
                        CommunicationDetails.PERSONAL_EMAIL = CommunicationDetailsEntities.PERSONAL_EMAIL;
                    }
                    if (CommunicationDetailsEntities.OFFICIAL_EMAIL != "" && CommunicationDetailsEntities.OFFICIAL_EMAIL != "")
                    {
                        CommunicationDetails.OFFICIAL_EMAIL = CommunicationDetailsEntities.OFFICIAL_EMAIL;
                    }
                    if (CommunicationDetailsEntities.OFFICIAL_MOBILE_NUMBER != null && CommunicationDetailsEntities.OFFICIAL_MOBILE_NUMBER != "")
                    {
                        CommunicationDetails.OFFICIAL_MOBILE_NUMBER = CommunicationDetailsEntities.OFFICIAL_MOBILE_NUMBER;
                    }

                    _UOW.EMP_COMMUNICATION_DETAILSRepository.Update(CommunicationDetails);
                    _UOW.Save();
                }
                else
                {
                    var VALdate = (DateTime?)null;
                    //DateTime joiningdate = Convert.ToDateTime(BasicinfoEntities.JOININGDATE);
                    if (CommunicationDetailsEntities.VALIDITY != null)
                    {
                        VALdate = DateTime.ParseExact(CommunicationDetailsEntities.VALIDITY, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                    }
                    var CommunicationDetail = new TBL_EMP_COMMUNICATION_DETAILS
                    {
                        EMPLOYEE_ID              = CommunicationDetailsEntities.EMPLOYEE_ID,
                        PERMANENT_ADDRESS        = CommunicationDetailsEntities.PERMANENT_ADDRESS,
                        PERMANENT_ADDRESS_CITY   = CommunicationDetailsEntities.PERMANENT_ADDRESS_CITY,
                        PERMANENT_ADDRESS_STATE  = CommunicationDetailsEntities.PERMANENT_ADDRESS_STATE,
                        PERMANENT_ADDRESS_PIN    = CommunicationDetailsEntities.PERMANENT_ADDRESS_PIN,
                        MAILING_ADDRESS          = CommunicationDetailsEntities.MAILING_ADDRESS,
                        MAILING_ADDRESS_CITY     = CommunicationDetailsEntities.MAILING_ADDRESS_CITY,
                        MAILING_ADDRESS_PIN      = CommunicationDetailsEntities.MAILING_ADDRESS_PIN,
                        MAILING_ADDRESS_STATE    = CommunicationDetailsEntities.MAILING_ADDRESS_STATE,
                        MOBILE_NUMBER            = CommunicationDetailsEntities.MOBILE_NUMBER,
                        PHONE_NUMBER             = CommunicationDetailsEntities.PHONE_NUMBER,
                        EMERGENCY_CONTACT_NUMBER = CommunicationDetailsEntities.EMERGENCY_CONTACT_NUMBER,
                        RELATIONSHIP             = CommunicationDetailsEntities.RELATIONSHIP,
                        PASSPORT_NUMBER          = CommunicationDetailsEntities.PASSPORT_NUMBER,
                        PASSPORT_VALIDITY        = VALdate,
                        DRIVING_LICENCE_NUMBER   = CommunicationDetailsEntities.DRIVING_LICENCE_NUMBER,
                        PANCARD_NUMBER           = CommunicationDetailsEntities.PANCARD_NUMBER,
                        AADHAR_NUMBER            = CommunicationDetailsEntities.AADHAR_NUMBER,
                        PERSONAL_EMAIL           = CommunicationDetailsEntities.PERSONAL_EMAIL,
                        OFFICIAL_EMAIL           = CommunicationDetailsEntities.OFFICIAL_EMAIL,
                        OFFICIAL_MOBILE_NUMBER   = CommunicationDetailsEntities.OFFICIAL_MOBILE_NUMBER
                    };
                    _UOW.EMP_COMMUNICATION_DETAILSRepository.Insert(CommunicationDetail);
                    _UOW.Save();
                }
            }
            return(Convert.ToInt32(CommunicationDetailsEntities.ID));
        }