Esempio n. 1
0
        void Run()
        {
            // Pfad zur Datenbank
            string path             = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\VideoDatabase.accdb";
            string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";";

            // Objekterstellung passend zu den gewählten Factories
            IFactoryIData factoryData = new CFactoryCDataAccess();

            _data = factoryData.Create(connectionString);

            IFactoryILogic factoryLogic = new CFactoryCLogic();

            _logic = factoryLogic.Create(_data);
            AFactoryLogicSearch.Create(_logic, _data.Search);
            AFactoryLogicBorrow.Create(_logic, _data.Loan);

            IFactoryIDialog factoryDialog = new CFactoryCDialog();

            _dialogMain = factoryDialog.Create(_logic);
            AFactoryDialogSearch.SearchCreate(_logic.Search, _dialogMain);
            AFactoryDialogSearch.SearchResultCreate(_dialogMain);
            AFactoryDialogLoan.LoanInsertCreate(_logic, _dialogMain);
            AFactoryDialogLoan.LoanUpdateCreate(_logic, _dialogMain);
            AFactoryDialogLoan.LoanDeleteCreate(_logic, _dialogMain);
            _data.Init();


            // CDialogMain starten
            if (_dialogMain is Form)
            {
                Application.Run(_dialogMain as Form);
            }
        }
Esempio n. 2
0
        internal void Run()
        {
            //Connection String zum MSSQL 2016 Server (Standartinstanz, Standart-Auth)
            //Prüfen ob Alle werte in der Config vorhanden sind. Wenn nein: Fallback auf Test-Server
            //Server bei Johannes: Server=plasma.selfhost.bz;Database=PartsData;User Id=sa;Password=AngewandteInformatik1337!;
            string connectionString;

            if (ConfigurationManager.AppSettings["connection"] != null)
            {
                //connectionString =
                // "Server=" + ConfigurationManager.AppSettings["Server"] + ";" +
                // "Database=" + ConfigurationManager.AppSettings["Database"] + ";" +
                // "User Id=" + ConfigurationManager.AppSettings["User"] + ";" +
                // "Password="******"Password"] + ";";
                connectionString = ConfigurationManager.AppSettings["connection"];
            }
            else
            {
                connectionString = "Server=plasma.selfhost.bz;Database=PartsData;User Id=sa;Password=AngewandteInformatik1337!;";
            }

            //Erstellung - PartsData
            IFactoryIData factoryData = new CFactoryCDataAccess();

            _data = factoryData.Create(connectionString);

            //Erstellung - PartsLogic
            IFactoryILogic factoryLogic = new CFactoryCLogic();

            _logic = factoryLogic.Create(_data);
            AFactoryLogicAdd.Create(_logic, _data.Add);
            AFactoryLogicModify.Create(_logic, _data.Modify);
            AFactoryLogicSearch.Create(_logic, _data.Search);

            //Erstelllung - PartsDialog
            IFactoryIDialog factoryDialog = new CFactoryCDialog();

            _dialog = factoryDialog.Create(_logic);
            AFactoryDialogAdd.CreateAdd(_logic.Add, _dialog);
            AFactoryDialogModify.CreateModify(_logic.Modify, _dialog);
            AFactoryDialogSearch.CreateSearch(_logic.Search, _dialog);
            AFactoryDialogSearch.CreateSearchResult(_dialog);

            //Initialisieren der Datenbankverbindung
            _data.Init();

            //Initialisierung fertig - Starten des Hauptdialogs
            Application.Run(_dialog as Form);
        }