示例#1
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            XmlConfigurator.Configure(new System.IO.FileInfo(args[0]));
            Console.WriteLine("Configuration Settings for database {0}", GetConnectionStringByName("database"));
            IDictionary <String, string> props = new SortedList <String, String>();

            props.Add("ConnectionString", GetConnectionStringByName("database"));

            IClientRepo       clientRepository  = new ClientRepository(props);
            IZborRepo         zborRepository    = new ZborRepository(props);
            AngajatRepository angajatRepository = new AngajatRepository(props);
            IBiletRepo        biletRepository   = new BiletRepository(props);


            Service service = new Service(angajatRepository, zborRepository, clientRepository, biletRepository);

            LogInForm      logInForm      = new LogInForm();
            MainWindowForm mainWindowForm = new MainWindowForm();

            logInForm.SetService(service);
            logInForm.setMain(mainWindowForm);
            mainWindowForm.SetService(service);
            mainWindowForm.SetLogIn(logInForm);

            Application.Run(logInForm);
        }
示例#2
0
        static void Main(string[] args)
        {
            XmlConfigurator.Configure(new System.IO.FileInfo(args[0]));
            Console.WriteLine("Configuration Settings for database {0}", GetConnectionStringByName("database"));
            IDictionary <String, string> props = new SortedList <String, String>();

            props.Add("ConnectionString", GetConnectionStringByName("database"));

            BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();

            serverProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
            BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider();
            IDictionary dictionary = new Hashtable();

            dictionary["port"] = 55555;
            TcpChannel channel = new TcpChannel(dictionary, clientProvider, serverProvider);

            ChannelServices.RegisterChannel(channel, false);

            AngajatRepository angajatRepo = new AngajatRepository(props);
            IZborRepo         zborRepo    = new ZborRepository(props);
            IClientRepo       clientRepo  = new ClientRepository(props);
            IBiletRepo        biletRepo   = new BiletRepository(props);

            var server = new FlightServerImpl(angajatRepo, zborRepo, clientRepo, biletRepo);

            RemotingServices.Marshal(server, "zboruri");

            Console.WriteLine("Server started ...");
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            //XmlConfigurator.Configure(new System.IO.FileInfo(args[0]));
            //Console.WriteLine("Configuration Settings for agentie {0}", GetConnectionStringByName("agentie"));
            IDictionary <String, string> props = new SortedList <String, String>();

            props.Add("ConnectionString", GetConnectionStringByName("agentie"));


            IAngajatRepository <string, string> repoA = new AngajatRepository(props);
            AngajatService srvA = new AngajatService(repoA);

            IClientRepository repoC = new ClientRepository(props);
            ClientService     srvC  = new ClientService(repoC);

            IZborRepository repoZ = new ZborRepository(props);
            ZborService     srvZ  = new ZborService(repoZ);

            IBiletRepository repoB = new BiletRepository(props);
            BiletService     srvB  = new BiletService(repoB, repoC, repoZ);



            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Form2 form2 = new Form2();

            form2.setService(srvA, srvC, srvZ, srvB);
            Application.Run(form2);
        }