Exemplo n.º 1
0
        private static void RunProgram(DbDataSource dataSource)
        {
            while (true)
            {
                var authModule = new AuthModule(dataSource);

                var authResult = authModule.SignIn();

                switch (authResult.Role)
                {
                case RoleType.Client:
                {
                    var clientModule = new ClientModule(authResult.CurrentUserId, dataSource);
                    clientModule.WorkAsClient();

                    break;
                }

                case RoleType.Admin:
                {
                    var adminModule = new AdminModule(authResult.CurrentUserId, dataSource);
                    adminModule.WorkAsAdmin();

                    break;
                }

                default:
                {
                    throw new InvalidDataException();
                }
                }
            }
        }