Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            BytebankDataBase DB = new BytebankDataBase();

            if (textBox1.Text == "")
            {
                label3.Visible = true;
                if (user.Language == 1)
                {
                    label3.Text = "Your message cannot be blank!";
                }
                else if (user.Language == 2)
                {
                    label3.Text = "Ваш месседж не может быть пустой!";
                }
                else if (user.Language == 3)
                {
                    label3.Text = "Ваш месседж не може бути пустим!";
                }
                else if (user.Language == 4)
                {
                    label3.Text = "Ihre Nachricht darf nicht leer sein!";
                }
                return;
            }
            label3.Visible = false;
            label3.Text    = "";
            Conv_UtoA Conversation = new Conv_UtoA {
                UserID = user.ID, AdminID = admin.ID, TextA = textBox1.Text
            };

            DB.Convs_UtoA.Add(Conversation);
            DB.SaveChanges();
            this.DialogResult = DialogResult.OK;
            return;
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            BytebankDataBase DB = new BytebankDataBase();

            if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "")
            {
                label7.Visible = true;
                if (langId == 1)
                {
                    label7.Text = "* Please fill all fields!";
                }
                if (langId == 2)
                {
                    label7.Text = "* Заполните все поля!";
                }
                if (langId == 3)
                {
                    label7.Text = "* Заповніть усі поля!";
                }
                if (langId == 4)
                {
                    label7.Text = "* Bitte alle felder ausfüllen!";
                }
                return;
            }
            else if (textBox4.Text != textBox5.Text)
            {
                label7.Visible = true;
                if (langId == 1)
                {
                    label7.Text = "* Passwords do not match!";
                }
                if (langId == 2)
                {
                    label7.Text = "* Пароли не совпадают!";
                }
                if (langId == 3)
                {
                    label7.Text = "* Паролі не збігаються!";
                }
                if (langId == 4)
                {
                    label7.Text = "* Passwörter stimmen nicht überein!";
                }
                return;
            }
            else if (textBox4.Text.Length < 6)
            {
                label7.Visible = true;
                if (langId == 1)
                {
                    label7.Text = "* Password is too short!";
                }
                if (langId == 2)
                {
                    label7.Text = "* Пароль слишком короткий!";
                }
                if (langId == 3)
                {
                    label7.Text = "* Пароль надто короткий!";
                }
                if (langId == 4)
                {
                    label7.Text = "* Das Passwort ist zu kurz!";
                }
                return;
            }
            foreach (Administrator admin in DB.Administration)
            {
                if (textBox3.Text == admin.Login)
                {
                    label7.Visible = true;
                    if (langId == 1)
                    {
                        label7.Text = "* This login is already using!";
                    }
                    if (langId == 2)
                    {
                        label7.Text = "* Этот логин уже используется!";
                    }
                    if (langId == 3)
                    {
                        label7.Text = "* Цей логін вже використовується!";
                    }
                    if (langId == 4)
                    {
                        label7.Text = "* Diese anmeldung verwendet bereits!";
                    }
                    return;
                }
            }
            label7.Visible = false;
            label7.Text    = "";
            FileStream    fs  = new FileStream(@"../../img/icons8-facepalm-filled-100.png", FileMode.Open, FileAccess.Read, FileShare.Read);
            Administrator reg = new Administrator {
                Name = textBox1.Text, Sirname = textBox2.Text, Login = textBox3.Text, Password = textBox4.Text, Language = langId, SecureID = textBox6.Text, Active = true, LastConnected = DateTime.Now
            };

            DB.Administration.Add(reg);
            DB.SaveChanges();
            this.DialogResult = DialogResult.OK;
            return;
        }
