private void buttonEncode_Click(object sender, EventArgs e) { var selectedAlg = comboBoxAlgorithmus.SelectedIndex; ICrypto base64 = new Base64(); ICrypto encrypter = new Rijndael(); ICrypto rot13 = new Rot13(); if (entered == 1) { if (selectedAlg == 0) { string encodedText = rot13.Encode(DecodedTextBox.Text); CodedTextBox.Clear(); CodedTextBox.Text = encodedText; } if (selectedAlg == 1) { string encodedText = base64.Encode(DecodedTextBox.Text); CodedTextBox.Clear(); CodedTextBox.Text = encodedText; } if (selectedAlg == 2) { string encodedText = encrypter.Encode(DecodedTextBox.Text); CodedTextBox.Clear(); CodedTextBox.Text = encodedText; } } else { MessageBox.Show("Es ist kein Algorithmus ausgewählt", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btEnter_Click(object sender, EventArgs e) { string login = tbLogin.Text.ToString(); string password = tbPassword.Text.ToString(); Table_Class tableClass = new Table_Class($"SELECT dbo.Auth ('{login}','{password}')"); if (tableClass.table.Rows[0][0] != DBNull.Value) { Table_Class isSotrClass = new Table_Class($"SELECT ID_Sotrudnika, Name_Sotrudnika, Midlle_Name_Sotrudnika, Last_Name_Sotrudnika FROM [dbo].[Sotrudniki] WHERE [Sotrudnika_Login] = '{login}'"); Program.intID = isSotrClass.table.Rows[0][0].ToString(); FIO(isSotrClass.table.Rows[0][1].ToString(), isSotrClass.table.Rows[0][2].ToString(), isSotrClass.table.Rows[0][3].ToString()); string Acess = tableClass.table.Rows[0][0].ToString(); sot = Acess[0].ToString(); dol = Acess[1].ToString(); pokup = Acess[2].ToString(); usl = Acess[3].ToString(); tovar = Acess[4].ToString(); tovn = Acess[5].ToString(); trann = Acess[6].ToString(); dog = Acess[7].ToString(); string _pass = "******"; Rijndael cipher = new Rijndael(); string result = cipher.Encode(Acess.Trim(), _pass.Trim(), 256, true); RegistryKey registry = Registry.CurrentUser; RegistryKey key = registry.CreateSubKey("Nevagno"); key.SetValue("result", result); MainPage mainPage = new MainPage(); mainPage.Show(); this.Visible = false; this.ShowInTaskbar = false; } else { MessageBox.Show("Не правильно введен логин или пароль!!!", "ИНЖПРОМТОРГ", MessageBoxButtons.OK, MessageBoxIcon.Warning); tbPassword.Text = ""; } }