public static List <Enrollment> GetEnrollmentForACourse(string cnum = null, string userName = null)
        {
            if (userName != null)
            {
                long studentId = RepositoryAuth.VerifyUser(userName);

                if (studentId == 0)
                {
                    throw new Exception("Error!!");
                }
                else
                {
                    if (cnum == null)
                    {
                        return(RepositoryRegistrar.GetEnrollmentForACourse(null, studentId));
                    }
                    else
                    {
                        return(RepositoryRegistrar.GetEnrollmentForACourse(cnum, studentId));
                    }
                }
            }
            else
            {
                return(RepositoryRegistrar.GetEnrollmentForACourse(cnum, 0));
            }
        }
        public static bool SignUpCourse(string username, string cnum, string semester)
        {
            bool res       = false;
            long studentId = RepositoryAuth.VerifyUser(username);

            try
            {
                if (studentId != 0)
                {
                    List <Enrollment> cs = RepositoryRegistrar.GetEnrollmentForACourse(cnum, studentId);
                    if (cs.Count == 0)
                    {
                        if (RepositoryRegistrar.CheckPrerequisiteCourseTaken(studentId, cnum))
                        {
                            res = RepositoryRegistrar.SignUpCourse(studentId, cnum, semester);
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(res);
        }
示例#3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc(
                options =>
            {
                options.Filters.Add(typeof(ErrorHandleMiddleware));
            });

            ServicesRegistrar.Configure(services, Configuration);
            RepositoryRegistrar.Configure(services, Configuration);
        }
示例#4
0
        public AppBootstrapper()
        {
            Locator.CurrentMutable.InitializeSplat();
            Locator.CurrentMutable.InitializeReactiveUI();

            _mainView = new MainView(RxApp.TaskpoolScheduler, RxApp.MainThreadScheduler, ViewLocator.Current);
            var viewStackService = new ViewStackService(_mainView);

            Locator.CurrentMutable.RegisterConstant(viewStackService, typeof(IViewStackService));
            Locator.CurrentMutable.Register(() => new SignInPage(), typeof(IViewFor <ISignInViewModel>));
            Locator.CurrentMutable.Register(() => new PhoneAuthPhoneNumberEntryPage(), typeof(IViewFor <IPhoneAuthPhoneNumberEntryViewModel>));
            Locator.CurrentMutable.Register(() => new PhoneAuthVerificationCodeEntryPage(), typeof(IViewFor <IPhoneAuthVerificationCodeEntryViewModel>));
            Locator.CurrentMutable.Register(() => new MainPage(), typeof(IViewFor <IMainViewModel>));
            Locator.CurrentMutable.Register(() => new CatalogCategoryListPage(), typeof(IViewFor <ICatalogCategoryListViewModel>));
            Locator.CurrentMutable.Register(() => new CatalogCategoryCell(), typeof(IViewFor <ICatalogCategoryCellViewModel>));
            Locator.CurrentMutable.Register(() => new CatalogCategoryPage(), typeof(IViewFor <ICatalogCategoryViewModel>));
            Locator.CurrentMutable.Register(() => new CatalogItemCell(), typeof(IViewFor <ICatalogItemCellViewModel>));
            Locator.CurrentMutable.Register(() => new CatalogItemDetailsPage(), typeof(IViewFor <ICatalogItemDetailsViewModel>));
            Locator.CurrentMutable.Register(() => new StoreInfoPage(), typeof(IViewFor <IStoreInfoViewModel>));
            Locator.CurrentMutable.Register(() => new AlbumListPage(), typeof(IViewFor <IAlbumListViewModel>));
            Locator.CurrentMutable.Register(() => new AlbumCell(), typeof(IViewFor <IAlbumCellViewModel>));
            Locator.CurrentMutable.Register(() => new AlbumPage(), typeof(IViewFor <IAlbumViewModel>));
            Locator.CurrentMutable.Register(() => new RewardsPage(), typeof(IViewFor <IRewardsViewModel>));
            Locator.CurrentMutable.Register(() => new RewardsProgramActivationPage(), typeof(IViewFor <IRewardsProgramActivationViewModel>));

            Locator.CurrentMutable.Register(() => new AuthService(), typeof(IAuthService));
            IFirebaseAuthService firebaseAuthService = CrossFirebaseAuth.Current;

            Locator.CurrentMutable.RegisterConstant(firebaseAuthService, typeof(IFirebaseAuthService));
            Locator.CurrentMutable.RegisterLazySingleton(() => new FacebookPhotoService(), typeof(IFacebookPhotoService));

            var repoContainer = new RepositoryRegistrar(firebaseAuthService, Locator.CurrentMutable);

            //Square.Connect.Client.Configuration.Default.AccessToken = ApiKeys.SQUARE_CONNECT;

            //viewStackService.PushPage(new MainViewModel()).Subscribe();

            //return;

            if (firebaseAuthService.CurrentUser != null)
            {
                viewStackService.PushPage(new MainViewModel()).Subscribe();
            }
            else
            {
                viewStackService.PushPage(new SignInViewModel()).Subscribe();
            }
        }
示例#5
0
        public static IServiceCollection AddCQSFramework(this IServiceCollection serviceCollection, params Assembly[] assemblies)
        {
            var serviceRegistrar = new FrameworkServiceRegistrar(serviceCollection);

            CommandBusRegistrar.RegisterHandlers(serviceRegistrar, assemblies);
            QueryBusRegistrar.RegisterBuilders(serviceRegistrar, assemblies);
            EventBusRegistrar.RegisterListeners(serviceRegistrar, assemblies);
            RepositoryRegistrar.RegisterRepositories(serviceRegistrar, assemblies);

            serviceCollection.AddScoped <IServiceLocator, FrameworkServiceLocator>();
            serviceCollection.AddScoped <ICommandBus, CommandBus>();
            serviceCollection.AddScoped <IQueryBus, QueryBus>();
            serviceCollection.AddScoped <IEventBus, EventBus>();
            serviceCollection.AddScoped <AppDispatcher, AppDispatcher>();

            return(serviceCollection);
        }
 public static List <StudentTranscript> GetTranscript(string username)
 {
     return(RepositoryRegistrar.GetTranscript(username));
 }
 public static bool CreateStudent(Students s)
 {
     return(RepositoryRegistrar.CreateStudent(s));
 }
 public static List <SelectListItem> GetCourses()
 {
     return(RepositoryRegistrar.GetCourses());
 }
 public static bool UpdateCourse(Courses c)
 {
     return(RepositoryRegistrar.UpdateCourse(c));
 }
 public static Students GetStudentDetail(long studentId)
 {
     return(RepositoryRegistrar.GetStudentDetail(studentId));
 }
 public static List <Students> GetStudents()
 {
     return(RepositoryRegistrar.GetStudents());
 }
 public static Courses GetCourseDetail(string cnum)
 {
     return(RepositoryRegistrar.GetCourseDetail(cnum));
 }
 public static List <Courses> GetExistingCourses()
 {
     return(RepositoryRegistrar.GetExistingCourses());
 }
 public static bool DeleteStudent(long studentId)
 {
     return(RepositoryRegistrar.DeleteStudent(studentId));
 }
 public static bool DeleteEnrollmentForStudent(long studentId, string courseName)
 {
     return(RepositoryRegistrar.DeleteEnrollmentForStudent(studentId, courseName));
 }
 public static List <SelectListItem> GetSemester()
 {
     return(RepositoryRegistrar.GetSemester());
 }
 public static List <SelectListItem> GetCoursesForSemester(string semester)
 {
     return(RepositoryRegistrar.GetCoursesForSemester(semester));
 }