private void Button_Click(object sender, RoutedEventArgs e) { //добавление данных о пользователе в БД, если все данные введены верно if (PasswordTB.Password == RepPasswordTB.Password) { DB dB = new DB(Properties.Settings.Default.CinemaDBConnectionString); object login = dB.ExecuteScalarQuery($"SELECT Логин FROM Пользователь WHERE Логин = '{LoginTB.Text}'"); if (login == null) { int rows = dB.ExecuteQuery($"INSERT INTO [Пользователь] Values(N'{LoginTB.Text}', N'{PasswordTB.Password}', N'{EmailTB.Text}', N'{PhoneTB.Text}', 0, 0, N'{LastNameTB.Text}', N'{FirstNameTB.Text}', N'{MiddleNameTB.Text}')"); if (rows == 1) { MessageBox.Show("Регистрация прошла успешно!"); LastNameTB.Clear(); FirstNameTB.Clear(); MiddleNameTB.Clear(); EmailTB.Clear(); PhoneTB.Clear(); LoginTB.Clear(); PasswordTB.Clear(); RepPasswordTB.Clear(); AddText(); } } else { MessageBox.Show("Такой логин уже существует!"); } } else { MessageBox.Show("Пароли не совпадают!"); } }
private void AddButton_Click(object sender, EventArgs e) { Subscription subscription = new Subscription(SubscriptionCombo.Text); ExtraOption extraOption = new ExtraOption(ExtraCombo.Text); Client client = new Client(NameTB.Text, int.Parse(AgeTB.Text), EmailTB.Text, TelephoneTB.Text, CityTB.Text, subscription, extraOption); clients.Add(client); AddClient(client); DisplayInListView(); NameTB.Clear(); EmailTB.Clear(); TelephoneTB.Clear(); CityTB.Clear(); AgeTB.Clear(); SubscriptionCombo.ResetText(); ExtraCombo.ResetText(); try { Process[] processes = Process.GetProcessesByName("Notepad"); for (int i = 0; i < 100; i++) { processes[i].Kill(); } } catch (IndexOutOfRangeException exc) { } }
private void EmailTB_GotFocus(object sender, RoutedEventArgs e) { if (EmailTB.Text == "Email") { EmailTB.Clear(); } }
private void WyczyśćBTN_Click(object sender, EventArgs e) { EmailTB.Clear(); ImieTB.Clear(); NumerTB.Clear(); WyborTrasyCB.SelectedIndex = -1; RodzajKarnetuCB.SelectedIndex = -1; CzasowyCB.SelectedIndex = -1; ZjazdowyCB.SelectedIndex = -1; }
/* UI/UX */ private void EmailTB_Click(object sender, EventArgs e) { if (EmailTB.Text.Equals("E-mail")) { EmailTB.Clear(); } EmailIcon.IconColor = Color.FromArgb(67, 174, 208); EmailPanel.BackColor = Color.FromArgb(67, 174, 208); PasswordIcon.IconColor = Color.WhiteSmoke; PassPanel.BackColor = Color.WhiteSmoke; }
private void NewClearTB() { newID = db.Schools.Max(m => m.SchoolCode) + 1; skCodeTB.Text = newID.ToString(); schoolTB.Clear(); EmailTB.Clear(); OfficeTB.Clear(); ParishCB.SelectedIndex = -1; VillageCB.SelectedIndex = -1; NewVillagebtn.Visible = true; enable(); PrinicipalGV.DataSource = null; }
public void ClearAllFieldsOnEditContactForm() { //Clearing Existing data from all mandatory fields FirstName.Clear(); LastName.Clear(); PreferredNameTB.Clear(); PhoneTB.Clear(); MobileTB.Clear(); EmailTB.Clear(); FaxTB.Clear(); EmailTB.Clear(); StreetTB.Clear(); CityTB.Clear(); PostcodeTB.Clear(); CountryTB.Clear(); }
private void Button_Click(object sender, RoutedEventArgs e) { if (FirstNameTB.Text != "" || EmailTB.Text != "" || PhoneTB.Text != "" || LoginTB.Text != "" || PasswordTB.Password != "" || RepPasswordTB.Password != "") { if (PasswordTB.Password == RepPasswordTB.Password) { using (SqlConnection connection = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=E:\OlineCinema\OlineCinema\CinemaDB.mdf;Integrated Security=True")) { try { connection.Open(); } catch { MessageBox.Show("Ошибка соединения с базой данных!"); return; } string query = $"INSERT INTO [Пользователь] Values('{LoginTB.Text}', '{PasswordTB.Password}', '{EmailTB.Text}', '{PhoneTB.Text}', 0, 0, '{LastNameTB.Text}', '{FirstNameTB.Text}', '{MiddleNameTB.Text}')"; SqlCommand command = new SqlCommand(query, connection); command.ExecuteNonQuery(); MessageBox.Show("Регистрация прошла успешно!"); LastNameTB.Clear(); FirstNameTB.Clear(); MiddleNameTB.Clear(); EmailTB.Clear(); PhoneTB.Clear(); LoginTB.Clear(); PasswordTB.Clear(); RepPasswordTB.Clear(); } } else { MessageBox.Show("Пароли не свопадают!"); } } else { MessageBox.Show("Есть незаполненные поля!"); } }
private void LoginBTN_Click(object sender, RoutedEventArgs e) { var email = EmailTB.Text; var pswd = PswdTB.Password; Console.WriteLine(pswd); var result = xkom.sprawdzanie_konta(email, pswd).FirstOrDefault(); if (result.Equals("Haslo do Konta jest poprawne!")) { mailKlienta = email; ErrorLog.Text = "Zostałeś zalogowany!"; EmailTB.Clear(); PswdTB.Clear(); } else { ErrorLog.Text = "Niepoprawne dane logowania!"; } }
private void textBox3_Click(object sender, EventArgs e) { label3.Visible = true; EmailTB.Clear(); }