public ActionResult ChangeDate(WeekViewModel contextWeekModel) { Session["contextDate"] = contextWeekModel.MyDate; return(RedirectToAction("TimeSheet", new { contextId = EmployeeFunctions.returnWeekofYear(contextWeekModel.MyDate), contextDate = contextWeekModel.MyDate })); }
public ActionResult CurrentWeek() { Session["contextDate"] = DateTime.Now; return(RedirectToAction("TimeSheet", new { contextId = EmployeeFunctions.returnWeekofYear(DateTime.Now), contextDate = DateTime.Now })); }
public void ListSurnamesOfEmployeesEarningOver9900() { var result = EmployeeFunctions.ListSurnamesOfEmployeesEarningOver9900(employees); var expectedResult = new List <string> { "Licari", "Andrew", "Noyes", "MacLucais", "Worham", "Grimsdith", "Blundan", "Gorstidge", "McAvinchey", "O'Deoran" }; result.Should().BeEquivalentTo(expectedResult); }
private void EmployeeHours_Click(object sender, RoutedEventArgs e) { EmployeePage.Visibility = Visibility.Hidden; var emp = Dbs.GetStores().FirstOrDefault(x => x.StoreNumber == StoreNum).Employees .FirstOrDefault(y => y.EmployeeId == CurrentEmployee.EmployeeId); var empFunc = new EmployeeFunctions(emp, Dbs); var disp = empFunc.ShowEmployeeHours(); EmployeeHoursData.ItemsSource = disp; EmployeeHourTotal.Content = $"Total: {emp.TotalHours}"; EmployeeHoursPage.Visibility = Visibility.Visible; }
public ActionResult CreateTimesheet(WeekViewModel contextWeekModel) { //Add UserId to current Week object contextWeekModel.theWeek.UserId = ((UserProfile)Session["User"]).UserId; //contextWeek.WeekId = contextWeek.weekNum; EmployeeFunctions.addWeek(contextWeekModel.theWeek); return(RedirectToAction("TimeSheet", new { contextId = contextWeekModel.theWeek.WeekId, //context session because no other way to preserve date input //from week view when submitting a form via partial contextDate = Session["contextDate"] })); }
// Employee Page private void EmployeeClock_Click(object sender, RoutedEventArgs e) { EmployeePage.Visibility = Visibility.Hidden; var emp = Dbs.GetStores().FirstOrDefault(x => x.StoreNumber == StoreNum).Employees .FirstOrDefault(y => y.EmployeeId == CurrentEmployee.EmployeeId); if (emp is null) { return; } var empFunc = new EmployeeFunctions(emp, Dbs); var result = empFunc.ClockCheck(); ClockPage.Visibility = Visibility.Visible; ClockStatus.Text = result; }
public void FindEmployeesYoungerThan18AndEarningLessThan1100() { var result = EmployeeFunctions.FindEmployeesYoungerThan18AndEarningLessThan1100(employees); var expectedResult = new List <Employee> { new Employee { Age = 10, Id = 188, Name = "Bondy", Surname = "McGloughlin", Wage = 1054 } }; result.Should().BeEquivalentTo(expectedResult); }
public void Find_NameAndSurname_OfTheOldestEmployeeWhoEarnsBetween6500And7000() { var result = EmployeeFunctions.Find_NameAndSurname_OfTheOldestEmployeeWhoEarnsBetween6500And7000(employees); result.Should().BeEquivalentTo("Marya Oolahan"); }
public void CountEmployeesOlderThan50() { var result = EmployeeFunctions.CountEmployeesOlderThan50(employees); result.Should().Be(483); }
public void FindTheThirdBestWageEmployeeNameWithSurnameLonger5() { var result = EmployeeFunctions.FindTheThirdBestWageEmployeeNameWithSurnameLonger5(employees); result.Should().Be("Susie"); }
public void AverageWageWithoutTop100andBottom100Wages() { var result = EmployeeFunctions.AverageWageWithoutTop100andBottom100Wages(employees); result.Should().Be(5405.55); }
public void FindTheAgeDifferenceBetweenTheEldestAndYoungestEmployee() { var result = EmployeeFunctions.FindTheAgeDifferenceBetweenTheEldestAndYoungestEmployee(employees); result.Should().Be(99); }
public void FindTheNumberOfEmployeesWhosSalaryIsDivisibleByTheirId() { var result = EmployeeFunctions.FindTheNumberOfEmployeesWhosSalaryIsDivisibleByTheirId(employees); result.Should().Be(7); }
static void Main(string[] args) { try { string currUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name; int AuditUserID = 0; string pathToFile = args.Count() == 0 ? "" : args[0]; DataLayer.EPSEntities db = new DataLayer.EPSEntities(); EmployeeFunctions funct = new EmployeeFunctions(); Utilities util = new Utilities(); String domain = util.GetParam("ADDomain", "Active Directory domain"); String adminName = util.GetParam("ADUsername", "Active Directory admin user"); String password = util.GetParam("ADPassword", "Active Directory admin user password"); int slashIndex = currUser.IndexOf("\\") + 1; currUser = currUser.Substring(slashIndex, (currUser.Length - slashIndex)); User admin = db.Users.Where(e => e.Username == currUser).FirstOrDefault(); if (admin == null) { Console.WriteLine("ERROR: You are not a user in the EPS system."); Console.ReadKey(); Environment.Exit(0); } AuditUserID = admin.UserID; if (String.IsNullOrEmpty(pathToFile)) { Console.WriteLine("ERROR: No file was entered."); Console.ReadKey(); Environment.Exit(0); } if (!System.IO.File.Exists(pathToFile)) { Console.WriteLine("ERROR: The file " + pathToFile + " does not exist."); Console.ReadKey(); Environment.Exit(0); } String[] users = System.IO.File.ReadAllLines(pathToFile); if (users.Count() == 0) { Console.WriteLine("ERROR: No users were found in the file " + pathToFile + "."); Console.ReadKey(); Environment.Exit(0); } foreach (String u in users) { DataLayer.Employee emp = db.Employees.Where(e => e.Username == u).FirstOrDefault(); if (emp == null) { PrincipalContext context = new PrincipalContext(ContextType.Domain, domain, adminName, password); UserPrincipal user = UserPrincipal.FindByIdentity(context, u); if (user == null) { Console.WriteLine("ERROR: " + u + " could not be found in Active Directory."); Console.ReadKey(); Environment.Exit(0); } DirectoryEntry DE = (DirectoryEntry)user.GetUnderlyingObject(); String isManager = funct.IsAManager(DE.Path, adminName, password, domain).ToString(); String vbManagerID = null; String vbEmpNum = ""; if (DE.Properties["employeeNumber"].Count > 0) { vbEmpNum = DE.Properties["employeeNumber"][0].ToString(); } if (DE.Properties["manager"].Count > 0) { String vbManagerPath = DE.Properties["manager"][0].ToString(); Guid vbManagerGUID = funct.GetUserByPath(vbManagerPath).Guid; funct.AddMissingManagers(vbManagerPath, AuditUserID); Employee manager = db.Employees.Where(e => e.ADGUID == vbManagerGUID).FirstOrDefault(); vbManagerID = manager.EmpID.ToString(); } funct.AddEmployee(user.Guid.ToString(), user.EmailAddress == null ? "" : user.EmailAddress, user.GivenName == null ? "" : user.GivenName, user.Surname == null ? "" : user.Surname, u, isManager, vbManagerID, vbEmpNum, AuditUserID); Console.WriteLine(u + " added."); } else { Console.WriteLine(u + " already exists in EPS."); } } Console.WriteLine(""); Console.WriteLine("Users imported successfully."); Console.ReadKey(); Environment.Exit(0); } catch (Exception ex) { Console.WriteLine("ERROR: " + ex.Message); Console.ReadKey(); Environment.Exit(0); } }
public void EmployeesUnderAgeOf18Exist_ReturnsTrue_IfThereAreEmployeesUnderAgeOf18() { var result = EmployeeFunctions.EmployeesUnderAgeOf18Exist(employees); result.Should().BeTrue(); }
public void EmployeeWithoutSurnameExists_ReturnsFalse_IfAllEmployeesHaveSurname() { var result = EmployeeFunctions.EmployeeWithoutSurnameExists(employees); result.Should().BeFalse(); }
public void FindTheNumberOfEmployeesWhosNameIsLongerThenSurname() { var result = EmployeeFunctions.FindTheNumberOfEmployeesWhosNameIsLongerThenSurname(employees); result.Should().Be(276); }
public void FindTheMostPopularNameStartingWithTheOldestLetterOfTheAlphabet() { var result = EmployeeFunctions.FindTheMostPopularNameStartingWithTheOldestLetterOfTheAlphabet(employees); result.Should().Be("Virge"); }
public void FindTheYoungestEmployeeNameWithTheHighestWage() { var result = EmployeeFunctions.FindTheYoungestEmployeeNameWithTheHighestWage(employees); result.Should().Be("Brittaney"); }