Ejemplo n.º 1
0
        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");
            }
        }
Ejemplo n.º 2
0
        private void Confirm_Click(object sender, RoutedEventArgs e)
        {
            FileAdapter.SaveNewRule(baseName, rule);
            BaseEditor baseEditor = new BaseEditor(baseName);

            baseEditor.Show();
            this.Close();
        }
Ejemplo n.º 3
0
        private void Confirm_Click(object sender, RoutedEventArgs e)
        {
            DeleteRule();
            BaseEditor baseEditor = new BaseEditor(baseName);

            baseEditor.Show();
            this.Close();
        }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
        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!");
            }
        }