Ejemplo n.º 1
0
        public void TestDesignTimeDbContextFactory()
        {
            IDesignTimeDbContextFactory <FSContext> o = new DesignTimeDbContextFactory();
            FSContext context = o.CreateDbContext(null);

            context.Database.EnsureCreated();
        }
Ejemplo n.º 2
0
        public FSItemsController(FSContext context)
        {
            _context = context;

            if (_context.FSItems.Count() == 0)
            {
                _context.FSItems.AddRange(staticdata);
                _context.SaveChanges();
            }
        }
Ejemplo n.º 3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            app.UseStatusCodePages();
            app.UseStaticFiles();
            app.UseMvc(routes => {
                String categorySegment = RoutingTemplateStringBuilder.AsParameter(RoutingConstants.Segment.Category);
                //"Page{page:int}";
                String page        = RoutingConstants.StaticText.Page;
                String pageSegment = page + RoutingTemplateStringBuilder.AsParameter(page + ":int");

                String home  = RoutingConstants.Controller.Home;
                string index = RoutingConstants.Action.Index;

                var homeIndexRoutDefaults = new { controller = home, action = index, page = 1 };

                // Category and Page
                routes.MapRoute(
                    name: null,
                    template: categorySegment + RoutingConstants.Term.Seperator + pageSegment,
                    defaults: new { controller = home, action = index }
                    );

                // Page only
                routes.MapRoute(
                    name: null,
                    template: pageSegment,
                    defaults: homeIndexRoutDefaults
                    );

                // Category only
                routes.MapRoute(
                    name: null,
                    template: categorySegment,
                    defaults: homeIndexRoutDefaults
                    );

                // Home / Index default
                routes.MapRoute(
                    name: null,
                    template: "",
                    defaults: homeIndexRoutDefaults
                    );

                routes.MapRoute(name: null, template: "{controller}/{action}/{id?}");
            });

            FSContext context = app.ApplicationServices.GetRequiredService <FSContext>();

            DbInitializer.Initialize(context);
        }
Ejemplo n.º 4
0
        public HomeViewModel()
        {
            ShowPieChartCommand      = new RelayCommand(ShowPieChart, CanExecute);
            ShowBarChartCommand      = new RelayCommand(ShowBarChart, CanExecute);
            CanExecuteChangedCommand = new RelayCommand(CanExecuteChanged);

            _Context = new FSContext();

            var questions = _Context.Questions.ToList().Select(q => new QuestionVM(q));

            Questions = new ObservableCollection <QuestionVM>(questions);
        }
Ejemplo n.º 5
0
        public void TestInitializer()
        {
            Debug.WriteLine("TestInitializer()");
            var builder = new DbContextOptionsBuilder <FSContext>();

            builder.UseSqlServer("Server=(localdb)\\mssqllocaldb;Database=FSWeb;Trusted_Connection=True;MultipleActiveResultSets=true");
            DbContext = new FSContext(builder.Options);
            DbContext.Database.EnsureDeleted();
            DbContext.Database.EnsureCreated();

            DbInitializer.Initialize(DbContext);
        }
Ejemplo n.º 6
0
 public UOW(FSContext context)
 {
     _context = context;
 }
Ejemplo n.º 7
0
 public SqlEntityRepository(FSContext dbContext)
 {
     DbContext = dbContext;
     Entities  = dbContext.Set <T>();
 }
 public UserRepository(FSContext context)
 {
     _context = context;
 }
 public ProjectSphereRepository(FSContext context) : base(context)
 {
 }
 public ProjectTypeRepositry(FSContext context) : base(context)
 {
 }
Ejemplo n.º 11
0
 public CountryRepository(FSContext context) : base(context)
 {
 }
Ejemplo n.º 12
0
 public ProjectRepository(FSContext fscontext) : base(fscontext)
 {
 }
 public SphereRepositry(FSContext context) : base(context)
 {
 }
Ejemplo n.º 14
0
 public ProjectRepository(FSContext fscontext)
 {
     _fscontext = fscontext;
 }
Ejemplo n.º 15
0
 public DiscussionRepository(FSContext context) : base(context)
 {
 }
Ejemplo n.º 16
0
 public SqlRepository(FSContext context, IMapper mapperParm)
 {
     dbContext = context;
     mapper    = mapperParm;
 }
Ejemplo n.º 17
0
 public SkillsRepository(FSContext context) : base(context)
 {
 }
 public PersonRepository(FSContext context) : base(context)
 {
 }
Ejemplo n.º 19
0
 public FSItemLogic(FSContext context, IReadOnlyRepository <FSItem> repository) : base(context, repository)
 {
 }
Ejemplo n.º 20
0
 public UserRepository(FSContext context) : base(context)
 {
 }
Ejemplo n.º 21
0
        public LiveChartDemoViewModel(QuestionVM SelectedQuestion, string ChartType)
        {
            _Context = new FSContext();

            var answers = _Context.Answers
                          .ToList()
                          .Where(a => a.QuestionId == SelectedQuestion.Id)
                          .Select(a => new AnswerVM(a));

            Answers = new ObservableCollection <AnswerVM>(answers);

            var options    = SelectedQuestion.Options.ToString();
            var optionsArr = options.Split(';');

            Options = new ObservableCollection <AnswerVM>();
            foreach (string s in optionsArr)
            {
                Options.Add(new AnswerVM(new Answer {
                    Content = s
                }));
            }

            if (ChartType == "Pie")
            {
                PieChart = new PieChart();

                foreach (AnswerVM option in Options)
                {
                    //Determine how often this answer was given
                    int count = Answers.Where(a => a.Content == option.Content).Count();

                    if (count != 0)
                    {
                        PieChart.Series.Add(new PieSeries
                        {
                            Values = new ChartValues <int> {
                                count
                            },
                            DataLabels = true,
                            LabelPoint = chartpoint => string.Format("Antw. {0}, {1}x ({2:p})", option.OptionIndex, chartpoint.Y, chartpoint.Participation)
                        });
                    }
                }
            }
            else
            {
                BarChart = new CartesianChart();

                BarChart.AxisY.Add(new Axis
                {
                    Title     = "Aantal keer gegeven",
                    MinValue  = 0,
                    MaxValue  = Options.Count,
                    Separator = new Separator
                    {
                        Step = 1
                    }
                });
                BarChart.AxisX.Add(new Axis
                {
                    Title      = "Opties",
                    ShowLabels = false
                });

                foreach (AnswerVM option in Options)
                {
                    //Determine how often this answer was given
                    int count = Answers.Where(a => a.Content == option.Content).Count();

                    if (count != 0)
                    {
                        BarChart.Series.Add(new ColumnSeries
                        {
                            Values = new ChartValues <int> {
                                count
                            },
                            DataLabels = true,
                            LabelPoint = point => string.Format("{0}: {1}x", option.OptionIndex, point.Y)
                        });
                    }
                }
            }
        }
Ejemplo n.º 22
0
 public BaseRepository(FSContext context)
 {
     Context = context;
 }
Ejemplo n.º 23
0
 public ProjectProductRepository(FSContext context) : base(context)
 {
 }