Example #1
0
        internal EmployeesBLL MapEmployee(Employees Employee)
        {
            try
            {
                EmployeesBLL EmployeeBLL = null;
                if (Employee != null)
                {
                    EmployeeBLL = new EmployeesBLL()
                    {
                        EmployeeID                = Employee.EmployeeID,
                        EmployeeIDNo              = Employee.EmployeeIDNo,
                        FirstNameAr               = Employee.FirstNameAr,
                        MiddleNameAr              = Employee.MiddleNameAr,
                        GrandFatherNameAr         = Employee.GrandFatherNameAr,
                        FifthNameAr               = Employee.FifthNameAr,
                        LastNameAr                = Employee.LastNameAr,
                        FirstNameEn               = Employee.FirstNameEn,
                        MiddleNameEn              = Employee.MiddleNameEn,
                        GrandFatherNameEn         = Employee.GrandFatherNameEn,
                        FifthNameEn               = Employee.FifthNameEn,
                        LastNameEn                = Employee.LastNameEn,
                        EmployeeBirthDate         = Employee.EmployeeBirthDate,
                        EmployeeBirthPlace        = Employee.EmployeeBirthPlace,
                        EmployeeEMail             = Employee.EmployeeEMail,
                        EmployeeIDIssueDate       = Employee.EmployeeIDIssueDate,
                        EmployeeMobileNo          = Employee.EmployeeMobileNo,
                        EmployeePassportNo        = Employee.EmployeePassportNo,
                        EmployeePassportSource    = Employee.EmployeePassportSource,
                        EmployeePassportIssueDate = Employee.EmployeePassportIssueDate,
                        EmployeePassportEndDate   = Employee.EmployeePassportEndDate,
                        EmployeeIDExpiryDate      = Employee.EmployeeIDExpiryDate,
                        EmployeeIDCopyNo          = Employee.EmployeeIDCopyNo,
                        EmployeeIDIssuePlace      = Employee.EmployeeIDIssuePlace,
                        DependentCount            = Employee.DependentCount,
                        MaritalStatus             = new MaritalStatusBLL().MapMaritalStatus(Employee.MaritalStatus),
                        Gender      = new GendersBLL().MapGenders(Employee.Genders),
                        Nationality = new CountriesBLL().MapCountry(Employee.Nationalities)

                                      //EmployeePicture = new EmployeesBLL() { EmployeeID = Employee.EmployeeID }.GetEmployeePicture(),
                    };
                }
                return(EmployeeBLL);
            }
            catch
            {
                throw;
            }
        }