Пример #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (changeLang == true)
     {
         label4.Visible = false;
         label4.Text    = "";
         BytebankDataBase DB = new BytebankDataBase();
         if (radioButton5.Checked == true)
         {
             DB.Users.Find(loginUser.ID).Language = langID;
             DB.Users.Find(loginUser.ID).Active   = true;
             DB.SaveChanges();
             this.DialogResult = DialogResult.OK;
         }
         else if (radioButton6.Checked == true)
         {
             DB.Administration.Find(loginAdmin.ID).Language = langID;
             DB.Administration.Find(loginAdmin.ID).Active   = true;
             DB.SaveChanges();
             this.DialogResult = DialogResult.OK;
         }
     }
     else
     {
         if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" && radioButton6.Checked == true)
         {
             label4.Visible = true;
             if (radioButton1.Checked == true)
             {
                 label4.Text = "* Please fill all fields!";
             }
             else if (radioButton2.Checked == true)
             {
                 label4.Text = "* Заполните все поля!";
             }
             else if (radioButton3.Checked == true)
             {
                 label4.Text = "* Заповніть усі поля!";
             }
             else if (radioButton4.Checked == true)
             {
                 label4.Text = "* Bitte alle felder ausfüllen!";
             }
             return;
         }
         if (radioButton6.Checked == true && textBox3.Text.Length < 8 && textBox3.Text.Length > 0)
         {
             label4.Visible = true;
             if (radioButton1.Checked == true)
             {
                 label4.Text = "* SecureID field must contain 8 symbols!";
             }
             else if (radioButton2.Checked == true)
             {
                 label4.Text = "* Поле SecureID должно местить 8 символов!";
             }
             else if (radioButton3.Checked == true)
             {
                 label4.Text = "* Поле SecureID повинне містити 8 символів!";
             }
             else if (radioButton4.Checked == true)
             {
                 label4.Text = "* Das SecureID-feld muss 8 symbole enthalten!";
             }
             return;
         }
         else
         {
             label4.Visible = false;
             label4.Text    = "";
             BytebankDataBase DB = new BytebankDataBase();
             if (radioButton5.Checked == true)
             {
                 loginPerson = "User";
                 foreach (User user in DB.Users)
                 {
                     if (textBox1.Text == user.Login && textBox2.Text == user.Password)
                     {
                         personFound = true;
                         loginUser   = user;
                         if (user.Language == langID)
                         {
                             DB.Users.Find(loginUser.ID).Active = true;
                             this.DialogResult = DialogResult.OK;
                         }
                         else
                         {
                             changeLang     = true;
                             label4.Visible = true;
                             if (radioButton1.Checked == true)
                             {
                                 label4.Text  = "* Do you want to change your language?";
                                 button1.Text = "Yes";
                             }
                             else if (radioButton2.Checked == true)
                             {
                                 label4.Text  = "* Вы хотите изменить ваш язык?";
                                 button1.Text = "Да";
                             }
                             else if (radioButton3.Checked == true)
                             {
                                 label4.Text  = "* Ви хочете змінити вашу мову?";
                                 button1.Text = "Так";
                             }
                             else if (radioButton4.Checked == true)
                             {
                                 label4.Text  = "* Möchten sie ihre sprache ändern?";
                                 button1.Text = "Ja";
                             }
                         }
                         break;
                     }
                 }
                 if (personFound == false)
                 {
                     label4.Visible = true;
                     if (radioButton1.Checked == true)
                     {
                         label4.Text = "* Account not found!";
                     }
                     else if (radioButton2.Checked == true)
                     {
                         label4.Text = "* Аккаунт не найден!";
                     }
                     else if (radioButton3.Checked == true)
                     {
                         label4.Text = "* Аккаунт не знайдено!";
                     }
                     else if (radioButton4.Checked == true)
                     {
                         label4.Text = "* Konto nicht gefunden!";
                     }
                     return;
                 }
             }
             if (radioButton6.Checked == true)
             {
                 loginPerson = "Admin";
                 foreach (Administrator admin in DB.Administration)
                 {
                     if (textBox1.Text == admin.Login && textBox2.Text == admin.Password && textBox3.Text == admin.SecureID)
                     {
                         personFound = true;
                         loginAdmin  = admin;
                         if (admin.Language == langID)
                         {
                             DB.Users.Find(loginUser.ID).Active = true;
                             this.DialogResult = DialogResult.OK;
                         }
                         else
                         {
                             changeLang     = true;
                             label4.Visible = true;
                             if (radioButton1.Checked == true)
                             {
                                 label4.Text  = "* Do you want to change your language?";
                                 button1.Text = "Yes";
                             }
                             else if (radioButton2.Checked == true)
                             {
                                 label4.Text  = "* Вы хотите изменить ваш язык?";
                                 button1.Text = "Да";
                             }
                             else if (radioButton3.Checked == true)
                             {
                                 label4.Text  = "* Ви хочете змінити вашу мову?";
                                 button1.Text = "Так";
                             }
                             else if (radioButton4.Checked == true)
                             {
                                 label4.Text  = "* Möchten sie ihre sprache ändern?";
                                 button1.Text = "Ja";
                             }
                         }
                         break;
                     }
                     else if (textBox1.Text == admin.Login && textBox2.Text == admin.Password && textBox3.Text != admin.SecureID)
                     {
                         label4.Visible = true;
                         if (radioButton1.Checked == true)
                         {
                             label4.Text = "* Incorrect SecureID!";
                         }
                         else if (radioButton2.Checked == true)
                         {
                             label4.Text = "* Неверный SecureID!";
                         }
                         else if (radioButton3.Checked == true)
                         {
                             label4.Text = "* Неправильний SecureID!";
                         }
                         else if (radioButton4.Checked == true)
                         {
                             label4.Text = "* Ungültig SecureID!";
                         }
                         return;
                     }
                 }
                 if (personFound == false)
                 {
                     label4.Visible = true;
                     if (radioButton1.Checked == true)
                     {
                         label4.Text = "* Account not found!";
                     }
                     else if (radioButton2.Checked == true)
                     {
                         label4.Text = "* Аккаунт не найден!";
                     }
                     else if (radioButton3.Checked == true)
                     {
                         label4.Text = "* Аккаунт не знайдено!";
                     }
                     else if (radioButton4.Checked == true)
                     {
                         label4.Text = "* Konto nicht gefunden!";
                     }
                     return;
                 }
             }
         }
     }
 }