예제 #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var username = ConfigurationManager.OpenExeConfiguration(Assembly.GetExecutingAssembly().Location).AppSettings.Settings["username"].Value;
            var password = ConfigurationManager.OpenExeConfiguration(Assembly.GetExecutingAssembly().Location).AppSettings.Settings["password"].Value;

            var context = new BildStudionDVContext(username, password);

            var deljobbDb = new DelJobb(context);
            var jobbDb    = new Jobb(context, deljobbDb);
            var kundDb    = new Kund(context, jobbDb);
            //kundjobbslogic
            var deljobbVm = new DelJobbVMLogic(deljobbDb);
            var jobbVM    = new JobbVMLogic(jobbDb, deljobbVm);
            var kundVM    = new KundVMLogic(kundDb, jobbVM);

            var inventarieDb = new Inventarie(context);
            var gruppDb      = new Grupp(context, inventarieDb);
            var enhetDb      = new Enhet(context, gruppDb);
            //inventarielogic
            var inventarieVM = new InventarieVMLogic(inventarieDb);
            var gruppVM      = new GruppVMLogic(gruppDb, inventarieVM);
            var enhetVM      = new EnhetVMLogic(enhetDb, gruppVM);

            //userlogic
            var usersDb       = new UserProfiles(context);
            var userProfileVM = new UserProfileVMLogic(usersDb);

            var närvaroDb   = new Närvaro(context);
            var deltagareDb = new Deltagare(context, närvaroDb);

            //närvarologic
            var deltagarVM = new DeltagareVMLogic(deltagareDb);
            var närvaroVM  = new NärvaroVMLogic(närvaroDb, deltagareDb);

            DeltagarViewLogic deltagarViewLogic = new DeltagarViewLogic(deltagarVM, närvaroVM);
            MatlistaLogic     matListaLogic     = new MatlistaLogic(context, närvaroVM, deltagarVM);

            services.Add(new ServiceDescriptor(typeof(IDelJobbVMLogic), deljobbVm));
            services.Add(new ServiceDescriptor(typeof(IJobbVMLogic), jobbVM));
            services.Add(new ServiceDescriptor(typeof(IKundVMLogic), kundVM));
            services.Add(new ServiceDescriptor(typeof(IInventarieVMLogic), inventarieVM));
            services.Add(new ServiceDescriptor(typeof(IGruppVMLogic), gruppVM));
            services.Add(new ServiceDescriptor(typeof(IEnhetVMLogic), enhetVM));
            services.Add(new ServiceDescriptor(typeof(IUserProfileVMLogic), userProfileVM));
            services.Add(new ServiceDescriptor(typeof(IDeltagareVMLogic), deltagarVM));
            services.Add(new ServiceDescriptor(typeof(INärvaroVMLogic), närvaroVM));
            services.Add(new ServiceDescriptor(typeof(IDeltagarViewLogic), deltagarViewLogic));
            services.Add(new ServiceDescriptor(typeof(IMatlistaLogic), matListaLogic));

            services.AddAuthentication("CookieAuthentication")
            .AddCookie("CookieAuthentication", config =>
            {
                config.Cookie.Name = "UserLoginCookie";
                config.LoginPath   = "/Login/UserLogin";
            });

            services.AddControllersWithViews();
        }
예제 #2
0
        public void Setup()
        {
            var appSettingValFromStatic = ConfigurationManager.AppSettings["mySetting"];
            var username = ConfigurationManager.OpenExeConfiguration(Assembly.GetExecutingAssembly().Location).AppSettings.Settings["username"].Value;
            var password = ConfigurationManager.OpenExeConfiguration(Assembly.GetExecutingAssembly().Location).AppSettings.Settings["password"].Value;

            context        = new BI.Context.BildStudionDVContext(username, password);
            delJobbDb      = new DelJobb(context);
            jobbDb         = new Jobb(context, delJobbDb);
            kundDb         = new Kund(context, jobbDb);
            delJobbVMLogic = new DelJobbVMLogic(delJobbDb);
            jobbVmLogic    = new JobbVMLogic(jobbDb, delJobbVMLogic);
            kundVmLogic    = new KundVMLogic(kundDb, jobbVmLogic);
        }
예제 #3
0
        void Gen(int groupsCount, int jobbsCount)
        {
            var      rnd         = new Random();
            var      JobbsGroups = new List <JobbsGroup>();
            DateTime startTime   = DateTime.Now.AddMinutes(-22);
            DateTime endTime     = DateTime.MinValue;

            for (int i = 0; i < groupsCount; i++)
            {
                DateTime    lastTime = startTime;
                List <Jobb> jobbs    = new List <Jobb>();
                for (int j = 0; j < jobbsCount; j++)
                {
                    var jobb_c = new Jobb()
                    {
                        Name = "Jobb N " + i + ":" + j
                    };
                    jobb_c.StartTime = lastTime;
                    jobb_c.EndTime   = jobb_c.StartTime + new TimeSpan(0, rnd.Next(40, 100), 0);
                    jobbs.Add(jobb_c);
                    lastTime = jobb_c.EndTime + new TimeSpan(0, rnd.Next(20, 50), 0);

                    endTime = endTime < lastTime ? lastTime : endTime;
                }
                JobbsGroups.Add(new JobbsGroup()
                {
                    Jobbs = jobbs, Name = "JobbGroup " + i
                });
            }
            StartTime = startTime;
            EndTime   = endTime;
            OnPropertyChanged("StartTime");
            OnPropertyChanged("EndTime");

            SCH.Init(startTime, endTime, JobbsGroups);
        }
예제 #4
0
 public JobbVMLogic(Jobb _jobbDb, DelJobbVMLogic _deljobbVMLogic)
 {
     jobbDb         = _jobbDb;
     delJobbVMLogic = _deljobbVMLogic;
 }