예제 #1
0
        private bool ShowLogin()
        {
            //Startup Login
            LoginWindow         loginWindow         = new LoginWindow();
            DomainManager       domainManager       = new DomainManager();
            UserServiceProvider userServiceProvider = new UserServiceProvider(new InventoryContext(), domainManager);
            LogInService        logInService        = new LogInService(domainManager, userServiceProvider);
            var loginVM = new LoginViewModel(logInService);

            loginVM.LoginCompleted += (sender, args) => {
                if (loginVM.LoginResponce.Success)
                {
                    this.userService = loginVM.LoginResponce.Service;
                    DXSplashScreen.Show <SETSplashScreen>();
                }
                loginWindow.Close();
            };
            loginWindow.DataContext = loginVM;
            if (DXSplashScreen.IsActive)
            {
                DXSplashScreen.Close();
            }

            loginWindow.ShowDialog();
            return(this.userService.IsValid());
        }
예제 #2
0
 public DatabaseProvider(ApplicationDbContext context)
 {
     _context                 = context;
     _userServiceProvider     = new UserServiceProvider(context);
     _chatroomServiceProvider = new ChatroomServiceProvider(context);
     _messageServiceProvider  = new MessageServiceProvider(context);
 }
예제 #3
0
        private static void Main(string[] args)
        {
            IUserService        userService;
            DomainManager       domainManager       = new DomainManager();
            InventoryContext    context             = new InventoryContext();
            UserServiceProvider userServiceProvider = new UserServiceProvider(context, domainManager);
            LogInService        logInService        = new LogInService(domainManager, userServiceProvider);
            var responce = logInService.LogInWithPassword("AElmendo", "Drizzle123!", false, InventorySoftwareType.PRODUCTS_SALES);

            userService = responce.Service;
            ProductDataManager dataManager   = new ProductDataManager(context, userService);
            ImportService      importService = new ImportService(dataManager);

            Console.WriteLine("Starting Service");
            importService.Load();
            Console.WriteLine("Importing Data");
            importService.ImportData();
            importService.Parse();
            Console.WriteLine("Import Finsihed");
            Console.WriteLine("Create Lots");
            var response = importService.Create();

            Console.WriteLine("Should be finished.  See results below:");
            Console.WriteLine(response.Message);
            Console.ReadKey();
        }
예제 #4
0
        public void ShouldCompletePaintTest()
        {
            //arrenge
            IUserDataService   userDataService   = new UserDataServiesProvider();
            IStrokeDataService strokeDataService = new StrokeDataServiesProvider();
            ILineDataService   lineDataService   = new LineDataServiesProvider();


            IPaintDataService paintDataService = new PaintDataServiesProvider();

            IUserServies   userServies   = new UserServiceProvider(userDataService);
            IPaintServies  paintService  = new PaintServiceProvider(paintDataService, userDataService, strokeDataService, lineDataService);
            IStrokeService strokeService = new StrokeServiceProvider(strokeDataService, userDataService, lineDataService);
            ILineService   lineService   = new LineServiceProvider(lineDataService, userDataService);

            //act
            var user   = userServies.CreateUser();
            var paint  = paintService.CreateOrGetPaint(user.Id);
            var stroke = strokeService.CreateStroke(new Stroke
            {
                PaintId    = paint.Id,
                StartPoint = new Point {
                    X = 1, Y = 1
                }
            });
            var line = lineService.CreateLine(new Line
            {
                StrokeId   = stroke.Id,
                StartPoint = new Point {
                    X = 10, Y = 10
                }
            });

            var paintResult = paintService.CreateOrGetPaint(user.Id);

            //assert
            Assert.Single(paintResult.Strokes);
            Assert.Single(paintResult.Strokes.FirstOrDefault().Lines);
        }