Example #2
0
        public virtual EmployeesBLL GetByEmployeeID(int EmployeeID)
        {
            try
            {
                EmployeesBLL EmployeeBLL = null;
                Employees    Employee    = new EmployeesDAL().GetByEmployeeID(EmployeeID);
                if (Employee != null)
                {
                    EmployeeBLL = this.MapEmployee(Employee);
                }

                return(EmployeeBLL);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
 public EmployeesBLL GetByEmployeeNameAr(string EmployeeNameAr)
 {
     try
     {
         Employees Employee = new EmployeesDAL().GetByEmployeeNameAr(EmployeeNameAr);
         if (Employee != null)
         {
             EmployeesBLL EmployeeBLL = MapEmployee(Employee);
             EmployeeBLL.EmployeePicture = EmployeeBLL.GetEmployeePicture();
             return(EmployeeBLL);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #4
0
 public virtual EmployeesBLL GetByEmployeeIDWithEmpPic(int EmployeeID)
 {
     try
     {
         Employees Employee = new EmployeesDAL().GetByEmployeeID(EmployeeID);
         if (Employee != null)
         {
             EmployeesBLL EmployeeBLL = MapEmployee(Employee);
             EmployeeBLL.EmployeePicture = EmployeeBLL.GetEmployeePicture();
             return(EmployeeBLL);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #5
0
        public virtual int AddHiringNewEmployee(EmployeesBLL EmployeesBLL, EmployeesCodesBLL EmployeesCodesBLL, EmployeesCareersHistoryBLL EmployeesCareersHistoryBLL, EmployeesQualificationsBLL EmployeesQualificationsBLL, ContractorsBasicSalariesBLL ContractorsBasicSalariesBLL, List <EmployeesAllowancesBLL> EmployeesAllowancesBLLLst)
        {
            try
            {
                EmployeesDAL employeeDal = new EmployeesDAL();
                Employees    employee    = new Employees()
                {
                    EmployeeIDNo              = this.EmployeeIDNo,
                    FirstNameAr               = this.FirstNameAr,
                    MiddleNameAr              = this.MiddleNameAr,
                    GrandFatherNameAr         = this.GrandFatherNameAr,
                    FifthNameAr               = this.FifthNameAr,
                    LastNameAr                = this.LastNameAr,
                    FirstNameEn               = this.FirstNameEn,
                    MiddleNameEn              = this.MiddleNameEn,
                    GrandFatherNameEn         = this.GrandFatherNameEn,
                    FifthNameEn               = this.FifthNameEn,
                    LastNameEn                = this.LastNameEn,
                    EmployeeBirthDate         = (DateTime)this.EmployeeBirthDate.Value.Date,
                    EmployeeBirthPlace        = this.EmployeeBirthPlace,
                    EmployeeMobileNo          = this.EmployeeMobileNo,
                    EmployeePassportNo        = this.EmployeePassportNo,
                    EmployeeEMail             = this.EmployeeEMail,
                    EmployeeIDIssueDate       = this.EmployeeIDIssueDate != null ? (DateTime)this.EmployeeIDIssueDate.Value.Date : (DateTime?)null,
                    EmployeePassportSource    = this.EmployeePassportSource,
                    EmployeePassportIssueDate = this.EmployeePassportIssueDate != null ? (DateTime)this.EmployeePassportIssueDate.Value.Date : (DateTime?)null,
                    EmployeePassportEndDate   = this.EmployeePassportEndDate != null ? (DateTime)this.EmployeePassportEndDate.Value.Date : (DateTime?)null,
                    EmployeeIDExpiryDate      = this.EmployeeIDExpiryDate,
                    EmployeeIDCopyNo          = this.EmployeeIDCopyNo,
                    EmployeeIDIssuePlace      = this.EmployeeIDIssuePlace,
                    DependentCount            = this.DependentCount,
                    MaritalStatusID           = this.MaritalStatus.MaritalStatusID,
                    GenderID      = this.Gender.GenderID,
                    NationalityID = this.Nationality.CountryID,
                    CreatedDate   = DateTime.Now,
                    CreatedBy     = this.LoginIdentity.EmployeeCodeID,
                };
                EmployeesCodes employeesCode = new EmployeesCodes()
                {
                    EmployeeCodeNo = EmployeesCodesBLL.EmployeeCodeNo,
                    EmployeeTypeID = EmployeesCodesBLL.EmployeeType.EmployeeTypeID,
                    IsActive       = true,
                    CreatedDate    = DateTime.Now,
                    CreatedBy      = this.LoginIdentity.EmployeeCodeID
                };

                EmployeesCareersHistory employeeCareerHistory = new EmployeesCareersHistory()
                {
                    CareerHistoryTypeID  = EmployeesCareersHistoryBLL.CareerHistoryType.CareerHistoryTypeID,
                    CareerDegreeID       = EmployeesCareersHistoryBLL.CareerDegree.CareerDegreeID,
                    OrganizationJobID    = EmployeesCareersHistoryBLL.OrganizationJob.OrganizationJobID,
                    JoinDate             = EmployeesCareersHistoryBLL.JoinDate.Date,
                    TransactionStartDate = EmployeesCareersHistoryBLL.JoinDate.Date,
                    IsActive             = true,
                    CreatedBy            = this.LoginIdentity.EmployeeCodeID,
                    CreatedDate          = DateTime.Now
                };
                EmployeesQualifications employeeQualification = new EmployeesQualifications();
                employeeQualification.QualificationDegreeID   = EmployeesQualificationsBLL.QualificationDegree.QualificationDegreeID;
                employeeQualification.QualificationID         = EmployeesQualificationsBLL.Qualification.QualificationID;
                employeeQualification.GeneralSpecializationID = EmployeesQualificationsBLL.GeneralSpecialization.GeneralSpecializationID;
                employeeQualification.ExactSpecializationID   = EmployeesQualificationsBLL.ExactSpecialization.ExactSpecializationID == 0 ? (int?)null : EmployeesQualificationsBLL.ExactSpecialization.ExactSpecializationID;
                employeeQualification.UniSchName          = EmployeesQualificationsBLL.UniSchName;
                employeeQualification.Department          = EmployeesQualificationsBLL.Department;
                employeeQualification.FullGPA             = EmployeesQualificationsBLL.FullGPA;
                employeeQualification.GPA                 = EmployeesQualificationsBLL.GPA;
                employeeQualification.StudyPlace          = EmployeesQualificationsBLL.StudyPlace;
                employeeQualification.GraduationDate      = EmployeesQualificationsBLL.GraduationDate;
                employeeQualification.GraduationYear      = EmployeesQualificationsBLL.GraduationYear;
                employeeQualification.Percentage          = EmployeesQualificationsBLL.Percentage;
                employeeQualification.QualificationTypeID = EmployeesQualificationsBLL.QualificationType.QualificationTypeID == 0 ? (int?)null : EmployeesQualificationsBLL.QualificationType.QualificationTypeID;
                employeeQualification.CreatedDate         = DateTime.Now;
                employeeQualification.CreatedBy           = this.LoginIdentity.EmployeeCodeID;

                ContractorsBasicSalaries contractorBasicSalary = new ContractorsBasicSalaries();
                contractorBasicSalary.BasicSalary        = ContractorsBasicSalariesBLL.BasicSalary;
                contractorBasicSalary.TransfareAllowance = ContractorsBasicSalariesBLL.TransfareAllowance;
                contractorBasicSalary.CreatedDate        = DateTime.Now;
                contractorBasicSalary.CreatedBy          = this.LoginIdentity.EmployeeCodeID;

                List <EmployeesAllowances> employeesAllowancesList = new List <EmployeesAllowances>();
                foreach (var EmployeeAllowanceBLL in EmployeesAllowancesBLLLst)
                {
                    employeesAllowancesList.Add(new EmployeesAllowances()
                    {
                        AllowanceID        = EmployeeAllowanceBLL.Allowance.AllowanceID,
                        AllowanceStartDate = EmployeeAllowanceBLL.AllowanceStartDate,
                        IsActive           = EmployeeAllowanceBLL.IsActive,
                        CreatedBy          = this.LoginIdentity.EmployeeCodeID,
                        CreatedDate        = DateTime.Now
                    });
                }


                employee.EmployeesCodes = new List <EmployeesCodes>();
                employee.EmployeesCodes.Add(employeesCode);
                employeesCode.EmployeesCareersHistory = new List <EmployeesCareersHistory>();
                employeesCode.EmployeesCareersHistory.Add(employeeCareerHistory);
                employeesCode.EmployeesQualifications = new List <EmployeesQualifications>();
                employeesCode.EmployeesQualifications.Add(employeeQualification);
                #region check if the new employee is contractor then add financial advantages to him
                OrganizationsJobsBLL OrganizationsJobsBLL = new OrganizationsJobsBLL().GetByOrganizationJobID(employeeCareerHistory.OrganizationJobID);
                if (OrganizationsJobsBLL.Rank.RankCategory.RankCategoryID == (int)RanksCategoriesEnum.ContractualExpats || OrganizationsJobsBLL.Rank.RankCategory.RankCategoryID == (int)RanksCategoriesEnum.ContractualSaudis)
                {
                    employeesCode.ContractorsBasicSalaries = new List <ContractorsBasicSalaries>();
                    employeesCode.ContractorsBasicSalaries.Add(contractorBasicSalary);
                    employeeCareerHistory.EmployeesAllowances = employeesAllowancesList;
                }
                #endregion
                employeeDal.Insert(employee);
                return(this.EmployeeID);
            }
            catch
            {
                throw;
            }
        }