public MainForm()
        {
            data_set_CalanderReports = new DataSet();
            data_set_salesman_list   = new DataSet();
            data_set_salesman_report = new DataSet();
            mycurrencylist           = new CurrencyList();
            loginform       = new Login();
            viewrates       = new ViewRates();
            calanderreports = new CalanderReports();
            salesmanreports = new SalesManReports();
            simpl           = new ServerImplementation();
            curlist         = new CurrencyList();
            simpl.Start_Server_Manually();

            RefreshSalesManList();

            InitializeComponent();
            this.menuStrip1.Visible = false;
            this.toolStrip1.Visible = false;
            LoadLoginForm();
            Add_All_Action_Listners();


            // for bypass login window in devlopment mode
            loginform.textBoxUsername.Text = "admin"; //--
            loginform.textBoxPass.Text     = "admin"; //--
            LoginForm_Button_Login();                 //--
        }
        public void GetInformations()
        {
            // Get the test source
            var testSource = Profile.FindSource(ConfigurationManager.AppSettings["Station"])[0];

            // Activate
            ServerImplementation.EndRequest(CardServer.BeginSelect(testSource.SelectionKey));

            // Create request helper
            var requestor = new RequestInformation(CardServer);

            // Remember
            var sources = ((GenericInformationResponse)requestor.BeginGetGroupInformation().Result).Strings.Select(s => SourceIdentifier.Parse(s)).ToArray();

            // Request data
            foreach (var group in ((NetworkInformationResponse)requestor.BeginGetNetworkInformation().Result).Groups)
            {
                Console.WriteLine(group);
            }

            // Resolve names
            var names = ((GenericInformationResponse)requestor.BeginGetSourceInformation(sources).Result).Strings;

            // Report
            for (int i = 0, imax = Math.Max(sources.Length, names.Length); i < imax; i++)
            {
                Console.WriteLine("{0} => {1}", sources[i], names[i]);
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Persistence.Repository.RepoAvailableRoomDB repoAR  = new Persistence.Repository.RepoAvailableRoomDB();
            Persistence.Repository.RepoConference      repoC   = new Persistence.Repository.RepoConference();
            Persistence.Repository.RepoMessageDB       repoM   = new Persistence.Repository.RepoMessageDB();
            Persistence.Repository.RepoPaperDB         repoPap = new Persistence.Repository.RepoPaperDB();
            Persistence.Repository.RepoParticipantDB   repoPar = new Persistence.Repository.RepoParticipantDB();
            Persistence.Repository.RepoPayment         repoPay = new Persistence.Repository.RepoPayment();
            Persistence.Repository.RepoUserDB          repoU   = new Persistence.Repository.RepoUserDB();
            Persistence.RepoSessionDB repoS = new Persistence.RepoSessionDB();

            BinaryServerFormatterSinkProvider servProv = new BinaryServerFormatterSinkProvider();

            servProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
            BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider();
            IDictionary props = new Hashtable();

            props["port"] = 11111;
            TcpChannel channel = new TcpChannel(props, clientProv, servProv);

            ChannelServices.RegisterChannel(channel, false);

            var server = new ServerImplementation(repoU, repoAR, repoC, repoM, repoPap, repoPar, repoPay, repoS);

            RemotingServices.Marshal(server, "Conferences");

            Console.WriteLine("Server go");
            Console.ReadLine();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();

            serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
            BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider();
            IDictionary props = new Hashtable();

            props["port"] = 55555;
            TcpChannel channel = new TcpChannel(props, clientProv, serverProv);

            ChannelServices.RegisterChannel(channel, false);

            IDictionary <string, string> pr = new SortedList <string, string>();

            pr.Add("ConnectionString", "URI=file:ConcursInot.db");
            OficiuRepository      oficiu      = new OficiuRepository(pr);
            ParticipantRepository participant = new ParticipantRepository(pr);
            ProbaRepository       proba       = new ProbaRepository(pr);
            InscriereRepository   inscriere   = new InscriereRepository(pr);
            Service service = new Service(oficiu, participant, proba, inscriere);

            var server = new ServerImplementation(service);

            RemotingServices.Marshal(server, "Server");

            //RemotingConfiguration.RegisterWellKnownServiceType(typeof(ServerImplementation), "Server",
            //    WellKnownObjectMode.Singleton);

            Console.WriteLine("Server started ...");
            Console.WriteLine("Press <enter> to exit...");
            Console.ReadLine();
        }
Exemplo n.º 5
0
        public virtual void StartupTests()
        {
            // Create card server
            using (CardServer)
                CardServer = ServerImplementation.CreateOutOfProcess();

            // Attach to profile
            ServerImplementation.EndRequest(CardServer.BeginSetProfile(ProfileName, false));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Aktualisiert die Oberfläche.
        /// </summary>
        private void UpdateGUI()
        {
            // Check mode
            if (null == CurrentServer)
            {
                // Set GUI
                cmdStart.Enabled  = (null != selProfiles.SelectedItem);
                grpConfig.Enabled = true;
                cmdStop.Enabled   = false;
            }
            else if ((null != CurrentRequest) && !CurrentRequest.IsCompleted)
            {
                // Set GUI
                grpConfig.Enabled = false;
                cmdStart.Enabled  = false;
                cmdStop.Enabled   = false;
            }
            else
            {
                // Set GUI
                cmdStop.Enabled   = !pnlState.Visible;
                grpConfig.Enabled = false;
                cmdStart.Enabled  = false;

                // Load request and processor
                Action <object> processor = m_ResultProcessor;
                IAsyncResult    request   = CurrentRequest;

                // Reset
                m_ResultProcessor = null;
                CurrentRequest    = null;

                // Load request
                if (null != request)
                {
                    try
                    {
                        // Load
                        object result = ServerImplementation.EndRequest <object>(request);

                        // Process
                        if (null != processor)
                        {
                            processor(result);
                        }
                    }
                    catch (Exception ex)
                    {
                        // Report
                        MessageBox.Show(this, ex.Message, Text);
                    }
                }
            }
        }
Exemplo n.º 7
0
        public void Start()
        {
            mvarImplementation = mvarTransport.GetServerImplementation();

            if (_t == null) _t = new System.Threading.Thread(t_ThreadStart);
            if (!_t.IsAlive)
            {
                _t.Name = "Indigo Server Thread";
                _t.Start();
            }
        }
 /// <summary>
 /// Erzeugt einen passenden Aufzeichnungsprozess.
 /// </summary>
 /// <returns>Der gewünschte Aufzeichnungsprozess.</returns>
 private ServerImplementation CreateCardServerProxy()
 {
     // Create the server
     if (VCRConfiguration.Current.UseExternalCardServer)
     {
         return(ServerImplementation.CreateOutOfProcess());
     }
     else
     {
         return(ServerImplementation.CreateInMemory());
     }
 }
Exemplo n.º 9
0
        /// <summary>
        /// Aktiviert den Netzwerkversand für eine aktive Quelle.
        /// </summary>
        /// <param name="source">Die betroffene Quelle.</param>
        /// <param name="uniqueIdentifier">Die eindeutige Kennung der Teilaufzeichnung.</param>
        /// <param name="streamingTarget">Das neue Ziel für den Netzwerkversand.</param>
        public void SetStreamTarget(SourceIdentifier source, Guid uniqueIdentifier, string streamingTarget)
        {
            // Validate
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            // Report
            Tools.ExtendedLogging("Changing Streaming for {0} [{1}] to {2}", source, uniqueIdentifier, streamingTarget);

            // Process
            EnqueueActionAndWait(() => ServerImplementation.EndRequest(Server.BeginSetStreamTarget(source, uniqueIdentifier, streamingTarget)));
        }
Exemplo n.º 10
0
        /// <summary>
        /// Beendet den Suchlauf endgültig.
        /// </summary>
        protected override void OnStop()
        {
            // Remember the time of the last scan
            ProfileState.LastSourceUpdateTime = DateTime.UtcNow;

            // Log
            VCRServer.Log(LoggingLevel.Full, Properties.Resources.PSIReplace);

            // Finish
            ServerImplementation.EndRequest(Server.BeginEndScan(m_mergeSources));

            // Report
            Tools.ExtendedLogging("Card Server has updated Profile {0} - VCR.NET will reload all Profiles now", ProfileName);

            // Time to refresh our lists
            VCRProfiles.Reset();
        }
Exemplo n.º 11
0
        /// <summary>
        /// Beendet einen asynchronen Aufruf. Im Fall einer Ausnahme wird diese nur protokolliert
        /// und der Aufruf als abgeschlossen angenommen.
        /// </summary>
        /// <typeparam name="TAsync">Die Art des Aufrufs.</typeparam>
        /// <param name="request">Der aktive Aufruf.</param>
        /// <param name="traceFormat">Meldung bei Abschluss des Aufrufs. Ist dieser Parameter <i>null</i>, so
        /// wartet die Methode auf den Abschluss des asynchronen Aufrufs.</param>
        /// <param name="traceArgs">Parameter zum Aufbau der Meldung.</param>
        /// <returns>Gesetzt, wenn der Aufruf abgeschlossen wurde oder bereits war. Ansonsten
        /// ist der Aufruf weiterhin aktiv.</returns>
        protected bool WaitForEnd <TAsync>(ref TAsync request, string traceFormat = null, params object[] traceArgs) where TAsync : class, IAsyncResult
        {
            // No request at all
            var pending = request;

            if (pending == null)
            {
                return(true);
            }

            // Request still busy - calling this method with only a single parameter will do a synchronous call
            if (traceFormat != null)
            {
                if (!pending.IsCompleted)
                {
                    return(false);
                }
            }

            // Synchronize
            try
            {
                // Fetch result
                ServerImplementation.EndRequest(pending);

                // Report
                if (!string.IsNullOrEmpty(traceFormat))
                {
                    Tools.ExtendedLogging(traceFormat, traceArgs);
                }
            }
            catch (Exception e)
            {
                // Report only!
                VCRServer.Log(LoggingLevel.Errors, "Failed Operation for '{0}': {1}", ProfileName, e.Message);
            }
            finally
            {
                // Forget
                request = null;
            }

            // Stopped it
            return(true);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Erzeugt einen neuen <i>Card Server</i>.
        /// </summary>
        /// <param name="sender">Wird ignoriert.</param>
        /// <param name="e">Wird ignoriert.</param>
        private void cmdStart_Click(object sender, EventArgs e)
        {
            // Attach to the current profile selection
            ProfileItem item = (ProfileItem)selProfiles.SelectedItem;

            if (null == item)
            {
                return;
            }

            // Be safe
            try
            {
                // Create server
                if (ckInProcess.Checked)
                {
                    CurrentServer = ServerImplementation.CreateInMemory();
                }
                else
                {
                    CurrentServer = ServerImplementation.CreateOutOfProcess();
                }

                // Attach the profile
                CurrentRequest = CurrentServer.BeginSetProfile(item.Profile.Name, ckRestart.Checked, false, false);

                // Reset the flag
                ckRestart.Checked = false;
            }
            catch (Exception ex)
            {
                // Report
                MessageBox.Show(this, ex.Message, Text);

                // Reset
                if (null != CurrentServer)
                {
                    cmdStop_Click(cmdStop, EventArgs.Empty);
                }
            }

            // Refresh
            UpdateGUI();
        }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            VoluntarDbRepository     voluntarRepository     = new VoluntarDbRepository();
            DonatorDbRepository      donatorRepository      = new DonatorDbRepository();
            CazCaritabilDbRepository cazCaritabilRepository = new CazCaritabilDbRepository();
            DonatieDbRepository      donatieRepository      = new DonatieDbRepository();
            IValidator <Donator>     valDonator             = new DonatorValidator();
            IValidator <Donatie>     valDonatie             = new DonatieValidator();

            IServices serviceImpl = new ServerImplementation(voluntarRepository, cazCaritabilRepository,
                                                             donatorRepository, donatieRepository, valDonator, valDonatie);


            SerialServer server = new SerialServer("127.0.0.1", 55555, serviceImpl);

            server.Start();
            Console.WriteLine("Server started ...");

            Console.ReadLine();
        }
Exemplo n.º 14
0
        /// <summary>
        /// Aktiviert eine neue Quelle.
        /// </summary>
        /// <typeparam name="TStatus">Die Art der Zustandsinformation.</typeparam>
        /// <param name="source">Die gewünschte Quelle.</param>
        /// <param name="factory">Methode zum Erzeugen einer neuen Zustandsinformation.</param>
        /// <returns>Der neue Zustand der Übertragung.</returns>
        public TStatus SetSource <TStatus>(SourceIdentifier source, Func <string, ServerInformation, TStatus> factory)
        {
            // Update end time
            Stamp();

            // Remap to real source
            var selection = VCRProfiles.FindSource(ProfileName, source);

            if (selection == null)
            {
                throw new ArgumentNullException("source");
            }

            // Report
            Tools.ExtendedLogging("Will now zap to Source {0}", selection.Source);

            // Process and remember
            m_lastState = EnqueueActionAndWait(() => ServerImplementation.EndRequest(Server.BeginSetZappingSource(selection.SelectionKey, m_target)));

            // Report
            return(CreateStatus(factory));
        }
Exemplo n.º 15
0
        /// <summary>
        /// Startet die eigentlich Aufzeichnung in einer abgesicherten Umgebung.
        /// </summary>
        private void Run()
        {
            // Be fully safe
            try
            {
                // Create raw environment
                var coreEnvironment =
                    new Dictionary <string, string>
                {
                    { "%wakeupprofile%", ProfileState.WakeUpRequired ? "1" : "0" },
                    { "%dvbnetprofile%", ProfileName },
                };

                // Be fully safe
                try
                {
                    // Log it
                    VCRServer.Log(LoggingLevel.Schedules, Properties.Resources.RecordingStarted, TypeName);

                    // Report
                    Tools.ExtendedLogging("Started Recording Control Thread for {0}", ProfileName);

                    // Fire all extensions
                    Tools.RunSynchronousExtensions("BeforeProfileAccess", coreEnvironment);

                    // Use it
                    using (Server = CreateCardServerProxy())
                    {
                        // Check mode
                        var mustWakeUp = ProfileState.WakeUpRequired;
                        if (mustWakeUp)
                        {
                            // Log
                            VCRServer.Log(LoggingLevel.Full, Properties.Resources.RestartMessage);

                            // Report
                            Tools.ExtendedLogging("Will restart Hardware for {0} if Restart Device is configured in Profile", ProfileName);
                        }

                        // Start synchronously
                        ServerImplementation.EndRequest(
                            Server.BeginSetProfile
                            (
                                ProfileName,
                                mustWakeUp,
                                VCRConfiguration.Current.DisablePCRFromH264Generation,
                                VCRConfiguration.Current.DisablePCRFromMPEG2Generation
                            ));

                        // Report
                        Tools.ExtendedLogging("Card Server is up and running");

                        // Remember time
                        Representative.PhysicalStart = DateTime.UtcNow;

                        // Create fresh environment and fire extensions - with no files so far
                        FireRecordingStartedExtensions(ExtensionEnvironment = Representative.GetReplacementPatterns());

                        // Time to allow derived class to start up
                        OnStart();

                        // Process idle loop - done every second if not interrupted earlier
                        for (IAsyncResult <ServerInformation> stateRequest = null; ; m_wakeUp.WaitOne(m_running ? 1000 : 100))
                        {
                            // First check for state request
                            if (stateRequest != null)
                            {
                                // No yet done
                                if (!stateRequest.IsCompleted)
                                {
                                    continue;
                                }

                                // Process the state
                                OnNewStateAvailable(m_state = stateRequest.Result);

                                // No longer waiting for the next state
                                stateRequest = null;
                            }

                            // See if we are busy in the derived class
                            if (HasPendingServerRequest)
                            {
                                continue;
                            }

                            // Process actions - no asynchronous operations allowed in current version
                            ProcessActions();

                            // Make sure that scheduler knows we accepted the request
                            ConfirmPendingRequest();

                            // If we are still idle fire a new state request
                            if (!HasPendingServerRequest)
                            {
                                if (m_running)
                                {
                                    stateRequest = Server.BeginGetState();
                                }
                                else
                                {
                                    break;
                                }
                            }
                        }

                        // Time to let derived class shut down properly
                        OnStop();

                        // Run final state update before protocol entry is created
                        if (m_state != null)
                        {
                            OnNewStateAvailable(m_state);
                        }

                        // Update recording data for the very last time
                        var info = CreateFullInformation(true);
                        if (info != null)
                        {
                            Representative = info.Recording;
                        }

                        // Set real send
                        Representative.EndsAt = DateTime.UtcNow;

                        // Set end state
                        ExtensionEnvironment["%Aborted%"] = m_aborted ? "1" : "0";

                        // Process extensions
                        FireRecordingFinishedExtensions(ExtensionEnvironment);

                        // No need for further wakeups
                        ProfileState.WakeUpRequired = false;
                    }
                }
                catch (Exception e)
                {
                    // Report
                    VCRServer.Log(e);

                    // Try to make sure that job is not restarted
                    try
                    {
                        // Update
                        SetRestartThreshold(null);
                    }
                    catch (Exception ex)
                    {
                        // Report
                        VCRServer.Log(ex);
                    }
                }
                finally
                {
                    // Detach from server - is already disposed and shut down
                    Server = null;

                    // Fire all extensions
                    Tools.RunSynchronousExtensions("AfterProfileAccess", coreEnvironment);

                    // Detach from profile
                    ProfileState.EndRequest(this);

                    // Write recording
                    ProfileState.Server.JobManager.CreateLogEntry(Representative);

                    // May go to sleep after job is finished
                    ProfileState.Server.ReportRecordingDone(Representative.DisableHibernation, IsRealRecording);

                    // Check for next job on all profiles
                    ProfileState.Collection.BeginNewPlan();

                    // Report
                    Tools.ExtendedLogging("Recording finished for {0}", ProfileName);

                    // Log it
                    VCRServer.Log(LoggingLevel.Schedules, Properties.Resources.RecordingFinished, TypeName);
                }
            }
            catch (Exception e)
            {
                // Report
                VCRServer.Log(e);
            }
            finally
            {
                // Make sure that even in case of error we do a full notification
                ConfirmPendingRequest(true);

                // Always fire event
                RequestFinished.Set();
            }
        }
Exemplo n.º 16
0
 /// <summary>
 /// Führt eine Anfrage aus.
 /// </summary>
 /// <param name="server">Die aktuelle Implementierung des <i>Card Servers</i>.</param>
 /// <returns>Die Antwort zur Anfrage.</returns>
 public abstract Response Execute( ServerImplementation server );
 /// <summary>
 /// Erstellt eine neue Erweiterung.
 /// </summary>
 /// <param name="cardServer">Die zugehörige Instanz des <i>Card Servers</i> - auf
 /// der Client Seite.</param>
 public RequestInformation(ServerImplementation cardServer)
     : base(cardServer)
 {
 }