Ejemplo n.º 1
0
 /// <summary>
 /// Kopiuje informacje o rozmiarze i stanie okna
 /// </summary>
 /// <param name="baseView"></param>
 public void CopyWindowState(BaseView baseView)
 {
     if (baseView.WindowState == FormWindowState.Maximized)
     {
         this.WindowState = baseView.WindowState;
     }
     else
     {
         this.Width = baseView.Width;
         this.Height = baseView.Height;
         this.Location = baseView.Location;
     }
 }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
0
 public void ShowWarehouseView()
 {
     if (activeView != warehouse)
     {
         activeView.Hide();
         warehouse.CopyWindowState(activeView);
         activeView = warehouse;
         // lista funkcji
         if (statuses == null)
         {
             try
             {
                 statuses = queriesWarehouse.GetAllStatuses();
                 warehouse.FillStatusList(statuses);
             }
             catch (SqlException ex)
             {
                 // TODO: co teraz?
             }
         }
         warehouse.Show();
         SelectAllAtActiveWindow();
         UpdateDBStatus();
     }
 }
Ejemplo n.º 4
0
 public void ShowSpacecraftsView()
 {
     if (activeView != spacecrafts)
     {
         activeView.Hide();
         spacecrafts.CopyWindowState(activeView);
         activeView = spacecrafts;
         if (types == null)
         {
             try
             {
                 types = queriesSpacecrafts.GetAllTypes();
                 spacecrafts.FillTypeList(types);
             }
             catch (SqlException ex)
             {
             }
         }
         spacecrafts.Show();
         SelectAllAtActiveWindow();
         UpdateDBStatus();
     }
 }
Ejemplo n.º 5
0
 public void ShowReservationsView(int clientId)
 {
     if (activeView != reservations)
     {
         activeView.Hide();
         reservations.CopyWindowState(activeView);
         activeView = reservations;
         reservations.Show();
         activeView.DataTable = queriesReservation.SelectById(clientId);
         UpdateDBStatus();
     }
 }
Ejemplo n.º 6
0
 public void ShowReservationsView()
 {
     if (activeView != reservations)
     {
         activeView.Hide();
         reservations.CopyWindowState(activeView);
         activeView = reservations;
         reservations.Show();
         SelectAllAtActiveWindow();
         UpdateDBStatus();
     }
 }
Ejemplo n.º 7
0
 public void ShowOrdersView()
 {
     if (activeView != orders)
     {
         activeView.Hide();
         orders.CopyWindowState(activeView);
         activeView = orders;
         orders.Show();
         SelectAllAtActiveWindow();
         UpdateDBStatus();
     }
 }
Ejemplo n.º 8
0
        public void ShowEmployeesView()
        {
            if (activeView != employees)
            {
                activeView.Hide();
                employees.CopyWindowState(activeView);
                activeView = employees;
                // lista funkcji
                if (functions == null)
                {
                    try
                    {
                        functions = queriesEmployee.GetAllFunctions();
                        employees.FillFunctionsList(functions);
                    }
                    catch (SqlException ex)
                    {
                        // TODO: co teraz?
                    }
                }
                employees.Show();
                SelectAllAtActiveWindow();
                UpdateDBStatus();

            }
        }
Ejemplo n.º 9
0
 public void ShowClientsView()
 {
     if (activeView != clients)
     {
         activeView.Hide();
         clients.CopyWindowState(activeView);
         activeView = clients;
         clients.Show();
         SelectAllAtActiveWindow();
         UpdateDBStatus();
     }
 }