示例#1
0
        public static void SetOptValue(ClsCommand rb)
        {
            Core.DB.Options3 o3 = ClsOptionsControler.Options3(rb.Value1);
            o3.Value = rb.Value2;
            ClsOptionsControler.SaveOptions3(o3);
            GlobalServerEvents.SendMessage(null, new ClsStringEventArgs(ClsRequests.DataRequest(new ClsCommand(command: "Options"))));

            if (rb.Value1.Length > 12)
            {
                if (rb.Value1.Substring(0, 13) == "DisplayScreen")
                {
                    ClsGlobalEvents.Fire_DisplayPropChanged(null, null);
                }
            }

            if (rb.Value1 == "StartPageSet")
            {
                // aktuelle Anzeige umschalten
                ClsGlobal.Instance.ActivePage = ClsPages.GetFirstPageName(ClsPageSets.ActivePageSet());

                ClsCommand cmd = new ClsCommand();
                cmd.Type    = "JN";
                cmd.Command = "Reload";

                ClsServer.Instance.SendMessage(new JavaScriptSerializer().Serialize(cmd));

                // Liste der Anzeigeseiten aktualisieren
                GlobalServerEvents.SendMessage(null, new ClsStringEventArgs(ClsRequests.DataRequest(new ClsCommand(command: "PageList"))));
            }
        }
