示例#1
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.login_form = ((Lab08.Authoriz)(target));
                return;

            case 2:
                this.button_login = ((System.Windows.Controls.Button)(target));

            #line 14 "..\..\MainWindow.xaml"
                this.button_login.Click += new System.Windows.RoutedEventHandler(this.login_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.button_reg = ((System.Windows.Controls.Button)(target));

            #line 18 "..\..\MainWindow.xaml"
                this.button_reg.Click += new System.Windows.RoutedEventHandler(this.reg_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.textboxLogin = ((System.Windows.Controls.TextBox)(target));

            #line 20 "..\..\MainWindow.xaml"
                this.textboxLogin.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.textboxLogin_TextChanged);

            #line default
            #line hidden
                return;

            case 5:
                this.passwordbox_password = ((System.Windows.Controls.TextBox)(target));
                return;

            case 6:
                this.label_attention = ((System.Windows.Controls.Label)(target));
                return;
            }
            this._contentLoaded = true;
        }
示例#2
0
        private void button_Registration_Click(object sender, EventArgs e)
        {
            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                try
                {
                    string sql = "exec Register @Users=N'" + textbox_Login.Text + "',@Password=N'" + passwordbox_Password.Text.GetHashCode().ToString() + "',@Role=N'" + "User" + "',@Balancez=N'" + 0 + "'";
                    conn.Open();
                    SqlCommand command2 = new SqlCommand(sql, conn);
                    command2.CommandText = "exec selectUser @Username=N'" + textbox_Login.Text + "'";
                    if (command2.ExecuteScalar() == null)
                    {
                        SqlCommand cmd = new SqlCommand(sql, conn);


                        cmd.ExecuteNonQuery();
                        MessageBox.Show("New Client was successfully added!", "");
                        Authoriz form = new Authoriz();
                        form.Show();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Пользователь с таким именем уже зарегстрирован");
                        return;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);// Лучше обработать все возможные исключения
                }
                finally
                {
                    conn.Close();
                }
            }
        }
示例#3
0
        private void Admin1_Closed(object sender, EventArgs e)
        {
            Authoriz form = new Authoriz();

            form.Show();
        }