private void LoginButton_Click(object sender, RoutedEventArgs e) { this.admins = FileAdapter.GetAllAdmins(); string loginStr = login.Text; string passStr = FileAdapter.ComputeSha256Hash(pass.Password); bool isLoginCorrect = false; string baseName = ""; foreach (Admin admin in admins) { if (admin.name == loginStr && admin.pass == passStr) { isLoginCorrect = true; baseName = admin.baseName; break; } } if (isLoginCorrect) { BaseEditor baseEditor = new BaseEditor(baseName); baseEditor.Show(); this.Close(); } else { MessageBox.Show("wpisałeś błędne hasło lub login", "Błąd logowania"); } }
private void Confirm_Click(object sender, RoutedEventArgs e) { FileAdapter.SaveNewRule(baseName, rule); BaseEditor baseEditor = new BaseEditor(baseName); baseEditor.Show(); this.Close(); }
private void Confirm_Click(object sender, RoutedEventArgs e) { DeleteRule(); BaseEditor baseEditor = new BaseEditor(baseName); baseEditor.Show(); this.Close(); }
private void AddCategoryButton_Click(object sender, RoutedEventArgs e) { if (isDecisionClass.IsChecked == true) { AddDianoseCategory(); } else { FileAdapter.AddNewCategoryToFile(baseName, CategoryTextBox.Text, Description.Text /*, CopyPhoto(filePath)*/); FileAdapter.UpdateRules(baseName, CategoryTextBox.Text); } BaseEditor baseEditor = new BaseEditor(baseName); baseEditor.Show(); this.Close(); }
private void RegisterButton_Click(object sender, RoutedEventArgs e) { string hashPassword = FileAdapter.ComputeSha256Hash(PasswordBox.Password); Admin newAdmin = new Admin(LoginTextBox.Text, hashPassword, BaseNameTextBox.Text, PasswordHintTextBox.Text, BaseDescriptionTextBox.Text); if (!File.Exists("data\\" + newAdmin.baseName + ".bok")) { bool isUniqLogin = true; foreach (Admin adm in admins) { if (adm.name == newAdmin.name) { MessageBox.Show("Taki login jest już zajęty"); isUniqLogin = false; break; } } if (isUniqLogin && PassCheck()) { admins.Add(newAdmin); List <string> ListOfAdminsString = new List <string>(); foreach (Admin admin in admins) { ListOfAdminsString.Add(admin.ToCodedString()); } File.WriteAllLines("data\\admin.ame", ListOfAdminsString); CreateFiles(newAdmin); BaseEditor baseEditor = new BaseEditor(newAdmin.baseName); baseEditor.Show(); this.Close(); } else { MessageBox.Show("Hasła nie są poprawne"); } } else { MessageBox.Show("Baza już istnieje!"); } }