示例#2
0
        public static void SwitchPage(ClsCommand rb)
        {
            int pageID = Convert.ToInt32(rb.Page);

            ClsDisplay.SetPage(ClsPageSets.ActivePageSet(), pageID);

            // answer
            GlobalServerEvents.SendMessage(null, new ClsStringEventArgs(ClsRequests.DataRequest(new ClsCommand(command: "ActivePage"))));

            GlobalServerEvents.SendMessage(null, new ClsStringEventArgs(ClsRequests.DataRequest(new ClsCommand(command: "DivsActivePage", pageSet: rb.PageSet, page: rb.Page))));
        }
        //  Requests werden je Client session hier behandelt und die Daten dierekt nur an den anfragenden Client gesendet

        public static string DataRequest(ClsCommand Request)
        {
            if (Request.Command == "Version")
            {
                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "";
                cmd.Type    = "Txt";
                cmd.Command = "Version";
                cmd.Value1  = System.Windows.Forms.Application.ProductVersion;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "TeamList")
            {
                List <Core.DB.Mannschaften> man = Core.Mannschaften.ClsCommon.Mannschaften();
                var json = new JavaScriptSerializer().Serialize(man);

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "MM";
                cmd.Type    = "JN";
                cmd.Command = "TeamList";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "TeamID")
            {
                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "MM";
                cmd.Type    = "JN";
                cmd.Command = "TeamID";

                if (Request.Team == "A")
                {
                    cmd.Team   = "A";
                    cmd.Value1 = ClsGlobal.Instance.MansschaftAID;
                }

                if (Request.Team == "B")
                {
                    cmd.Team   = "B";
                    cmd.Value1 = ClsGlobal.Instance.MansschaftBID;
                }

                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "PlayerList")
            {
                string json = "";
                if (string.IsNullOrEmpty(Request.Team))
                {
                    if (Request.Value1 == "A")
                    {
                        Request.Team = ClsGlobal.Instance.MansschaftAID;
                    }

                    if (Request.Value1 == "B")
                    {
                        Request.Team = ClsGlobal.Instance.MansschaftBID;
                    }

                    List <Core.DB.Spieler> man = Core.Mannschaften.ClsCommon.SpielerListe(Request.Team);
                    json = new JavaScriptSerializer().Serialize(man);
                }
                else if (Request.Team == "ALL")
                {
                    Request.Value1 = "ALL";
                    List <Core.DB.Spieler> sp = Core.Mannschaften.ClsCommon.SpielerListe();
                    json = new JavaScriptSerializer().Serialize(sp);
                }


                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "MM";
                cmd.Type    = "JN";
                cmd.Command = "PlayerList";
                cmd.Team    = Request.Team;
                cmd.Value1  = Request.Value1;
                cmd.Value2  = json;

                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "SVariablen")
            {
                // Variablenliste senden
                List <ClsTextVariabeln> svl = ClsDBVariablen.Instance.GetAllTextVariablen();
                var json = new JavaScriptSerializer().Serialize(svl);

                ClsCommand cmd = new ClsCommand();
                cmd.Type    = "JN";
                cmd.Command = "ListeTextVariablen";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "BVariablen")
            {
                // Variablenliste senden
                List <ClsBildVariabeln> bvl = ClsDBVariablen.Instance.GetAllBildVariablen();
                var json = new JavaScriptSerializer().Serialize(bvl);

                ClsCommand cmd = new ClsCommand();
                cmd.Type    = "JN";
                cmd.Command = "ListeBildVariablen";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "TVariablen")
            {
                // Variablenliste senden
                List <ClsTabellenVariabeln> bvl = ClsDBVariablen.Instance.GetAllTabellenVariablen();
                var json = new JavaScriptSerializer().Serialize(bvl);

                ClsCommand cmd = new ClsCommand();
                cmd.Type    = "JN";
                cmd.Command = "ListeTabellenVariablen";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "PictureList")
            {
                // send PictureList
                var json = new JavaScriptSerializer().Serialize(ClsCommon.FileNames("pictures"));

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "DD";
                cmd.Type    = "JN";
                cmd.Command = "PictureList";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "AudioFileList")
            {
                // send PictureList
                var json = new JavaScriptSerializer().Serialize(ClsCommon.FileNames("sounds"));

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "DD";
                cmd.Type    = "JN";
                cmd.Command = "AudioFileList";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "FontList")
            {
                // send FontList
                var json = new JavaScriptSerializer().Serialize(ClsCommon.FileNames("fonts", true));

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "DD";
                cmd.Type    = "JN";
                cmd.Command = "FontList";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "PageSets")
            {
                var json = new JavaScriptSerializer().Serialize(ClsPageSets.PageSets());

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "DD";
                cmd.Type    = "JN";
                cmd.Command = "PageSets";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "Pages")
            {
                int psid = Convert.ToInt32(Request.PageSet);
                var json = new JavaScriptSerializer().Serialize(ClsPages.PageList(psid));

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "DD";
                cmd.Type    = "JN";
                cmd.Command = "Pages";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "PageList")
            {
                var json = new JavaScriptSerializer().Serialize(ClsPages.PageList(ClsPageSets.ActivePageSet()));

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "KO";
                cmd.Type    = "JN";
                cmd.Command = "PageList";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "PageColor")
            {
                var json = new JavaScriptSerializer().Serialize(ClsPages.GetStyleValue(Request.PageSet, Request.Page, "background-color"));

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "DD";
                cmd.Type    = "JN";
                cmd.Command = "PageColor";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "Divs")
            {
                int psid   = Convert.ToInt32(Request.PageSet);
                int PageID = Convert.ToInt32(Request.Page);
                var json   = new JavaScriptSerializer().Serialize(ClsDivs.DivList(psid, PageID));

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "DD";
                cmd.Type    = "JN";
                cmd.Command = "Divs";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "DivsActivePage")
            {
                int ActivePageSet = ClsPageSets.ActivePageSet();
                int ActivePage    = ClsGlobal.Instance.ActivePage;
                // int PageID = Convert.ToInt32(Request.Page);
                var json = new JavaScriptSerializer().Serialize(ClsDivs.DivList(ActivePageSet, ActivePage));

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "DD";
                cmd.Type    = "JN";
                cmd.Command = "DivsActivePage";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "Page")
            {
                int         psid  = Convert.ToInt32(Request.PageSet);
                int         pid   = Convert.ToInt32(Request.Page);
                DisplayPage aPage = ClsPages.Page(psid, pid);

                var json = new JavaScriptSerializer().Serialize(aPage);

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "DD";
                cmd.Type    = "JN";
                cmd.Command = "Page";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "ActivePage")
            {
                int         ActivePageSet = ClsPageSets.ActivePageSet();
                int         ActivePage    = ClsGlobal.Instance.ActivePage;
                DisplayPage aPage         = ClsPages.Page(ActivePageSet, ActivePage);

                var json = new JavaScriptSerializer().Serialize(aPage);

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "DD";
                cmd.Type    = "JN";
                cmd.Command = "ActivePage";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "Options")
            {
                List <Core.DB.Options3> ol = Core.DBControler.ClsOptionsControler.Options3();

                var json = new JavaScriptSerializer().Serialize(ol);

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "Opt";
                cmd.Type    = "JN";
                cmd.Command = "Options";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "TabellenSort")
            {
                List <Core.DB.TabellenSort> ol = Core.DBControler.ClsOptionsControler.Tabellensortierung();

                var json = new JavaScriptSerializer().Serialize(ol);

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "Opt";
                cmd.Type    = "JN";
                cmd.Command = "TabellenSort";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "HeartBeatStatus")
            {
                bool hs = ClsZeitkontroler.Instance.HeartBeatStatus;

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "Status";
                cmd.Type    = "JN";
                cmd.Command = "HeartBeatStatus";
                cmd.Value1  = hs.ToString();
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "Timers")
            {
                List <Core.DB.Timer> ol = Core.DBControler.ClsTimerControler.Timers();

                var json = new JavaScriptSerializer().Serialize(ol);

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "Opt";
                cmd.Type    = "JN";
                cmd.Command = "Timers";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "TimerObjects")
            {
                List <ClsClock> cl   = ClsZeitkontroler.Instance.PubClockList();
                var             json = new JavaScriptSerializer().Serialize(cl);

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "Opt";
                cmd.Type    = "JN";
                cmd.Command = "TimerObjects";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "Timerevents")
            {
                try
                {
                    int TimerNr = Convert.ToInt32(Request.Value1);
                    List <Core.DB.Timerevent> ol = Core.DBControler.ClsTimerControler.TimerEvents(TimerNr);

                    var json = new JavaScriptSerializer().Serialize(ol);

                    ClsCommand cmd = new ClsCommand();
                    cmd.Domain  = "Opt";
                    cmd.Type    = "JN";
                    cmd.Command = "Timerevents";
                    cmd.Value1  = json;
                    return(new JavaScriptSerializer().Serialize(cmd));
                }
                catch
                {
                    ClsCommand cmd = new ClsCommand();
                    cmd.Domain  = "Opt";
                    cmd.Type    = "JN";
                    cmd.Command = "Timerevents";
                    cmd.Value1  = "";
                    return(new JavaScriptSerializer().Serialize(cmd));
                }
            }

            if (Request.Command == "Events")
            {
                try
                {
                    List <Core.DB.EreignissTyp> el = Core.DBControler.ClsEreignisControler.EreignissTypen();
                    foreach (Core.DB.EreignissTyp k in el)
                    {
                        //k.Nummer = ClsLocalisationFunctions.Keytext("Ereignis", k.Nummer).Substring(5);
                        k.Nummer = Core.DBControler.ClsTextControler.TextByNameAndNumber("Ereignis", k.Nummer);
                    }

                    var json = new JavaScriptSerializer().Serialize(el);

                    ClsCommand cmd = new ClsCommand();
                    cmd.Domain  = "Opt";
                    cmd.Type    = "JN";
                    cmd.Command = "Events";
                    cmd.Value1  = json;
                    return(new JavaScriptSerializer().Serialize(cmd));
                }
                catch
                {
                    ClsCommand cmd = new ClsCommand();
                    cmd.Domain  = "Opt";
                    cmd.Type    = "JN";
                    cmd.Command = "Events";
                    cmd.Value1  = "";
                    return(new JavaScriptSerializer().Serialize(cmd));
                }
            }

            if (Request.Command == "Penalties")
            {
                try
                {
                    List <Core.DB.Strafen> pl = Core.DBControler.ClsOptionsControler.Strafen();
                    var json = new JavaScriptSerializer().Serialize(pl);

                    ClsCommand cmd = new ClsCommand();
                    cmd.Domain  = "Opt";
                    cmd.Type    = "JN";
                    cmd.Command = "Penalties";
                    cmd.Value1  = json;
                    return(new JavaScriptSerializer().Serialize(cmd));
                }
                catch
                {
                    ClsCommand cmd = new ClsCommand();
                    cmd.Domain  = "Opt";
                    cmd.Type    = "JN";
                    cmd.Command = "Penalties";
                    cmd.Value1  = "";
                    return(new JavaScriptSerializer().Serialize(cmd));
                }
            }

            if (Request.Command == "WhereToGo")
            {
                string psn = ClsPageSets.GetPageSetNameFromID(ClsPageSets.ActivePageSet());
                string pn  = ClsPages.GetPageNameFromID(ClsGlobal.Instance.ActivePage);

                ClsCommand cmd = new ClsCommand();
                cmd.Command = "GotoPage";
                cmd.PageSet = psn;
                cmd.Page    = pn;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "WebKontrols")
            {
                List <Core.DB.WebKontrols> wc = Core.DBControler.ClsKontrolControler.WebKontrols();
                var json = new JavaScriptSerializer().Serialize(wc);

                ClsCommand cmd = new ClsCommand();
                cmd.Command = "WebKontrols";
                cmd.Type    = "JN";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "TableFilter")
            {
                var json = new JavaScriptSerializer().Serialize(ClsGlobal.Instance.TableFilterList);

                ClsCommand cmd = new ClsCommand();
                cmd.Command = "TableFilter";
                cmd.Type    = "JN";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "Anzeigetabellen")
            {
                var json = new JavaScriptSerializer().Serialize(Core.DBControler.ClsOptionsControler.AnzeigetabelleAll());

                ClsCommand cmd = new ClsCommand();
                cmd.Command = "Anzeigetabellen";
                cmd.Type    = "JN";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "TurniereKomplett")
            {
                var json = new JavaScriptSerializer().Serialize(Core.DBControler.ClsTurnierControler.TurniereKomplett(Request.Value1));

                ClsCommand cmd = new ClsCommand();
                cmd.Command = "TurniereKomplett";
                cmd.Type    = "JN";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "TurnierSystemeKomplett")
            {
                var json = new JavaScriptSerializer().Serialize(Core.DBControler.ClsTurnierControler.TurniereKomplett("System"));

                ClsCommand cmd = new ClsCommand();
                cmd.Command = "TurnierSystemeKomplett";
                cmd.Type    = "JN";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "turnierID")
            {
                int tid = ClsGlobal.Instance.TurnierID;

                ClsCommand cmd = new ClsCommand();
                cmd.Command = "turnierID";
                cmd.Type    = "JN";
                cmd.Value1  = tid.ToString();
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            return("");
        }
示例#4
0
        private void FrmFSBMain_Load(object sender, EventArgs e)

        {
            try
            {
                // DB Prüfen
                if (!File.Exists(Path.Combine(ClsMain.AppFolder, "freescoreboard.sqlite")))
                {
                    MessageBox.Show("Datenbank nicht gefunden.\r\nProgramm wird beendet.");
                    Application.Exit();
                }

                // Anzeigeseite Prüfen
                if (!File.Exists(Path.Combine(ClsMain.DisplayFolder, "index.html")))
                {
                    MessageBox.Show("Anzeigeseite nicht gefunden.\r\nProgramm wird beendet.");
                    Application.Exit();
                }

                // Kontrollseite Prüfen
                if (!File.Exists(Path.Combine(ClsMain.WebFolder, "control/index.html")))
                {
                    MessageBox.Show("Kontrollseite nicht gefunden.\r\nProgramm wird beendet.");
                    Application.Exit();
                }

                // Load Main window size and position
                this.Load_PosSiz();

                // initialize server
                ClsServer.Instance.IniAddresses();
                //ClsServer.Instance.IniServerWS();
                //ClsServer.Instance.IniServerHTTP();


                ClsServer.Instance.ServerOn = true;

                // initialize variable values
                ClsDBVariablen.Instance.Ini();

                // initialize Timer and clocks
                ClsZeitkontroler.Instance.IniUhren();

                // load Display window
                bool DevTools = false;
                this.DisplayWindow = new FrmDisplay(DevTools);
                this.IniDisplay();
                string o = ClsOptionsControler.Options3("DisplayAtStartup").Value;
                if (o == "on")
                {
                    this.ShowDisplay = true;
                }
                else
                {
                    this.ShowDisplay = false;
                }

                // load inital display page
                ClsGlobal.Instance.ActivePage = ClsPages.GetFirstPageName(ClsPageSets.ActivePageSet());

                ClsTabellenfunktionen.IniTableFilter();

                // Debugmode
                string mode = System.Configuration.ConfigurationManager.AppSettings["Modus"];

                // Fenstertitel setzten
                string programmtitel = ClsOptionsControler.Options3("Programmtitel").Value;
                if (programmtitel == "")
                {
                    programmtitel = "http://www.FreeScoreBoard.org";
                }
                this.Text = programmtitel + " " + Application.ProductVersion;

                // Versionscheck
                string vc = ClsOptionsControler.Options3("Versionscheck").Value;
                if (vc == "True")
                {
                    ClsFunktionen.Versioncheck2(false);
                }

                // Turnier 0 laden
                ClsGlobal.Instance.TurnierID = 0;

                // registrierung prüfen
                Registrierung reg = ClsRegistrierungsControler.registrierung();
                if (reg == null)
                {
                    // DlgRegistrieren regdlg = new DlgRegistrieren();
                    // regdlg.ShowDialog();
                    reg = new Registrierung
                    {
                        extID = Guid.NewGuid().ToString()
                    };
                }

                ClsWebservice c = new ClsWebservice();
                ClsWebservice.Senden(reg);

                // hotkeys laden
                //this.LoadHotKeys();

                // set initial teams
                string teamAid = ClsOptionsControler.Options3("TeamA").Value;
                string teamBid = ClsOptionsControler.Options3("TeamB").Value;
                ClsGlobal.Instance.MansschaftAID = teamAid;
                ClsGlobal.Instance.MansschaftBID = teamBid;

                // set fist page
                //this.ctrlPageSelector1.SetAnzMod(ClsPages.GetFirstPageName(activeSet));

                // Timer starten
                ClsZeitkontroler.Instance.HeartBeatStatus = true;
                //ClsZeitkontroler.Instance.HeartBeatStatus = false;
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                this.mysplash.Close();
                ClsError.Error(this.Name, MethodBase.GetCurrentMethod().ToString(), ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
                this.mysplash.Close();
                //this.Check_Eventamount();
            }
        }
 public static void SwitchPage(ClsCommand rb)
 {
     ClsDisplay.SetPage(ClsPageSets.ActivePageSet(), rb.Page);
 }
        //private string MyName;
        //private static int MyNumber = 0;
        //private string MyPrefix;
        //private string binPfad = "";
        //private string binTyp = "";
        //private string binPageSet = "";

        //  Requests werden je Client session hier behandelt und die Daten dierekt nur an den anfragenden Client gesendet

        #region Requests
        public static string DataRequest(ClsCommand Request)
        {
            if (Request.Command == "TeamList")
            {
                List <Core.DB.Mannschaften> man = Core.Mannschaften.ClsCommon.Mannschaften();
                var json = new JavaScriptSerializer().Serialize(man);

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "MM";
                cmd.Type    = "JN";
                cmd.Command = "TeamList";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "TeamID")
            {
                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "MM";
                cmd.Type    = "JN";
                cmd.Command = "TeamID";

                if (Request.Team == "A")
                {
                    cmd.Team   = "A";
                    cmd.Value1 = ClsGlobal.Instance.MansschaftAID;
                }

                if (Request.Team == "B")
                {
                    cmd.Team   = "B";
                    cmd.Value1 = ClsGlobal.Instance.MansschaftBID;
                }

                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "PlayerList")
            {
                if (string.IsNullOrEmpty(Request.Team))
                {
                    if (Request.Value1 == "A")
                    {
                        Request.Team = ClsGlobal.Instance.MansschaftAID;
                    }

                    if (Request.Value1 == "B")
                    {
                        Request.Team = ClsGlobal.Instance.MansschaftBID;
                    }
                }

                List <Core.DB.Spieler> man = Core.Mannschaften.ClsCommon.SpielerListe(Request.Team);
                var json = new JavaScriptSerializer().Serialize(man);

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "MM";
                cmd.Type    = "JN";
                cmd.Command = "PlayerList";
                cmd.Team    = Request.Team;
                cmd.Value1  = Request.Value1;
                cmd.Value2  = json;

                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "SVariablen")
            {
                // Variablenliste senden
                List <ClsTextVariabeln> svl = ClsDBVariablen.Instance.GetAllTextVariablen();
                var json = new JavaScriptSerializer().Serialize(svl);

                ClsCommand cmd = new ClsCommand();
                //cmd.Domain = "DD";
                cmd.Type    = "JN";
                cmd.Command = "ListeTextVariablen";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "BVariablen")
            {
                // Variablenliste senden
                List <ClsBildVariabeln> bvl = ClsDBVariablen.Instance.GetAllBildVariablen();
                var json = new JavaScriptSerializer().Serialize(bvl);

                ClsCommand cmd = new ClsCommand();
                //cmd.Domain = "DD";
                cmd.Type    = "JN";
                cmd.Command = "ListeBildVariablen";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "TVariablen")
            {
                // Variablenliste senden
                List <ClsTabellenVariabeln> bvl = ClsDBVariablen.Instance.GetAllTabellenVariablen();
                var json = new JavaScriptSerializer().Serialize(bvl);

                ClsCommand cmd = new ClsCommand();
                //cmd.Domain = "DD";
                cmd.Type    = "JN";
                cmd.Command = "ListeTabellenVariablen";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "PictureList")
            {
                // send PictureList
                var json = new JavaScriptSerializer().Serialize(ClsCommon.FileNames("pictures"));

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "DD";
                cmd.Type    = "JN";
                cmd.Command = "PictureList";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "AudioFileList")
            {
                // send PictureList
                var json = new JavaScriptSerializer().Serialize(ClsCommon.FileNames("sounds"));

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "DD";
                cmd.Type    = "JN";
                cmd.Command = "AudioFileList";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "FontList")
            {
                // send FontList
                var json = new JavaScriptSerializer().Serialize(ClsCommon.FileNames("fonts", true));

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "DD";
                cmd.Type    = "JN";
                cmd.Command = "FontList";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "PageSets")
            {
                var json = new JavaScriptSerializer().Serialize(ClsPageSets.PageSetNames());

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "DD";
                cmd.Type    = "JN";
                cmd.Command = "PageSets";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "Pages")
            {
                var json = new JavaScriptSerializer().Serialize(ClsPages.PageList(Request.PageSet));

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "DD";
                cmd.Type    = "JN";
                cmd.Command = "Pages";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "PageList")
            {
                var json = new JavaScriptSerializer().Serialize(ClsPages.PageList(ClsPageSets.ActivePageSet()));

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "KO";
                cmd.Type    = "JN";
                cmd.Command = "PageList";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "PageColor")
            {
                var json = new JavaScriptSerializer().Serialize(ClsPages.GetStyleValue(Request.PageSet, Request.Page, "background-color"));

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "DD";
                cmd.Type    = "JN";
                cmd.Command = "PageColor";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "Divs")
            {
                var json = new JavaScriptSerializer().Serialize(ClsDivs.DivList(Request.PageSet, Request.Page));

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "DD";
                cmd.Type    = "JN";
                cmd.Command = "Divs";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "Page")
            {
                Page aPage = ClsPages.Page(Request.PageSet, Request.Page);

                var json = new JavaScriptSerializer().Serialize(aPage);

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "DD";
                cmd.Type    = "JN";
                cmd.Command = "Page";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "Options")
            {
                List <Core.DB.Options3> ol = Core.DBControler.ClsOptionsControler.Options3();

                var json = new JavaScriptSerializer().Serialize(ol);

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "Opt";
                cmd.Type    = "JN";
                cmd.Command = "Options";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "HeartBeatStatus")
            {
                bool hs = ClsZeitkontroler.Instance.HeartBeatStatus;

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "Status";
                cmd.Type    = "JN";
                cmd.Command = "HeartBeatStatus";
                cmd.Value1  = hs.ToString();
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "Timers")
            {
                List <Core.DB.Timer> ol = Core.DBControler.ClsTimerControler.Timers();

                var json = new JavaScriptSerializer().Serialize(ol);

                ClsCommand cmd = new ClsCommand();
                cmd.Domain  = "Opt";
                cmd.Type    = "JN";
                cmd.Command = "Timers";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "Timerevents")
            {
                try
                {
                    int TimerNr = Convert.ToInt32(Request.Value1);
                    List <Core.DB.Timerevent> ol = Core.DBControler.ClsTimerControler.TimerEvents(TimerNr);

                    var json = new JavaScriptSerializer().Serialize(ol);

                    ClsCommand cmd = new ClsCommand();
                    cmd.Domain  = "Opt";
                    cmd.Type    = "JN";
                    cmd.Command = "Timerevents";
                    cmd.Value1  = json;
                    return(new JavaScriptSerializer().Serialize(cmd));
                }
                catch
                {
                    ClsCommand cmd = new ClsCommand();
                    cmd.Domain  = "Opt";
                    cmd.Type    = "JN";
                    cmd.Command = "Timerevents";
                    cmd.Value1  = "";
                    return(new JavaScriptSerializer().Serialize(cmd));
                }
            }

            if (Request.Command == "Events")
            {
                try
                {
                    List <Core.DB.EreignissTyp> el = Core.DBControler.ClsEreignisControler.EreignissTypen();
                    foreach (Core.DB.EreignissTyp k in el)
                    {
                        //k.Nummer = ClsLocalisationFunctions.Keytext("Ereignis", k.Nummer).Substring(5);
                        k.Nummer = Core.DBControler.ClsTextControler.TextByNameAndNumber("Ereignis", k.Nummer);
                    }

                    var json = new JavaScriptSerializer().Serialize(el);

                    ClsCommand cmd = new ClsCommand();
                    cmd.Domain  = "Opt";
                    cmd.Type    = "JN";
                    cmd.Command = "Events";
                    cmd.Value1  = json;
                    return(new JavaScriptSerializer().Serialize(cmd));
                }
                catch
                {
                    ClsCommand cmd = new ClsCommand();
                    cmd.Domain  = "Opt";
                    cmd.Type    = "JN";
                    cmd.Command = "Events";
                    cmd.Value1  = "";
                    return(new JavaScriptSerializer().Serialize(cmd));
                }
            }

            if (Request.Command == "Penalties")
            {
                try
                {
                    List <Core.DB.Strafen> pl = Core.DBControler.ClsOptionsControler.Strafen();
                    var json = new JavaScriptSerializer().Serialize(pl);

                    ClsCommand cmd = new ClsCommand();
                    cmd.Domain  = "Opt";
                    cmd.Type    = "JN";
                    cmd.Command = "Penalties";
                    cmd.Value1  = json;
                    return(new JavaScriptSerializer().Serialize(cmd));
                }
                catch
                {
                    ClsCommand cmd = new ClsCommand();
                    cmd.Domain  = "Opt";
                    cmd.Type    = "JN";
                    cmd.Command = "Penalties";
                    cmd.Value1  = "";
                    return(new JavaScriptSerializer().Serialize(cmd));
                }
            }

            if (Request.Command == "WhereToGo")
            {
                ClsCommand cmd = new ClsCommand();
                cmd.Command = "GotoPage";
                cmd.PageSet = ClsPageSets.ActivePageSet();
                cmd.Page    = ClsGlobal.Instance.ActivePage;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            if (Request.Command == "WebKontrols")
            {
                List <Core.DB.WebKontrols> wc = Core.DBControler.ClsKontrolControler.WebKontrols();
                var json = new JavaScriptSerializer().Serialize(wc);

                ClsCommand cmd = new ClsCommand();
                cmd.Command = "WebKontrols";
                cmd.Type    = "JN";
                cmd.Value1  = json;
                return(new JavaScriptSerializer().Serialize(cmd));
            }

            return("");
        }
        private void ZeitAusloeser(object sender, ClsObjectEventArgs e)
        {
            Timerevent TimerEvent = (Timerevent)e.ObjectArgument;

            switch (TimerEvent.Eventtype)
            {
            case 0:
            {
                // Timer stoppen
                this.ClockStop(TimerEvent.TimerNr);
                GlobalServerEvents.SendMessage(null, new ClsStringEventArgs(ClsRequests.DataRequest(new ClsCommand(command: "TimerObjects"))));
                break;
            }

            case 1:
            {
                // anderen Timer starten
                if (TimerEvent.AndereTimerNr > 0)
                {
                    this.ClockStart(TimerEvent.AndereTimerNr);
                    GlobalServerEvents.SendMessage(null, new ClsStringEventArgs(ClsRequests.DataRequest(new ClsCommand(command: "TimerObjects"))));
                }

                break;
            }

            case 2:
            {
                // anderen Timer stoppen
                if (TimerEvent.AndereTimerNr > 0)
                {
                    this.ClockStop(TimerEvent.AndereTimerNr);
                    GlobalServerEvents.SendMessage(null, new ClsStringEventArgs(ClsRequests.DataRequest(new ClsCommand(command: "TimerObjects"))));
                }

                break;
            }

            case 3:
            {
                // Audio abspielen
                ClsSoundplayer.Instance.TPlay(TimerEvent.Soundfile + "|" + 75);
                break;
            }

            case 4:
            {
                // Layer wechsel
                if (!string.IsNullOrEmpty(TimerEvent.Layer))
                {
                    long id = Convert.ToInt64(TimerEvent.Layer);

                    DisplayPageSet ps = (from x in ClsDisplayControler.DisplayPageSets() where x.ID == ClsPageSets.ActivePageSet() select x).FirstOrDefault();

                    // prüfen ob ID tatsächlich noch existiert
                    long p = (from x in ClsDisplayControler.DisplayPagesForPageSet(ps.ID) where x.ID == id select x.ID).FirstOrDefault();

                    if (p != 0)
                    {
                        ClsDisplay.SetPage(ClsPageSets.ActivePageSet(), (int)p);

                        GlobalServerEvents.SendMessage(null, new ClsStringEventArgs(ClsRequests.DataRequest(new ClsCommand(command: "ActivePage"))));

                        GlobalServerEvents.SendMessage(null, new ClsStringEventArgs(ClsRequests.DataRequest(new ClsCommand(command: "DivsActivePage", pageSet: ps.PageSetName, page: p.ToString()))));
                    }
                }

                break;
            }
            }
        }