示例#1
0
        internal static NewHire EmployeeLookup(string workerId, string hireType, SNAPContext db)
        {
            try
            {
                NewHire employee = new NewHire();

                dynamic workdayEmployee = PowerShell.RunScript("Get-WorkdayEmployee", new { WorkerID = workerId });

                employee.WorkerID = workerId;
                employee.HireType = hireType;

                if (employee.HireType == "Employee Conversion")
                {
                    employee.IsConversion = true;
                }

                switch (workdayEmployee.Worker_Type as string)
                {
                case "Contractor":
                    employee.IsContingent = true;
                    employee.WorkerType   = workdayEmployee.Worker_Type;
                    break;

                case "Regular":
                    employee.WorkerType     = "Employee-Regular";
                    employee.O365License    = "E3, EMS";
                    employee.OracleRequired = true;
                    break;

                default:
                    employee.WorkerType     = workdayEmployee.Worker_Type;
                    employee.O365License    = "E3, EMS";
                    employee.OracleRequired = true;
                    break;
                }

                employee.FirstName     = workdayEmployee.First_Name;
                employee.LastName      = workdayEmployee.Last_Name;
                employee.EmailAddress  = workdayEmployee.Email;
                employee.StartDate     = Convert.ToDateTime(workdayEmployee.Hire_Date);
                employee.Title         = workdayEmployee.Title;
                employee.Department    = workdayEmployee.Department;
                employee.ManagersEmail = workdayEmployee.Manager_Email;
                employee.Office        = workdayEmployee.Office_Location;
                employee.Country       = workdayEmployee.Country;

                if (db.Countries.Any(x => x.Name == employee.Country) == false)
                {
                    employee.Country = "United States of America";
                }

                employee.SetServiceDate();

                return(employee);
            }
            catch (Exception)
            {
                return(null);
            }
        }
示例#2
0
        internal static NewHire Contingent()
        {
            try
            {
                NewHire contingent = new NewHire();

                contingent.WorkerType   = "Contingent Worker-StaffAug";
                contingent.HireType     = "New Contractor";
                contingent.IsContingent = true;
                contingent.StartDate    = DateTime.Now;
                contingent.Department   = "Contingents";
                contingent.Country      = "United States of America";

                contingent.SetServiceDate();

                return(contingent);
            }
            catch (Exception)
            {
                return(null);
            }
        }