private void button1_Click(object sender, EventArgs e) { dbConnection x = new dbConnection(); x.openConnection(); x.ExecuteSQL("TRUNCATE TABLE motd"); x.closeConnection(); x.openConnection(); x.ExecuteSQL("INSERT INTO motd (nachricht) VALUES ('" + textBox1.Text + "')"); x.closeConnection(); notification.Show("Eingetragen!", AlertType.success); this.Close(); }
private void urlaubslisteToolStripMenuItem_Click(object sender, EventArgs e) { fenster = 6; dataGridView1.Rows.Clear(); dataGridView1.Columns.Clear(); dataGridView1.ColumnCount = 4; dataGridView1.Columns[0].Name = "Name"; dataGridView1.Columns[1].Name = "Abwesend ab"; dataGridView1.Columns[2].Name = "Abwesend bis"; dataGridView1.Columns[3].Name = "Begründung"; dbConnection x = new dbConnection(); x.openConnection(); var reader = x.readerSQL("SELECT * FROM Urlaub"); while (reader.Read()) { dataGridView1.Rows.Add(reader.GetString("name"), reader.GetString("von"), reader.GetString("bis"), reader.GetString("begründung")); } reader.Close(); x.closeConnection(); }
private void button4_Click(object sender, EventArgs e) { string name = textBox5.Text; int aktiv = 0; if (checkBox5.Checked) { aktiv = 1; } if (radioButton4.Checked) { int index = Suche_Schulung(); int id = int.Parse(schulungen[index][0]); dbConnection con = new dbConnection(); con.openConnection(); con.ExecuteSQL("UPDATE Schulungsliste SET name='" + name + "',aktiv=" + aktiv + " WHERE id=" + id); con.closeConnection(); } else { int index = Suche_FST(); int id = int.Parse(fsts[index][0]); dbConnection con = new dbConnection(); con.openConnection(); con.ExecuteSQL("UPDATE FSTListe SET name='" + name + "',aktiv=" + aktiv + " WHERE id=" + id); con.closeConnection(); } }
private void mittelschwerVergehen() { sanktionen.Clear(); comboBox1.Items.Clear(); dbConnection x = new dbConnection(); x.openConnection(); var reader = x.readerSQL("SELECT * FROM Strafkatalog WHERE Typ=3"); while (reader.Read()) { List <string> tmp = new List <string>(); tmp.Add(reader.GetString("id")); tmp.Add(reader.GetString("Vergehen")); tmp.Add(reader.GetString("Punkte")); string[] money = reader.GetString("Geld").Split(';'); tmp.Add(money[0]); tmp.Add(money[1]); tmp.Add(money[2]); tmp.Add(money[3]); sanktionen.Add(tmp); comboBox1.Items.Add(reader.GetString("Vergehen")); } reader.Close(); x.closeConnection(); }
private void archivToolStripMenuItem1_Click(object sender, EventArgs e) { fenster = 5; dataGridView1.Rows.Clear(); dataGridView1.Columns.Clear(); dataGridView1.ColumnCount = 5; dataGridView1.Columns[0].Name = "ID"; dataGridView1.Columns[1].Name = "Name"; dataGridView1.Columns[2].Name = "Link"; dataGridView1.Columns[3].Name = "Gefehlt"; dataGridView1.Columns[4].Name = "Woche"; dataGridView1.Columns[1].HeaderCell.Style.Padding = new Padding(50, 0, 50, 0); dataGridView1.Columns[2].HeaderCell.Style.Padding = new Padding(30, 0, 50, 0); dataGridView1.Columns[3].HeaderCell.Style.Padding = new Padding(80, 0, 50, 0); dbConnection x = new dbConnection(); x.openConnection(); var readMitarbeiter = x.readerSQL("SELECT * from FahrzeugbeladungArchiv"); while (readMitarbeiter.Read()) { dataGridView1.Rows.Add(readMitarbeiter[0].ToString(), readMitarbeiter[1].ToString(), readMitarbeiter[2].ToString(), readMitarbeiter[3].ToString(), readMitarbeiter[4].ToString()); } readMitarbeiter.Close(); x.closeConnection(); }
private void timer1_Tick_1(object sender, EventArgs e) { Rechte_Load(); dbConnection x = new dbConnection(); x.openConnection(); var reader = x.readerSQL("SELECT * FROM motd"); while (reader.Read()) { richTextBox1.Text = reader[0].ToString(); } reader.Close(); bool red = false; reader = x.readerSQL("SELECT status from AusbildungsTermine WHERE prüfling='" + username + "' AND status=1"); while (reader.Read()) { if (reader.GetString("status") == "1") { red = true; } } reader.Close(); x.closeConnection(); if (red) { button3.BackColor = Color.Red; } else { button3.ResetBackColor(); button3.UseVisualStyleBackColor = true; } }
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) { dbConnection x = new dbConnection(); x.openConnection(); var item = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value; if (item == null) { item = ""; } int id = int.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()); string header = dataGridView1.Columns[e.ColumnIndex].HeaderText; if (header == "Beispiel") { x.ExecuteSQL("UPDATE BewerbungFallbeispiele SET beispiel='" + item.ToString() + "' WHERE id=" + id); } if (header == "Antwort") { x.ExecuteSQL("UPDATE BewerbungFallbeispiele SET richtig='" + item.ToString() + "' WHERE id=" + id); } if (header == "Atkiv") { x.ExecuteSQL("UPDATE BewerbungFallbeispiele SET aktiv='" + item.ToString() + "' WHERE id=" + id); } if (header == "ID") { return; } x.closeConnection(); }
public void Uebersicht() { // dGVerwaltung.Enabled = false; dGVerwaltung.Rows.Clear(); dbConnection Auslesen = new dbConnection(); Auslesen.openConnection(); var A = Auslesen.readerSQL("SELECT * FROM User WHERE uninvite != '2' ORDER BY rang DESC, beitritt ASC"); var rowcount = 0; while (A.Read()) { this.dGVerwaltung.Rows.Add(A[1], A[2], A[3], A[4], A[5], "", A[6]); // Wenn eine Kündigung vorgeschlagen wurde if (Convert.ToInt32(A[12]) == 1) { dGVerwaltung.Rows[rowcount].Cells[7].Value = "Uninvite"; dGVerwaltung.Rows[rowcount].Cells[7].Style.BackColor = Color.Red; dGVerwaltung.Rows[rowcount].Cells[7].Style.ForeColor = Color.White; dGVerwaltung.Rows[rowcount].Cells[8].Value = "X"; dGVerwaltung.Rows[rowcount].Cells[8].Style.BackColor = Color.Cyan; } rowcount++; } Auslesen.closeConnection(); }
private void button2_Click(object sender, EventArgs e) { dbConnection x = new dbConnection(); x.openConnection(); x.ExecuteSQL("UPDATE Bewerbungstermine SET status=2,aktiv=0 WHERE name='" + name + "'"); x.closeConnection(); //User_add f = new User_add(); //f.Show();, var api_key = Generate_api(); dbConnection insertquery = new dbConnection(); insertquery.openConnection(); insertquery.ExecuteSQL("INSERT INTO User (apikey, id, username, forumname, beitritt, telefon, rang, email, abteilung) VALUES ('" + api_key + "', '" + userid + "', '" + name + "', '" + forumsname + "', NOW(), '" + telnummer + "', '0', NULL, NULL)"); insertquery.closeConnection(); MessageBox.Show("Generierter API Key: " + api_key); Clipboard.SetText(api_key); this.DialogResult = DialogResult.OK; this.Close(); }
private void button2_Click(object sender, EventArgs e) { if (textBox3.Text == "") { return; } if (textBox4.Text == "") { return; } dbConnection x = new dbConnection(); x.openConnection(); if (checkBox1.Checked) { x.ExecuteSQL("UPDATE Fahrzeuge SET nummer='" + textBox4.Text + "',typ='" + textBox3.Text + "',aktiv=1 WHERE nummer='" + textBox4.Text + "'"); } else { x.ExecuteSQL("UPDATE Fahrzeuge SET nummer='" + textBox4.Text + "',typ='" + textBox3.Text + "',aktiv=0 WHERE nummer='" + textBox4.Text + "'"); } x.closeConnection(); this.DialogResult = DialogResult.OK; MessageBox.Show("Gepsiechert!"); }
private void button1_Click(object sender, EventArgs e) { string prüfungen = ""; foreach (string s in checkedListBox1.CheckedItems) { prüfungen += s + ";"; } string schulungen = ""; foreach (string s in checkedListBox2.CheckedItems) { schulungen += s + ";"; } string wochen = numericUpDown2.Value.ToString(); //MessageBox.Show(prüfungen + "\n" + schulungen + "\n" + wochen + "wochen"); dbConnection x = new dbConnection(); x.openConnection(); x.ExecuteSQL("UPDATE rankupBedinungen SET prüfungen ='" + prüfungen + "',schulungen='" + schulungen + "',wochen='" + wochen + "' WHERE rang=" + numericUpDown1.Value); x.closeConnection(); for (int i = 0; i < checkedListBox1.Items.Count; i++) { checkedListBox1.SetItemCheckState(i, CheckState.Unchecked); } for (int i = 0; i < checkedListBox2.Items.Count; i++) { checkedListBox2.SetItemCheckState(i, CheckState.Unchecked); } update(); }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "") { return; } if (textBox2.Text == "") { return; } dbConnection x = new dbConnection(); x.openConnection(); try { x.ExecuteSQL("INSERT INTO Fahrzeuge (nummer,typ) VALUES ('" + textBox2.Text + "','" + textBox1.Text + "')"); }catch (Exception ex) { notification.Show("FEHLER \n Gibt es evtl. schon ein Fahrzeug mit dieser Fahrzeugnummer?", AlertType.error); } x.closeConnection(); MessageBox.Show("Gepsiechert!"); }
private void Insert_Pruefungen() { dbConnection abfragemitarbeiter = new dbConnection(); abfragemitarbeiter.openConnection(); var res = abfragemitarbeiter.readerSQL("SELECT * FROM Pruefungsliste"); pruefungenlist = new List <List <string> >(); while (res.Read()) { if (res[3].ToString() != "0") { List <string> temp = new List <string>(); pruefungen.Items.Add(res[1]); temp.Add(res[1].ToString()); // 0 = Name temp.Add(res[2].ToString()); // 1 = Anzahlpersonen temp.Add(res[3].ToString()); // Aktiv temp.Add(res[4].ToString()); // Sonderbemerkgung pruefungenlist.Add(temp); } } res.Close(); abfragemitarbeiter.closeConnection(); }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 1) { if (e.RowIndex == -1) { return; } string name = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); string status = dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString(); string termin = dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString(); string id = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); if (status == "Termin erhalten") { DialogResult diag = MessageBox.Show("Ist dieser Termin möglich?", "", MessageBoxButtons.YesNoCancel); if (diag == DialogResult.Yes) { dbConnection x = new dbConnection(); x.openConnection(); x.ExecuteSQL("UPDATE AusbildungsTermine SET status='2' WHERE id='" + id + "'"); x.closeConnection(); update(); } if (diag == DialogResult.No) { dbConnection x = new dbConnection(); x.openConnection(); x.ExecuteSQL("UPDATE AusbildungsTermine SET status='3' WHERE id='" + id + "'"); x.closeConnection(); update(); } } if (status == "Termin bestätigt") { string tmp = termin.Replace("-", ""); string dateString = tmp; DateTime now = DateTime.Now; DateTime myDate = DateTime.Parse(dateString); TimeSpan test = myDate - now; if (test.TotalHours < 1) { MessageBox.Show("Du kannst deine Prüfung nur bis zu 1 Stunde vorher absagen! \n bitte kontaktiere zur Not deinen Prüfer über das Forum!"); } else { DialogResult diag = MessageBox.Show("Sicher,dass du den Termin absagen willst?", "", MessageBoxButtons.YesNo); if (diag == DialogResult.Yes) { dbConnection x = new dbConnection(); x.openConnection(); x.ExecuteSQL("UPDATE AusbildungsTermine SET status='4' WHERE id='" + id + "'"); x.closeConnection(); update(); } } } } }
private void button1_Click(object sender, EventArgs e) { dbConnection addPruefung = new dbConnection(); addPruefung.openConnection(); string prüfer; if (anzahlprüfer == 1) { string id1 = mitarbeiter[Suche_Mitarbeiter(comboBox2)][1]; prüfer = id1; } else if (anzahlprüfer == 2) { string id1 = mitarbeiter[Suche_Mitarbeiter(comboBox2)][1]; string id2 = mitarbeiter[Suche_Mitarbeiter(comboBox3)][1]; prüfer = id1 + " & " + id2; } else if (anzahlprüfer == 3) { string id1 = mitarbeiter[Suche_Mitarbeiter(comboBox2)][1]; string id2 = mitarbeiter[Suche_Mitarbeiter(comboBox3)][1]; string id3 = mitarbeiter[Suche_Mitarbeiter(comboBox4)][1]; prüfer = id1 + " & " + id2 + " & " + id3; } else if (anzahlprüfer == 4) { string id1 = mitarbeiter[Suche_Mitarbeiter(comboBox2)][1]; string id2 = mitarbeiter[Suche_Mitarbeiter(comboBox3)][1]; string id3 = mitarbeiter[Suche_Mitarbeiter(comboBox4)][1]; string id4 = mitarbeiter[Suche_Mitarbeiter(comboBox5)][1]; prüfer = id1 + " & " + id2 + " & " + id3 + " & " + id4; } else { notification.Show("Fehler!", AlertType.error); return; } int bestanden = 0; if (comboBox1.Text == "Ja") { bestanden = 1; } int prüfung = Suche_Pruefung(); MessageBox.Show("id " + pruefungen.Text + "', " + bestanden + ", '" + pruefungenlist[prüfung][3] + "', '" + prüfer + "'"); string sonder = null; if (pruefungenlist[prüfung][3] != "") { sonder = textBox1.Text; } addPruefung.ExecuteSQL("INSERT INTO Pruefungen (userid,pruefung,bestanden,bemerkung,pruefer) VALUES ('" + id + "','" + pruefungen.Text + "','" + bestanden + "','" + sonder + "','" + prüfer + "')"); addPruefung.closeConnection(); }
private void button1_Click(object sender, EventArgs e) { dbConnection con = new dbConnection(); con.openConnection(); con.ExecuteSQL("UPDATE User SET personalBemerkung='" + textBox1.Text + "' WHERE id='" + User_Manage.id + "'"); con.closeConnection(); this.DialogResult = DialogResult.OK; }
private void button3_Click(object sender, EventArgs e) { dbConnection x = new dbConnection(); x.openConnection(); x.ExecuteSQL("UPDATE AusbildungsTermine SET status='5' WHERE id='" + id + "'"); x.closeConnection(); this.DialogResult = DialogResult.OK; }
private void button1_Click(object sender, EventArgs e) { //MessageBox.Show(Ausbildung_User_Manage.id); dbConnection con = new dbConnection(); con.openConnection(); con.ExecuteSQL("UPDATE User SET ausbilderBemerkung='" + textBox1.Text + "' WHERE id='" + Ausbildung_User_Manage.id + "'"); con.closeConnection(); this.DialogResult = DialogResult.OK; }
public void Uebersicht() { dG.Rows.Clear(); dbConnection Auslesen = new dbConnection(); Auslesen.openConnection(); var A = Auslesen.readerSQL("SELECT id, userid, rang, beitritt, austritt, entlassen, gemeldet, dokumente, wiedereingestellt, blacklist, bemerkung FROM Archiv"); var zaehler = 0; while (A.Read()) { dG.Rows.Add(); dG.Rows[zaehler].Cells[0].Value = A[0]; dG.Rows[zaehler].Cells[1].Value = A[1]; dG.Rows[zaehler].Cells[2].Value = A[2]; dbConnection Auslesenname = new dbConnection(); Auslesenname.openConnection(); var N = Auslesenname.readerSQL("SELECT username FROM User WHERE id = '" + A[1] + "'"); while (N.Read()) { dG.Rows[zaehler].Cells[3].Value = N[0]; } dG.Rows[zaehler].Cells[4].Value = A[3]; dG.Rows[zaehler].Cells[5].Value = A[4]; dG.Rows[zaehler].Cells[6].Value = Ausgabejanein(Convert.ToInt32(A[5])); //Gemeldet DateTime B = Convert.ToDateTime(A[3]); DateTime Au = Convert.ToDateTime(A[4]); TimeSpan sp = Au - B; if (Convert.ToInt32(A[6]) == 0) { if (Convert.ToInt32(A[2]) == 0 && Convert.ToInt32(sp.Days) >= 15 && Convert.ToInt32(sp.Days) <= 30) { dG.Rows[zaehler].Cells[7].Style.BackColor = Color.Red; dG.Rows[zaehler].Cells[7].Style.ForeColor = Color.White; } if (Convert.ToInt32(A[2]) != 0 && Convert.ToInt32(sp.Days) <= 30) { dG.Rows[zaehler].Cells[7].Style.BackColor = Color.Red; dG.Rows[zaehler].Cells[7].Style.ForeColor = Color.White; } } dG.Rows[zaehler].Cells[7].Value = Ausgabejanein(Convert.ToInt32(A[6])); dG.Rows[zaehler].Cells[8].Value = Ausgabejanein(Convert.ToInt32(A[7])); dG.Rows[zaehler].Cells[9].Value = Ausgabejanein(Convert.ToInt32(A[8])); dG.Rows[zaehler].Cells[10].Value = Ausgabejanein(Convert.ToInt32(A[9])); dG.Rows[zaehler].Cells[11].Value = A[10]; Auslesenname.closeConnection(); zaehler++; } Auslesen.closeConnection(); }
private void button1_Click(object sender, EventArgs e) { int index = Suche_Vergehen(); int mbindex = Suche_Mitarbeiter(); int sanktionsID = int.Parse(sanktionen[index][0]); string name = comboBox2.Text; int gesammt = int.Parse(mitarbeiter[mbindex][3]); int punkte = int.Parse(sanktionen[index][2]); int rang = int.Parse(mitarbeiter[index][2]); string strafe = ""; if (rang >= 0 && rang <= 2) { strafe = sanktionen[index][3]; } if (rang >= 3 && rang <= 5) { strafe = sanktionen[index][4]; } if (rang >= 6 && rang <= 9) { strafe = sanktionen[index][5]; } if (rang >= 10 && rang <= 12) { strafe = sanktionen[index][6]; } dbConnection x = new dbConnection(); x.openConnection(); x.ExecuteSQL("INSERT INTO Sanktionen (username,sanktion,datum,strafe) VALUES ('" + name + "'," + sanktionsID + ",NOW()," + strafe + ")"); x.closeConnection(); x.openConnection(); gesammt = gesammt + punkte; //MessageBox.Show("PUNKTE: " + gesammt + "Name:" + name); x.ExecuteSQL("UPDATE User SET sanktionspunkte=" + gesammt + " WHERE username='******'"); x.closeConnection(); notification.Show("Erfolgreich eingetragen! \n " + punkte + "Punkte", AlertType.success); this.Close(); }
private void button1_Click(object sender, EventArgs e) { int index = Suche_Mitarbeiter(); dbConnection x = new dbConnection(); x.openConnection(); x.ExecuteSQL("UPDATE User SET hwid='~' WHERE id='" + mitarbeiter[index][1] + "'"); x.closeConnection(); this.Close(); }
private void button3_Click(object sender, EventArgs e) { dbConnection x = new dbConnection(); x.openConnection(); x.ExecuteSQL("UPDATE Bewerbungstermine SET status=3,aktiv=0 WHERE name='" + name + "'"); x.closeConnection(); this.DialogResult = DialogResult.OK; this.Close(); }
private void Termine() { fenster = 2; dataGridView1.Rows.Clear(); dataGridView1.Columns.Clear(); dataGridView1.ColumnCount = 4; dataGridView1.Columns[0].Name = "Name"; DataGridViewButtonColumn dgvButton = new DataGridViewButtonColumn(); dgvButton.HeaderText = "Name"; dgvButton.FlatStyle = FlatStyle.Flat; dataGridView1.Columns.Insert(0, dgvButton); dataGridView1.Columns[1].Name = "Datum"; dataGridView1.Columns[2].Name = "Uhrzeit"; dataGridView1.Columns[3].Name = ""; dataGridView1.Columns[4].Name = "Status"; dataGridView1.Columns[0].HeaderCell.Style.Padding = new Padding(50, 0, 50, 0); dataGridView1.Columns[4].HeaderCell.Style.Padding = new Padding(50, 0, 50, 0); dbConnection x = new dbConnection(); x.openConnection(); var readMitarbeiter = x.readerSQL("SELECT name,datum,uhrzeit,aktiv,status FROM Bewerbungstermine"); while (readMitarbeiter.Read()) { string info; if (readMitarbeiter[3].ToString() == "1") { if (readMitarbeiter[4].ToString() == "2") { info = "Angenommen"; } else if (readMitarbeiter[4].ToString() == "3") { info = "Abgelehnt"; } else { info = "Eingeladen"; } dataGridView1.Rows.Add(readMitarbeiter[0].ToString(), readMitarbeiter[1].ToString(), readMitarbeiter[2].ToString() + " Uhr", "", info); } } readMitarbeiter.Close(); x.closeConnection(); }
private void button2_Click(object sender, EventArgs e) { DialogResult diag = MessageBox.Show("Sicher, dass du dieses Vergehen entfernen willst?", "", MessageBoxButtons.YesNo); if (diag == DialogResult.Yes) { dbConnection x = new dbConnection(); x.openConnection(); x.ExecuteSQL("DELETE From Strafkatalog WHERE id=" + id); x.closeConnection(); } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "" || comboBox1.Text == "" || numericUpDown1.Value == 0 || numericUpDown2.Value == 0 || numericUpDown3.Value == 0 || numericUpDown4.Value == 0 || numericUpDown5.Value == 0) { MessageBox.Show("Du hast nicht alles ausgefüllt!"); return; } string vergehen = textBox1.Text; string typString = comboBox1.Text; int typ = 0; if (typString == "leichtes Vergehen") { typ = 1; } if (typString == "minimalschweres Vergehen") { typ = 2; } if (typString == "mittelschweres Vergehen") { typ = 3; } if (typString == "schweres Vergehen") { typ = 4; } string money = numericUpDown2.Value + ";" + numericUpDown3.Value + ";" + numericUpDown4.Value + ";" + numericUpDown5.Value; int punkte = (int)numericUpDown1.Value; // MessageBox.Show(add.ToString()); if (add == false) { dbConnection x = new dbConnection(); x.openConnection(); x.ExecuteSQL("UPDATE Strafkatalog SET Vergehen='" + vergehen + "',Typ=" + typ + ",Punkte=" + punkte + ",Geld='" + money + "' WHERE id=" + id); x.closeConnection(); notification.Show("Bearbeitet!", AlertType.info); } else { dbConnection x = new dbConnection(); x.openConnection(); x.ExecuteSQL("INSERT INTO Strafkatalog (Vergehen,Typ,Punkte,Geld) VALUES ('" + vergehen + "'," + typ + "," + punkte + ",'" + money + "')"); x.closeConnection(); //MessageBox.Show("Hinzugefügt!"); notification.Show("Hinzugefügt!", AlertType.info); } }
private void button1_Click(object sender, EventArgs e) { if (!textBox1.Text.Contains('_')) { MessageBox.Show("Gib deinen Namen mit Unterstrich ein!"); return; } if (textBox2.Text == "") { MessageBox.Show("Gib deinen API-Key ein"); return; } string name = textBox1.Text; string key = textBox2.Text; string hwid = GetMachineGuid(); dbConnection con = new dbConnection(); con.openConnection(); string api = ""; string id = ""; var reader = con.readerSQL("SELECT apikey,id FROM User WHERE username='******'"); while (reader.Read()) { if (reader[0] != null) { api = reader[0].ToString(); } id = reader[1].ToString(); } reader.Close(); if (api == "" || api != key) { MessageBox.Show("API-Key falsch!"); return; } con.ExecuteSQL("UPDATE User SET hwid='" + GetMachineGuid() + "' WHERE id='" + id + "'"); con.closeConnection(); RegistryKey reg = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\LSMC-DienstApp"); reg.SetValue("Name", name); reg.SetValue("ID", id); reg.SetValue("API", key); reg.Close(); MessageBox.Show("Erfolgreich eingetragen! \n Bitte starte das Programm neu!"); Application.Exit(); }
private void button1_Click(object sender, EventArgs e) { string datum = monthCalendar1.SelectionStart.ToShortDateString(); string time = dateTimePicker1.Value.ToShortTimeString(); string termin = datum + " - " + time; string prüfer = Form1.username; dbConnection x = new dbConnection(); x.openConnection(); x.ExecuteSQL("UPDATE AusbildungsTermine SET status=1,prüfer='" + Form1.username + "',termin='" + termin + "' WHERE id='" + id + "'"); x.closeConnection(); notification.Show("Terminvorschlag abgeschickt! (" + termin + ")", AlertType.success); this.DialogResult = DialogResult.OK; }
private void BtnUseradd_Click(object sender, EventArgs e) { // Name realistisch angegegben, dann gehts weiter if (check_username(Txtmembername.Text)) { if (Txtforumname.Text != "") { int userid; if (int.TryParse(Txtuserid.Text, out userid)) { int phonenumber; if (int.TryParse(Txtphonenumber.Text, out phonenumber)) { dbConnection dbabfrage = new dbConnection(); dbabfrage.openConnection(); var abfrage = dbabfrage.readerSQL("SELECT Count(*) FROM User WHERE `id`= '" + userid + "'"); abfrage.Read(); if (abfrage[0].ToString() != "0") { MessageBox.Show("User existiert bereits!"); } else { var api_key = Generate_api(); dbConnection insertquery = new dbConnection(); insertquery.openConnection(); insertquery.ExecuteSQL("INSERT INTO User (apikey, id, username, forumname, beitritt, telefon, rang, email, abteilung) VALUES ('" + api_key + "', '" + userid + "', '" + Txtmembername.Text + "', '" + Txtforumname.Text + "', NOW(), '" + phonenumber + "', '0', NULL, NULL)"); insertquery.closeConnection(); MessageBox.Show("Generierter API Key: " + api_key); Clipboard.SetText(api_key); MessageBox.Show("Ausgabe: " + abfrage[0]); } dbabfrage.closeConnection(); } else { MessageBox.Show("Die Eingabe der Telefonnummer ist keine Zahl!"); } } else { MessageBox.Show("Die Eingabe der Userid ist keine Zahl!"); } } else { MessageBox.Show("Kein Forumsname angegeben!"); } } // Benötigt keine else da in der Funktion der else Teil ist. }
private void Insert_Mitarbeiter() { dbConnection abfragemitarbeiter = new dbConnection(); abfragemitarbeiter.openConnection(); var res = abfragemitarbeiter.readerSQL("SELECT username FROM User ORDER BY rang DESC"); while (res.Read()) { comboBox1.Items.Add(res[0].ToString()); } abfragemitarbeiter.closeConnection(); }
public Verwaltung_Manage() { InitializeComponent(); jetzt = DateTime.Now; RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\LSMC-DienstApp"); db1.openConnection(); var result = db1.readerSQL("SELECT rang FROM User WHERE apikey = '" + key.GetValue("API") + "'"); result.Read(); Brang = Convert.ToInt32(result[0]); db1.closeConnection(); }