public void AddRole(string userId, User.Roles role) { throw new NotImplementedException(); var r = Connection.Execute( "INSERT INTO [dbo].[webpages_UsersInRoles] ([UserId],[RoleId]) VALUES (@userId, @role)", new { userId, role }); }
public List <EventRequest> GetEventRequests(User.Roles role) { switch (role) { case User.Roles.SeniorCustomerServiceOfficer: return(Seed.eventRequests.Where(eventRequest => eventRequest.State == EventRequest.States.Created || eventRequest.State == EventRequest.States.Finalized || eventRequest.State == EventRequest.States.Declined).ToList()); case User.Roles.FinancialManager: return(Seed.eventRequests.Where(eventRequest => eventRequest.State == EventRequest.States.ApprovedBySCSO).ToList()); case User.Roles.AdministrationDepartmentManager: return(Seed.eventRequests.Where(eventRequest => eventRequest.State == EventRequest.States.FinancialFeedbackAdded).ToList()); default: return(null); } }
public bool ChangeState(EventRequest eventRequest, User.Roles role, string feedback, bool approve) { switch (role) { case User.Roles.SeniorCustomerServiceOfficer: if (approve) { eventRequest.State = EventRequest.States.ApprovedBySCSO; } else { eventRequest.State = EventRequest.States.Declined; } return(true); case User.Roles.FinancialManager: eventRequest.State = EventRequest.States.FinancialFeedbackAdded; eventRequest.FinancialFeedback = feedback; return(true); case User.Roles.AdministrationDepartmentManager: if (approve) { eventRequest.State = EventRequest.States.Finalized; new EventController().Create(eventRequest); } else { eventRequest.State = EventRequest.States.Declined; } return(true); default: return(false); } }
private static void AssertSelectedUser(User pUserToTest, string pExpectedUserName, User.Roles pExpectedRole, string pExpectedFirstName, string pExpectedLastName, char pExpectedSex) { Assert.AreEqual(pExpectedUserName, pUserToTest.UserName); Assert.IsNull(pUserToTest.Password); Assert.AreEqual(pExpectedRole, pUserToTest.Role); Assert.AreEqual(pExpectedFirstName, pUserToTest.FirstName); Assert.AreEqual(pExpectedLastName, pUserToTest.LastName); Assert.AreEqual(pExpectedSex, pUserToTest.Sex); }