public KeyPayApiV2Client(string baseUrl, AuthenticationDetails authenticationDetails) { var api = new ApiRequestExecutor(baseUrl) { Authenticator = authenticationDetails.Authenticator }; Business = new BusinessFunction(api); PayCategory = new PayCategoryFunction(api); PaySchedule = new PayScheduleFunction(api); Employee = new EmployeeFunction(api); Location = new LocationFunction(api); PayRun = new PayRunFunction(api); LeaveCategory = new LeaveCategoryFunction(api); Report = new ReportFunction(api); Timesheet = new TimesheetFunction(api); User = new UserFunction(api); PayRateTemplates = new PayRateTemplateFunction(api); DeductionCategory = new DeductionCategoryFunction(api); ExpenseCategory = new ExpenseCategoryFunction(api); WorkType = new WorkTypeFunction(api); Document = new DocumentFunction(api); EmployeeGroup = new EmployeeGroupFunction(api); EmployingEntity = new EmployingEntityFunction(api); PaymentSummary = new PaymentSummaryFunction(api); RosterShift = new RosterShiftFunction(api); Manager = new ManagerFunction(api); Kiosk = new KioskFunction(api); TimeAndAttendance = new TimeAndAttendanceFunction(api); Unavailability = new UnavailabilityFunction(api); }
public static void RunEmployeeQueries(Employee employee, string operation) { EmployeeFunction employeeCrudFunctions = null; //new EmployeeFunction(ReadEmployee); switch (operation) { case "create": employeeCrudFunctions = CreateEmployee; break; case "read": employeeCrudFunctions = ReadEmployee; break; case "update": employeeCrudFunctions = UpdateEmployee; break; case "delete": employeeCrudFunctions = RemoveEmployee; break; } employeeCrudFunctions(employee); }
public void GetEmployees_TraverseThroughEmployeesData_CheckIfAllDataAreUniqueBasedOnId() { EmployeeFunction employeeFunction = new EmployeeFunction(); IEnumerable <Employee> employees = employeeFunction.GetEmployees(); Assert.That(employees.Select(item => item.id), Is.Unique); }
public void GetEmployees_TraverseThroughTheEmployeeObject_CheckIfAnyPersonsIdIs100() { EmployeeFunction employeeFunction = new EmployeeFunction(); var people = employeeFunction.GetEmployees(); Assert.That(people.Any(p => p.id == 100)); }
public void CheckIfGetEmployeesAndGetEmployeesWhoHasJoinedThePreviousYearHasDifferentData() { EmployeeFunction employeeFunction = new EmployeeFunction(); IEnumerable <Employee> employees = employeeFunction.GetEmployees(); IEnumerable <Employee> employees1 = employeeFunction.GetEmployeesWhoHasJoinedPreviousYear(); Assert.That(employees, !Is.EqualTo(employees1)); }
public SgApiClient(string baseUrl, AuthenticationDetails authenticationDetails, string userAgent = null) : base(baseUrl, authenticationDetails, userAgent) { Other = new OtherFunction(Api); Brand = new BrandFunction(Api); Invoices = new InvoicesFunction(Api); Business = new BusinessFunction(Api); ChartOfAccounts = new ChartOfAccountsFunction(Api); DeductionCategories = new DeductionCategoriesFunction(Api); Employee = new EmployeeFunction(Api); EmployeeAccess = new EmployeeAccessFunction(Api); EmployeeRecurringTransactions = new EmployeeRecurringTransactionsFunction(Api); EmployeeBankAccount = new EmployeeBankAccountFunction(Api); EmployeeBenefitsInKind = new EmployeeBenefitsInKindFunction(Api); EmployeeDocument = new EmployeeDocumentFunction(Api); EmployeeEarningsLineSplit = new EmployeeEarningsLineSplitFunction(Api); EmployeeExpenseRequest = new EmployeeExpenseRequestFunction(Api); EmployeeGainsOrProfitsEmployeeSharePlan = new EmployeeGainsOrProfitsEmployeeSharePlanFunction(Api); EmployeeIncomeFromOverseasSubjectToTaxRemission = new EmployeeIncomeFromOverseasSubjectToTaxRemissionFunction(Api); EmployeeIncomeTaxBorneByEmployer = new EmployeeIncomeTaxBorneByEmployerFunction(Api); EmployeeLeaveAllowances = new EmployeeLeaveAllowancesFunction(Api); LeaveAllowance = new LeaveAllowanceFunction(Api); LeaveRequests = new LeaveRequestsFunction(Api); Location = new LocationFunction(Api); EmployeePayRateSchedule = new EmployeePayRateScheduleFunction(Api); PayRun = new PayRunFunction(Api); EmployeeQualifications = new EmployeeQualificationsFunction(Api); Authentication = new AuthenticationFunction(Api); EmploymentAgreement = new EmploymentAgreementFunction(Api); EmployeeExpenseCategories = new EmployeeExpenseCategoriesFunction(Api); EmployeeGroups = new EmployeeGroupsFunction(Api); EmployeeOnboarding = new EmployeeOnboardingFunction(Api); EmployerLiabilityCategories = new EmployerLiabilityCategoriesFunction(Api); EmployingEntities = new EmployingEntitiesFunction(Api); TimeAndAttendance = new TimeAndAttendanceFunction(Api); LeaveCategories = new LeaveCategoriesFunction(Api); LookupData = new LookupDataFunction(Api); Manager = new ManagerFunction(Api); PayCategory = new PayCategoryFunction(Api); PayRateTemplate = new PayRateTemplateFunction(Api); PaySchedule = new PayScheduleFunction(Api); PublicHoliday = new PublicHolidayFunction(Api); Qualifications = new QualificationsFunction(Api); Reporting = new ReportingFunction(Api); RosterShift = new RosterShiftFunction(Api); TieredLeaveAllowance = new TieredLeaveAllowanceFunction(Api); Timesheets = new TimesheetsFunction(Api); Unavailability = new UnavailabilityFunction(Api); Webhook = new WebhookFunction(Api); WorkType = new WorkTypeFunction(Api); Ess = new EssFunction(Api); Reseller = new ResellerFunction(Api); User = new UserFunction(Api); WhiteLabel = new WhiteLabelFunction(Api); }
public AuApiClient(string baseUrl, AuthenticationDetails authenticationDetails, string userAgent = null) : base(baseUrl, authenticationDetails, userAgent) { Brand = new BrandFunction(Api); Invoices = new InvoicesFunction(Api); Business = new BusinessFunction(Api); AbaSettings = new AbaSettingsFunction(Api); ChartOfAccounts = new ChartOfAccountsFunction(Api); DeductionCategories = new DeductionCategoriesFunction(Api); Employee = new EmployeeFunction(Api); EmployeeAccess = new EmployeeAccessFunction(Api); EmployeeRecurringTransactions = new EmployeeRecurringTransactionsFunction(Api); EmployeeBankAccount = new EmployeeBankAccountFunction(Api); EmployeeDocument = new EmployeeDocumentFunction(Api); EmployeeEarningsLineSplit = new EmployeeEarningsLineSplitFunction(Api); EmployeeExpenseRequest = new EmployeeExpenseRequestFunction(Api); EmployeeLeaveAllowances = new EmployeeLeaveAllowancesFunction(Api); LeaveAllowance = new LeaveAllowanceFunction(Api); LeaveRequests = new LeaveRequestsFunction(Api); Location = new LocationFunction(Api); EmployeePayRateSchedule = new EmployeePayRateScheduleFunction(Api); PayRun = new PayRunFunction(Api); EmployeeQualifications = new EmployeeQualificationsFunction(Api); EmployeeSelfManagedSuperFund = new EmployeeSelfManagedSuperFundFunction(Api); Authentication = new AuthenticationFunction(Api); EmployeeSuperFund = new EmployeeSuperFundFunction(Api); EmploymentAgreement = new EmploymentAgreementFunction(Api); EmployeeExpenseCategories = new EmployeeExpenseCategoriesFunction(Api); EmployeeGroups = new EmployeeGroupsFunction(Api); EmployeeOnboarding = new EmployeeOnboardingFunction(Api); EmployerLiabilityCategories = new EmployerLiabilityCategoriesFunction(Api); EmployingEntities = new EmployingEntitiesFunction(Api); TimeAndAttendance = new TimeAndAttendanceFunction(Api); LeaveCategories = new LeaveCategoriesFunction(Api); LookupData = new LookupDataFunction(Api); Manager = new ManagerFunction(Api); PayCategory = new PayCategoryFunction(Api); PaymentSummary = new PaymentSummaryFunction(Api); PayRateTemplate = new PayRateTemplateFunction(Api); Other = new OtherFunction(Api); PaySchedule = new PayScheduleFunction(Api); PublicHoliday = new PublicHolidayFunction(Api); Qualifications = new QualificationsFunction(Api); Reporting = new ReportingFunction(Api); RosterShift = new RosterShiftFunction(Api); SuperFund = new SuperFundFunction(Api); Timesheets = new TimesheetsFunction(Api); Unavailability = new UnavailabilityFunction(Api); Webhook = new WebhookFunction(Api); WorkType = new WorkTypeFunction(Api); Ess = new EssFunction(Api); Reseller = new ResellerFunction(Api); User = new UserFunction(Api); WhiteLabel = new WhiteLabelFunction(Api); }
public IActionResult Post([FromBody] EmployeeFunction item) { if (item == null) { return(BadRequest()); } item.Id = _context.EmployeeFunctions.Count() + 1; _context.EmployeeFunctions.Add(item); _context.SaveChanges(); return(CreatedAtRoute("GetEmployeeFunction", new { id = item.Id }, item)); }
public List <EmployeeFunction> SetEmployeeFunctions(ApplicationDbContext context) { employees = context.EmployeeModel.ToList(); functions = context.Function.ToList(); foreach (EmployeeModel employee in employees) { int t = 1; int range = functions.Count() - 1; for (int i = 0; i < t; i++) { int id = RandomID(range) + 1; EmployeeFunction ef = new EmployeeFunction { FunctionID = id, EmployeeID = employee.ID }; employeeFunctions.Add(ef); } counts.Clear(); } return(employeeFunctions); }
private static List <EmployeeFunction> SetEmployeeFunctions() { int c = 1; foreach (EmployeeModel employee in employees) { int t = 1; int range = functions.Count() - 1; for (int i = 0; i < t; i++) { int id = RandomID(range) + 1; EmployeeFunction ef = new EmployeeFunction { EmployeeFunctionID = c, FunctionID = id, EmployeeID = employee.ID }; employeeFunctions.Add(ef); c++; } counts.Clear(); } return(employeeFunctions); }
public IActionResult Update(long id, [FromBody] EmployeeFunction item) { if (item == null || item.Id != id) { return(BadRequest()); } var employeeFunction = _context.EmployeeFunctions.FirstOrDefault(t => t.Id == id); if (employeeFunction == null) { return(NotFound()); } employeeFunction.CounteragentType = item.CounteragentType; employeeFunction.Name = item.Name; employeeFunction.Description = item.Description; _context.EmployeeFunctions.Update(employeeFunction); _context.SaveChanges(); return(new NoContentResult()); }
/// <summary> /// Update employee functions /// </summary> /// <param name="selectedFunctions">Selected functions</param> /// <param name="employeeToUpdate">Employee to update</param> private void UpdateEmployeeFunctions(string[] selectedFunctions, EmployeeModel employeeToUpdate) { // of none selected set functions to functions to empty list if (selectedFunctions == null) { employeeToUpdate.EmployeeFunctions = new List<EmployeeFunction>(); return; } var selectedFunctionsHS = new HashSet<string>(selectedFunctions); // create hash set of selected functions // check if user has exisitng functions if (employeeToUpdate.EmployeeFunctions != null) { // create hash set to store functions in var employeeFunctions = new HashSet<int> (employeeToUpdate.EmployeeFunctions.Select(c => c.Function.FunctionID)); // go trough each functions foreach (var function in _context.Function) { // if user has selected this function add if (selectedFunctionsHS.Contains(function.FunctionID.ToString())) { if (!employeeFunctions.Contains(function.FunctionID)) { employeeToUpdate.EmployeeFunctions.Add(new EmployeeFunction { EmployeeID = employeeToUpdate.ID, FunctionID = function.FunctionID, Employee = employeeToUpdate, Function = function }); } } else { // if user has selected add if (employeeFunctions.Contains(function.FunctionID)) { EmployeeFunction functionToRemove = employeeToUpdate.EmployeeFunctions.FirstOrDefault(i => i.FunctionID == function.FunctionID); _context.Remove(functionToRemove); } } } } else { // create new list of functions employeeToUpdate.EmployeeFunctions = new List<EmployeeFunction>(); // go trough each functions foreach (var function in _context.Function) { // if user has selected, add function to user if (selectedFunctionsHS.Contains(function.FunctionID.ToString())) { employeeToUpdate.EmployeeFunctions.Add(new EmployeeFunction { EmployeeID = employeeToUpdate.ID, Employee = employeeToUpdate, FunctionID = function.FunctionID, Function = function }); } } } }
public async Task<IActionResult> Create([Bind("ID,Name,LastName,DoB,Gender,EMail,PhoneNumber,Admin,LoginID,Experience,ProfileImage,SupervisorID")] EmployeeModel employeeModel, string[] selectedSkills, string[] selectedFunctions, string[] selectedLocations, EmployeeViewModel model) { // check if user is loggen in and user is an admin. if (signInManager.IsSignedIn(User) && _context.EmployeeModel.Single(x => x.EMail == User.Identity.Name).Admin) { //employeeModel = setSupervisor(employeeModel); if (selectedSkills != null) { // create list of skills employeeModel.EmployeeSkills = new List<EmployeeSkill>(); // assign selected skills foreach (var skill in selectedSkills) { // create employee skill and add to list var skillToAdd = new EmployeeSkill { EmployeeModelID = employeeModel.ID, Employee = employeeModel, SkillID = int.Parse(skill), Skill = _context.Skill.Single(s => s.SkillID == int.Parse(skill)) }; //add to list employeeModel.EmployeeSkills.Add(skillToAdd); } } // only if no list if selected functions is given if (selectedFunctions != null) { // get list of functions employeeModel.EmployeeFunctions = new List<EmployeeFunction>(); // populate selected functions foreach (var function in selectedFunctions) { var functionToAdd = new EmployeeFunction { EmployeeID = employeeModel.ID, Employee = employeeModel, FunctionID = int.Parse(function), Function = _context.Function.Single(s => s.FunctionID == int.Parse(function)) }; employeeModel.EmployeeFunctions.Add(functionToAdd); // add to list } } // only if no list if selected locations is given if (selectedLocations != null) { // get locations of employee employeeModel.EmployeeLocations = new List<EmployeeLocations>(); // populate selected locations foreach (var location in selectedLocations) { var locationToAdd = new EmployeeLocations { EmployeeModelID = employeeModel.ID, Employee = employeeModel, LocationID = int.Parse(location), Location = _context.Locations.Single(s => s.LocationID == int.Parse(location)) }; employeeModel.EmployeeLocations.Add(locationToAdd); // add to list } } string uniqueFileName = null; // will store generated filename // If the Photo property on the incoming model object is not null, then the user // has selected an image to upload. if (model.ProfileImage != null) { // The image must be uploaded to the images folder in wwwroot // To get the path of the wwwroot folder we are using the inject // HostingEnvironment service provided by ASP.NET Core string uploadsFolder = Path.Combine(_env.WebRootPath, "images"); // To make sure the file name is unique we are appending a new // GUID value and and an underscore to the file name uniqueFileName = Guid.NewGuid().ToString() + "_" + model.ProfileImage.FileName; string filePath = Path.Combine(uploadsFolder, uniqueFileName); // Use CopyTo() method provided by IFormFile interface to // copy the file to wwwroot/images folder model.ProfileImage.CopyTo(new FileStream(filePath, FileMode.Create)); } employeeModel.ProfileImage = uniqueFileName; // set profile image to uploaded filename if (ModelState.IsValid) { _context.Add(employeeModel); await _context.SaveChangesAsync(); //redirect admin to register page return Redirect("/Identity/Account/Register?email=" + employeeModel.EMail); //return RedirectToAction(nameof(Index)); } // call populate functions PopulateSupervisorsDropDownList(employeeModel.SupervisorID); PopulateAssignedFunctions(employeeModel); PopulateAssignedSkills(employeeModel); PopulateAssignedLocations(employeeModel); return View(employeeModel); } else { return Forbid(); // user is either not logged nor an admin, show forbidden page. } }
public void GetEmployees_AccessThePredefinedEmployeeObject_CheckIfAnyNullValueIsAvailable() { EmployeeFunction employeeFunction = new EmployeeFunction(); Assert.That(employeeFunction.GetEmployees(), !Is.Null); }