Ejemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "" && textBox2.Text != "")
     {
         string login     = textBox1.Text;
         string password  = textBox2.Text;
         var    srv       = new ServiceReference1.Service1Client();
         User   userlogin = (User)srv.CheckUser(login, password);
         App    appForm   = new App(userlogin);
         appForm.Show();
         Hide();
         //MessageBox.Show(userlogin.Username.ToString());
     }
 }
Ejemplo n.º 2
0
        //private bool isAll = false;

        //по кнопке идет проверка всех полей
        private void button1_Click(object sender, EventArgs e)
        {
            RegisterFormCheck formCheck = new RegisterFormCheck();

            if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "" && textBox5.Text != "" && textBox6.Text != "")
            {
                bool isFill = true;
                formCheck.username = textBox1.Text;
                formCheck.fio      = textBox2.Text;
                formCheck.passport = textBox3.Text;
                formCheck.card     = textBox4.Text;
                formCheck.birthday = Convert.ToDateTime(dateTimePicker1.Value.ToShortDateString());
                formCheck.pass     = textBox5.Text;
                formCheck.confPass = textBox6.Text;

                bool[] formCorrect = formCheck.CheckForm();
                //MessageBox.Show(textBox6.Text);
                label7.Text  = formCorrect[0] ? "Все норм" : "Неправильно набран логин";
                label8.Text  = formCorrect[1] ? "Все норм" : "Неправильно набран fio";
                label9.Text  = formCorrect[2] ? "Все норм" : "Неправильно набран birthday";
                label10.Text = formCorrect[3] ? "Все норм" : "Неправильно набран passport";
                label11.Text = formCorrect[4] ? "Все норм" : "Неправильно набран card";
                label15.Text = formCorrect[5] ? "Все норм" : "Неправильно набран password";
                foreach (bool t in formCorrect)
                {
                    if (!t)
                    {
                        isFill = false;
                    }
                }
                if (isFill)
                {
                    User newUser = new User(formCheck.username, formCheck.fio, formCheck.birthday, formCheck.passport, formCheck.card, formCheck.pass);
                    var  srv     = new ServiceReference1.Service1Client();
                    srv.InsertIntoUser(newUser.Username, newUser.FIO, newUser.Birthday, newUser.Passport, newUser.Card, newUser.Password);
                    App appForm = new App(newUser);
                    appForm.Show();
                }
            }
            else
            {
                label6.Text = "проверьте заполнение полей";
            }
        }