예제 #1
0
        private void Button_Users_Click(object sender, RoutedEventArgs e)
        {
            UserDesc a = new UserDesc(Con);

            a.Owner = this;
            this.Hide();
            a.Show();
        }
예제 #2
0
        private void Exit_Click(object sender, RoutedEventArgs e)
        {
            UserDesc a = new UserDesc(conn);

            a.Owner = this.Owner.Owner;
            this.Owner.Close();
            a.Show();
            this.Hide();
        }
예제 #3
0
        private void ButtonLogIn_Click(object sender, RoutedEventArgs e)
        {
            string sqlExpression = "dbo.p_addlogin";
            object result        = null;
            string name_user     = USurname.Text + ' ' + UName.Text;

            SqlCommand command = new SqlCommand(sqlExpression, conn);

            command.CommandType = System.Data.CommandType.StoredProcedure;
            SqlParameter loginParam = new SqlParameter
            {
                ParameterName = "@loginame",
                Value         = NULogin.Text
            };

            command.Parameters.Add(loginParam);
            SqlParameter userParam = new SqlParameter
            {
                ParameterName = "@name",
                Value         = name_user
            };

            try
            {
                result = command.ExecuteScalar();
            }
            catch (Exception er)
            {
                Console.WriteLine("Error: " + er.Message);
                Err a = new Err(er.Message);
                a.Show();
            }

            Console.WriteLine("Add user " + NULogin + " with name " + name_user + ". ID = " + result + '\n');

            UserDesc ret = new UserDesc(conn);

            ret.Owner = this.Owner.Owner;
            this.Owner.Close();
            ret.Show();
            this.Hide();
        }