コード例 #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (surname.Text != CheckViolator.CheckViolatorSurname(surname.Text))
            {
                System.Windows.MessageBox.Show(CheckViolator.CheckViolatorSurname(surname.Text));
                return;
            }

            if (name.Text != CheckViolator.CheckViolatorName(name.Text))
            {
                System.Windows.MessageBox.Show(CheckViolator.CheckViolatorName(name.Text));
                return;
            }

            if (patronymic.Text != CheckViolator.CheckViolatorPatronymic(patronymic.Text))
            {
                System.Windows.MessageBox.Show(CheckViolator.CheckViolatorPatronymic(patronymic.Text));
                return;
            }

            if (pasportNumber.Text != CheckViolator.CheckViolatorPasportNumber(pasportNumber.Text))
            {
                System.Windows.MessageBox.Show(CheckViolator.CheckViolatorPasportNumber(pasportNumber.Text));
                return;
            }

            StreamWriter pasportStreamWriter = new StreamWriter("ViolatorPasportNumber.txt");

            pasportStreamWriter.Write(pasportNumber.Text);
            pasportStreamWriter.Close();

            StreamWriter nameStreamWriter = new StreamWriter("ViolatorName.txt");

            nameStreamWriter.Write(name.Text);
            nameStreamWriter.Close();

            StreamWriter surnameStreamWriter = new StreamWriter("ViolatorSurname.txt");

            surnameStreamWriter.Write(surname.Text);
            surnameStreamWriter.Close();

            StreamWriter patronymicStreamWriter = new StreamWriter("ViolatorPatronymic.txt");

            patronymicStreamWriter.Write(patronymic.Text);
            patronymicStreamWriter.Close();

            ShowViolatorViolations showViolatorViolations = new ShowViolatorViolations();

            showViolatorViolations.Show();
            this.Close();
        }
コード例 #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (pasportNumber.Text != CheckViolator.CheckViolatorPasportNumber(pasportNumber.Text))
            {
                System.Windows.MessageBox.Show(CheckViolator.CheckViolatorPasportNumber(pasportNumber.Text));
                return;
            }
            StreamWriter streamWriter = new StreamWriter("ViolatorPasportNumber.txt");

            streamWriter.Write(pasportNumber.Text);
            streamWriter.Close();
            ShowViolatorViolations showViolatorViolations = new ShowViolatorViolations();

            showViolatorViolations.Show();
            this.Close();
        }