示例#1
0
        private void btnReg_Click(object sender, RoutedEventArgs e)
        {
            if (txtLog.Text == "")
            {
                MessageBox.Show("Введите логин");
                return;
            }
            if (txtName.Text == "")
            {
                MessageBox.Show("Введите имя");
                return;
            }
            if (txtNumber.Text == "")
            {
                MessageBox.Show("Введите номер ");
                return;
            }
            if (txtPass.Password == "")
            {
                MessageBox.Show("Введите пароль");
                return;
            }
            if (CbGender.SelectedIndex == -1)
            {
                MessageBox.Show("Выберите гендер ");
                return;
            }
            if (Captch.Text == txtCaptch.Text)
            {
                var user = Ent.Context.Users.ToList().
                           Where(p => p.Login == txtLog.Text).FirstOrDefault();

                if (user != null)
                {
                    MessageBox.Show("Логин занят");
                }
                else
                {
                    Ent.Context.Users.Add(new Users
                    {
                        LName    = txtName.Text,
                        IdGender = CbGender.SelectedIndex + 1,
                        IdRole   = 1,
                        Login    = txtLog.Text,
                        Password = txtPass.Password,
                        Phone    = txtNumber.Text,
                    }

                                          );
                    MessageBox.Show("Регистрация прошла успешна");
                    Ent.Context.SaveChanges();
                }
            }

            else
            {
                MessageBox.Show("Неправильная капча");
                Captch.Text = Capthacs.Capcha();
            }
        }
示例#2
0
        public RegistrWindow()
        {
            InitializeComponent();

            CbGender.ItemsSource       = Ent.Context.Gender.ToList();
            CbGender.DisplayMemberPath = "Gender1";

            Paths.PathUsers  = @"Accounts\Users.txt";
            Paths.Pathsignup = @"Accounts\signup.txt";

            Captch.Text = Capthacs.Capcha();
        }
示例#3
0
 private void btnCapth_Click(object sender, RoutedEventArgs e)
 {
     Captch.Text = Capthacs.Capcha();
 }