public static List <ClsTurnier> TurniereKomplett(string Turniertyp)
        {
            try
            {
                List <ClsTurnier> turnList = new List <ClsTurnier>();

                using (fsbDB FSBDB = new fsbDB())
                {
                    List <TKopf> stl;

                    if (Turniertyp == "")
                    {
                        stl = (from stk in FSBDB.TKopf select stk).ToList();
                    }
                    else
                    {
                        stl = (from stk in FSBDB.TKopf where stk.Turniertyp == Turniertyp select stk).ToList();
                    }

                    for (int i = 0; i < stl.Count; i++)
                    {
                        turnList.Add(TurnierKomplett((int)stl[i].ID));
                    }
                }

                return(turnList);
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
                return(new ClsTurnier[0].ToList());
            }
        }
Beispiel #2
0
        public static void SaveHotKey(HotKey hotkey)
        {
            try
            {
                HotKey ma;

                using (fsbDB FSBDB = new fsbDB())
                {
                    ma = (from s in FSBDB.HotKey
                          where s.ID == hotkey.ID
                          select s).FirstOrDefault();

                    foreach (PropertyInfo pi in hotkey.GetType().GetProperties())
                    {
                        if (pi.CanWrite)
                        {
                            pi.SetValue(ma, pi.GetValue(hotkey, null), null);
                        }
                    }

                    FSBDB.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
            }
        }
        public static void SaveTKopf(TKopf TurnierKopf)
        {
            try
            {
                TKopf l;

                using (fsbDB FSBDB = new fsbDB())
                {
                    l = (from x in FSBDB.TKopf
                         where x.ID == TurnierKopf.ID
                         select x).FirstOrDefault();

                    foreach (PropertyInfo pi in TurnierKopf.GetType().GetProperties())
                    {
                        if (pi.CanWrite)
                        {
                            pi.SetValue(l, pi.GetValue(TurnierKopf, null), null);
                        }
                    }

                    FSBDB.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
            }
        }
Beispiel #4
0
        public static void SaveWebKontrol(WebKontrols Kontrol)
        {
            try
            {
                WebKontrols ma;

                using (fsbDB FSBDB = new fsbDB())
                {
                    ma = (from s in FSBDB.WebKontrols
                          where s.ID == Kontrol.ID
                          select s).FirstOrDefault();

                    foreach (PropertyInfo pi in Kontrol.GetType().GetProperties())
                    {
                        if (pi.CanWrite)
                        {
                            pi.SetValue(ma, pi.GetValue(Kontrol, null), null);
                        }
                    }

                    FSBDB.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
            }
        }
        public static void SaveEreignissTyp(EreignissTyp Ereignisstyp)
        {
            try
            {
                EreignissTyp ma;

                using (fsbDB FSBDB = new fsbDB())
                {
                    ma = (from s in FSBDB.EreignissTyp
                          where s.ID == Ereignisstyp.ID
                          select s).FirstOrDefault();

                    foreach (PropertyInfo pi in Ereignisstyp.GetType().GetProperties())
                    {
                        if (pi.CanWrite)
                        {
                            pi.SetValue(ma, pi.GetValue(Ereignisstyp, null), null);
                        }
                    }

                    FSBDB.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
            }
        }
        public static void SaveDisplayPageSet(DisplayPageSet DisplayPageSet)
        {
            try
            {
                DisplayPageSet ma;

                using (fsbDB FSBDB = new fsbDB())
                {
                    ma = (from s in FSBDB.DisplayPageSet
                          where s.ID == DisplayPageSet.ID
                          select s).FirstOrDefault();

                    foreach (PropertyInfo pi in DisplayPageSet.GetType().GetProperties())
                    {
                        if (pi.CanWrite)
                        {
                            pi.SetValue(ma, pi.GetValue(DisplayPageSet, null), null);
                        }
                    }

                    FSBDB.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
            }
        }
        public static void SaveAnzeigetabelle(Anzeigetabelle anzeigetabelle)
        {
            try
            {
                Anzeigetabelle at;

                using (fsbDB FSBDB = new fsbDB())
                {
                    at = (from x in FSBDB.Anzeigetabelle
                          where x.ID == anzeigetabelle.ID
                          select x).FirstOrDefault();

                    foreach (PropertyInfo pi in anzeigetabelle.GetType().GetProperties())
                    {
                        if (pi.CanWrite)
                        {
                            pi.SetValue(at, pi.GetValue(anzeigetabelle, null), null);
                        }
                    }

                    FSBDB.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
            }
        }
        public static int SavePassword(string Name, string Password)
        {
            try
            {
                User st;

                using (fsbDB FSBDB = new fsbDB())
                {
                    st = (from x in FSBDB.User
                          where x.Name == Name
                          select x).FirstOrDefault();

                    st.Password = Password;

                    FSBDB.SaveChanges();
                }

                return(0);
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
                return(1);
            }
        }
        public static void SaveTabellensortierung(TabellenSort sortierung)
        {
            try
            {
                TabellenSort ts;

                using (fsbDB FSBDB = new fsbDB())
                {
                    ts = (from x in FSBDB.TabellenSort
                          where x.ID == sortierung.ID
                          select x).FirstOrDefault();

                    foreach (PropertyInfo pi in sortierung.GetType().GetProperties())
                    {
                        if (pi.CanWrite)
                        {
                            pi.SetValue(ts, pi.GetValue(sortierung, null), null);
                        }
                    }

                    FSBDB.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
            }
        }
        public static void SaveOptions3(Options3 option)
        {
            try
            {
                Options3 o3;

                using (fsbDB FSBDB = new fsbDB())
                {
                    o3 = (from Options3 g2 in FSBDB.Options3
                          where g2.ID == option.ID
                          select g2).FirstOrDefault();

                    if (o3 != null)
                    {
                        foreach (PropertyInfo pi in option.GetType().GetProperties())
                        {
                            if (pi.CanWrite)
                            {
                                pi.SetValue(o3, pi.GetValue(option, null), null);
                            }
                        }
                    }
                    else
                    {
                        FSBDB.Options3.Add(option);
                    }

                    FSBDB.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
            }
        }
        public static void SaveStrafe(Strafen strafe)
        {
            try
            {
                Strafen st;

                using (fsbDB FSBDB = new fsbDB())
                {
                    st = (from x in FSBDB.Strafen
                          where x.ID == strafe.ID
                          select x).FirstOrDefault();

                    foreach (PropertyInfo pi in strafe.GetType().GetProperties())
                    {
                        if (pi.CanWrite)
                        {
                            pi.SetValue(st, pi.GetValue(strafe, null), null);
                        }
                    }

                    FSBDB.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
            }
        }
        public static void SaveSpieler(Spieler spieler)
        {
            try
            {
                Spieler ss;

                using (fsbDB FSBDB = new fsbDB())
                {
                    ss = (from s in FSBDB.Spieler
                          where s.ID == spieler.ID
                          select s).FirstOrDefault();

                    foreach (PropertyInfo pi in spieler.GetType().GetProperties())
                    {
                        if (pi.CanWrite)
                        {
                            pi.SetValue(ss, pi.GetValue(spieler, null), null);
                        }
                    }

                    FSBDB.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
            }
        }
        public static void SaveEreigniss(TEreignisse ereignis)
        {
            try
            {
                TEreignisse l;

                using (fsbDB FSBDB = new fsbDB())
                {
                    l = (from x in FSBDB.TEreignisse
                         where x.ID == ereignis.ID
                         select x).FirstOrDefault();

                    foreach (PropertyInfo pi in ereignis.GetType().GetProperties())
                    {
                        if (pi.CanWrite)
                        {
                            pi.SetValue(l, pi.GetValue(ereignis, null), null);
                        }
                    }

                    FSBDB.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
            }
        }
        public static List <DB.Timer> Timers()
        {
            try
            {
                List <DB.Timer> tel;

                using (fsbDB FSBDB = new fsbDB())
                {
                    tel = (from x in FSBDB.Timer select x).ToList();
                }

                if (tel == null)
                {
                    return(new DB.Timer[0].ToList());
                }
                else
                {
                    return(tel);
                }
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
                return(new DB.Timer[0].ToList());
            }
        }
        public static void Executesqlspript(string filename)
        {
            try
            {
                string script = string.Empty;
                if (File.Exists(filename))
                {
                    script = File.ReadAllText(filename);

                    // split script on GO command
                    IEnumerable <string> commandStrings = Regex.Split(script, @"^\s*GO\s*$", RegexOptions.Multiline | RegexOptions.IgnoreCase);

                    using (fsbDB FSBDB = new fsbDB())
                    {
                        foreach (string commandString in commandStrings)
                        {
                            if (commandString.Trim() != string.Empty)
                            {
                                int a = commandString.IndexOf("Anzeigeobjekt", StringComparison.Ordinal);
                                FSBDB.Database.ExecuteSqlCommand(commandString);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
            }
        }
Beispiel #16
0
        public static void SaveRegistrierung(Registrierung registrierung)
        {
            try
            {
                Registrierung rg;

                using (fsbDB FSBDB = new fsbDB())
                {
                    rg = (from x in FSBDB.Registrierung
                          where x.ID == registrierung.ID
                          select x).FirstOrDefault();

                    foreach (PropertyInfo pi in registrierung.GetType().GetProperties())
                    {
                        if (pi.CanWrite)
                        {
                            pi.SetValue(rg, pi.GetValue(registrierung, null), null);
                        }
                    }

                    FSBDB.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
            }
        }
        public static List <Timerevent> AktiveTimerEvents(int TimerNr, string order = "ASC")
        {
            try
            {
                List <Timerevent> tel;

                using (fsbDB FSBDB = new fsbDB())
                {
                    if (order == "DESC")
                    {
                        tel = (from x in FSBDB.Timerevent where x.TimerNr == TimerNr && x.Active == true orderby x.Sekunden descending, x.Eventtype descending select x).ToList();
                    }
                    else
                    {
                        tel = (from x in FSBDB.Timerevent where x.TimerNr == TimerNr && x.Active == true orderby x.Sekunden ascending, x.Eventtype descending select x).ToList();
                    }
                }

                if (tel == null)
                {
                    return(new Timerevent[0].ToList());
                }
                else
                {
                    return(tel);
                }
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
                return(new Timerevent[0].ToList());
            }
        }
        public static void SaveTimerEvent(Timerevent timerevent)
        {
            try
            {
                Timerevent te;

                using (fsbDB FSBDB = new fsbDB())
                {
                    te = (from x in FSBDB.Timerevent
                          where x.ID == timerevent.ID
                          select x).FirstOrDefault();

                    foreach (PropertyInfo pi in timerevent.GetType().GetProperties())
                    {
                        if (pi.CanWrite)
                        {
                            pi.SetValue(te, pi.GetValue(timerevent, null), null);
                        }
                    }

                    FSBDB.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
            }
        }
        public static List <Timerevent> TimerEvents(int TimerNr)
        {
            try
            {
                List <Timerevent> tel;

                using (fsbDB FSBDB = new fsbDB())
                {
                    tel = (from x in FSBDB.Timerevent where x.TimerNr == TimerNr select x).ToList();
                }

                if (tel == null)
                {
                    return(new Timerevent[0].ToList());
                }
                else
                {
                    return(tel);
                }
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
                return(new Timerevent[0].ToList());
            }
        }
        public static List <Spieler> Spielers(int mannschaftsID)
        {
            try
            {
                List <Spieler> sl;

                using (fsbDB FSBDB = new fsbDB())
                {
                    long mid = (from s in FSBDB.Mannschaften
                                where s.ID == mannschaftsID
                                select s.ID).FirstOrDefault();

                    sl = (from s in FSBDB.Spieler
                          where s.MannschaftsID == mid
                          select s).ToList();
                }

                return(sl);
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
                return(new Spieler[0].ToList());
            }
        }
 public static void DelEvent(int ID)
 {
     using (fsbDB FSBDB = new fsbDB())
     {
         TEreignisse e = (from s in FSBDB.TEreignisse
                          where s.ID == 0
                          select s).FirstOrDefault();
         FSBDB.TEreignisse.Remove(e);
         FSBDB.SaveChanges();
     }
 }
Beispiel #22
0
        public static List <DB.Variablen> Variablen()
        {
            List <DB.Variablen> lst = new List <DB.Variablen>();

            using (fsbDB FSBDB = new fsbDB())
            {
                lst = (from s in FSBDB.Variablen
                       select s).ToList();
            }

            return(lst);
        }
        public static void DelDisplayObjectsForPage(long PageID)
        {
            using (fsbDB FSBDB = new fsbDB())
            {
                List <DisplayObject> ol = DisplayObjectsForPage(PageID);

                for (int i = 0; i < ol.Count; i++)
                {
                    DelDisplayObject((int)ol[i].ID);
                }
            }
        }
 public static void DelDisplayObject(long DisplayObjectID)
 {
     using (fsbDB FSBDB = new fsbDB())
     {
         // del object
         DisplayObject el = (from s in FSBDB.DisplayObject
                             where s.ID == DisplayObjectID
                             select s).FirstOrDefault();
         FSBDB.DisplayObject.Remove(el);
         FSBDB.SaveChanges();
     }
 }
Beispiel #25
0
        public static List <WebKontrols> WebKontrols()
        {
            List <WebKontrols> lst = new List <WebKontrols>();

            using (fsbDB FSBDB = new fsbDB())
            {
                lst = (from s in FSBDB.WebKontrols
                       select s).ToList();
            }

            return(lst);
        }
        public static DisplayPageSet DisplayPageSet(int id)
        {
            DisplayPageSet res = new DisplayPageSet();

            using (fsbDB FSBDB = new fsbDB())
            {
                res = (from s in FSBDB.DisplayPageSet
                       where s.ID == id
                       select s).FirstOrDefault();
            }

            return(res);
        }
        public static DisplayObject DisplayObject(long id)
        {
            DisplayObject res = new DisplayObject();

            using (fsbDB FSBDB = new fsbDB())
            {
                res = (from s in FSBDB.DisplayObject
                       where s.ID == id
                       select s).FirstOrDefault();
            }

            return(res);
        }
        public static void DelDisplayPagesForPageSet(long PageSetID)
        {
            using (fsbDB FSBDB = new fsbDB())
            {
                List <DisplayPage> ol = DisplayPagesForPageSet(PageSetID);

                for (int i = 0; i < ol.Count; i++)
                {
                    // del DisplayPage
                    DelDisplayPage((int)ol[i].ID);
                }
            }
        }
        // PageSet
        public static List <DisplayPageSet> DisplayPageSets()
        {
            List <DisplayPageSet> lst = new List <DisplayPageSet>();

            using (fsbDB FSBDB = new fsbDB())
            {
                lst = (from s in FSBDB.DisplayPageSet
                       orderby s.Sort
                       select s).ToList();
            }

            return(lst);
        }
        public static string TextByNameAndNumber(string KeyName, string KeyNumber, string Langu = "DE")
        {
            string ret = "";

            using (fsbDB FSBDB = new fsbDB())
            {
                ret = (from s in FSBDB.A_Text
                       where s.Key == KeyName + "_" + KeyNumber && s.Language == Langu
                       select s.Text).FirstOrDefault();
            }

            return(ret);
        }