示例#1
0
 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 });
 }
示例#2
0
        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);
            }
        }
示例#3
0
        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);
            }
        }
示例#4
0
 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);
 }