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 void PersonenListe() { int eingabe; Console.Clear(); Console.WriteLine("\t\tPersonenlisten Programm"); Console.WriteLine("\n1.Person hinzufügen\n2.Person Anzeigen\n3."); Console.Write("Eingabe: "); eingabe = Convert.ToInt32(Console.ReadLine()); switch (eingabe) { case 1: Registrierung.PersonHinzuf(); break; case 2: break; } }
public static int AddRegistrierung(Registrierung registrierung) { try { using (fsbDB FSBDB = new fsbDB()) { long newID = (from x in FSBDB.Registrierung select x.ID).DefaultIfEmpty(0).Max() + 1; registrierung.ID = newID; FSBDB.Registrierung.Add(registrierung); FSBDB.SaveChanges(); } return((int)registrierung.ID); } catch (Exception ex) { ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex); return(0); } }
public static void Senden(Registrierung registerData) { try { var json = new JavaScriptSerializer().Serialize(registerData); // senden // Create a request using a URL that can receive a post. WebRequest request = WebRequest.Create("http://FreeScoreBoard.org/webservice/create.php"); // Set the Method property of the request to POST. request.Method = "POST"; // Create POST data and convert it to a byte array. byte[] byteArray = Encoding.UTF8.GetBytes(json); // Set the ContentType property of the WebRequest. request.ContentType = "application/x-www-form-urlencoded"; // Set the ContentLength property of the WebRequest. request.ContentLength = byteArray.Length; // Get the request stream. Stream dataStream = request.GetRequestStream(); // Write the data to the request stream. dataStream.Write(byteArray, 0, byteArray.Length); // Close the Stream object. dataStream.Close(); // Get the response. WebResponse response = request.GetResponse(); // Display the status. // Console.WriteLine(((HttpWebResponse)response).StatusDescription); // Get the stream containing content returned by the server. dataStream = response.GetResponseStream(); // Open the stream using a StreamReader for easy access. using (StreamReader reader = new StreamReader(dataStream)) { // Read the content. string responseFromServer = reader.ReadToEnd(); // Display the content. // Console.WriteLine(responseFromServer); // System.Windows.Forms.Clipboard.SetText(json + "\r\n\r\n" + responseFromServer); // Clean up the streams. reader.Close(); dataStream.Close(); response.Close(); } } catch (Exception) { // ClsError.Error(this.Name, MethodBase.GetCurrentMethod().ToString(), ex); } }
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(); } }