Exemplo n.º 1
0
        public void Login()
        {
            WypozyczalniaDataClassesDataContext dbContext = new WypozyczalniaDataClassesDataContext("Data Source=(LocalDB)\\v11.0;AttachDbFilename=C:\\Users\\Paweł\\Documents\\GitHub\\Wypozyczalnia\\Wypozyczalnia\\myDB.mdf;Integrated Security=True;Connect Timeout=30");
            //"Data Source=HANIA-LAPTOP\\SQLEXPRESS;Initial Catalog=Test2;User ID=sa;Password=Admin1");
            // DatabaseSettings.CreateConnectionString(form.UserName, form.Password));
            DatabaseSettings.Save(form.UserName);

            BaseView initForm = new ClientsView();
            Controller controller = new Controller(dbContext, initForm);
            initForm.Show();
            form.Hide();
        }
Exemplo n.º 2
0
        public void Login()
        {
            WypozyczalniaDataClassesDataContext dbContext = new WypozyczalniaDataClassesDataContext(
                //"Data Source=HANIA-LAPTOP\\SQLEXPRESS;Initial Catalog=Test2;User ID=sa;Password=Admin1");
                DatabaseSettings.CreateConnectionString(form.UserName, form.Password));
            DatabaseSettings.Save(form.UserName);

            BaseView initForm = new ClientsView();
            Controller controller = new Controller(dbContext, initForm);
            initForm.Show();
            form.Hide();
        }
Exemplo n.º 3
0
        public Controller(WypozyczalniaDataClassesDataContext dbContext, BaseView initForm)
        {
            activeView = initForm;
            this.dbContext = dbContext;
            // TODO: sprawdzenie typu przekazanego parametru
            clients = (ClientsView)initForm;

            // zainicjalizowanie pozostalych okienek
            employees = new EmployeesView();
            warehouse = new WarehouseView();
            reservations = new ReservationsView();
            orders = new OrdersView();
            spacecrafts = new SpacecraftsView();
            clients.SetController(this);
            employees.SetController(this);
            warehouse.SetController(this);
            orders.SetController(this);
            reservations.SetController(this);
            spacecrafts.SetController(this);
            IsClosing = false;

            // inicjalizacja obiektow dbContext
            queriesClient = new QueriesClient(dbContext);
            queriesEmployee = new QueriesEmployee(dbContext);
            queriesWarehouse = new QueriesWarehouse(dbContext);
            queriesOrder = new QueriesOrder(dbContext);
            queriesReservation = new QueriesReservation(dbContext);
            queriesSpacecrafts = new QueriesSpacecrafts(dbContext);

            //drukarka
            printer = new PrintController();

            // inicjalizacja DialogResult
            dr = DialogResult.None;

            // inicjalizacja danych w domyslnym okienku
            SelectAllAtActiveWindow();
            UpdateDBStatus();
        }