public void fillCombo(ComboBox combo, string inf) { string sqlDa = ""; DBhandling dbcmd = new DBhandling(); List <string> subjects = new List <string>(); switch (inf) { case "emne": sqlDa = "SELECT enme_Name FROM Emner;"; subjects = dbcmd.readDBNumUn(sqlDa, "enme_Name"); break; case "genre": sqlDa = "SELECT genre_Name FROM Genre;"; subjects = dbcmd.readDBNumUn(sqlDa, "genre_Name"); break; case "type": sqlDa = "SELECT type_Name FROM MedieType;"; subjects = dbcmd.readDBNumUn(sqlDa, "type_Name"); break; case "postnr": sqlDa = "SELECT postNr_ID, city FROM PostnummerBy;"; subjects = dbcmd.readDBNumUn(sqlDa, "postNr_ID"); break; } foreach (string s in subjects) { combo.Items.Add(s); } }
public void fillEmner() { DBhandling dbcmd = new DBhandling(); List <string> emner = new List <string>(); string sqlDa = "SELECT enme_Name FROM Emner;"; emner = dbcmd.readDBNumUn(sqlDa, "enme_Name"); combo_SeekType.Items.Add("Søg i alle"); foreach (string s in emner) { combo_SeekType.Items.Add(s); } }
private void btn_Login_Click(object sender, RoutedEventArgs e) { HashAndSalt hSalt = new HashAndSalt(); DBhandling dbcmd = new DBhandling(); int userName; string userPass = ""; string salt, hashedpassword, mere; string mereud; if (int.TryParse(box_BrugerName.Text, out userName)) { if (box_Password.Text != "") { mereud = dbcmd.returnFromSPLoginTjeck(userName); salt = hSalt.CreateSalt(10); hashedpassword = hSalt.GenerateSHA256Hash(userPass, salt); mere = hSalt.GenerateSHA256Hash(mereud, salt); if (hashedpassword == mere) { MessageBox.Show("You were correct"); } else { MessageBox.Show("Wrong Wrong Wrong"); } } else { MessageBox.Show("You must write your password"); return; } } else { MessageBox.Show("There is only numbers in the login"); return; } box_Reveal2.Text = mere; box_Reveal.Text = hashedpassword; }