Beispiel #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            main m = new main();

            m.Show();
            this.Hide();
        }
        private void button3_Click(object sender, EventArgs e)
        {
            this.Close();
            main m = new main();

            m.Show();
        }
Beispiel #3
0
        private void back_Click(object sender, EventArgs e)// return to main
        {
            var myForm = new main();

            myForm.Show();
            this.Hide();
        }
Beispiel #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection Con = new SqlConnection(@"Data Source=DESKTOP-85FCCNA\MINU; Integrated Security=true; Initial Catalog=event_management");

            Con.Open();
            if (textBox1.Text != "" && textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "" && textBox5.Text != "" && textBox6.Text != "" && textBox7.Text != "" && textBox8.Text != "" && textBox9.Text != "" && textBox10.Text != "")
            {
                SqlCommand cmd6 = new SqlCommand(@"insert into reg values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','" + textBox9.Text + "','" + textBox10.Text + "')", Con);
                int        x    = cmd6.ExecuteNonQuery();
                if (x > 0)
                {
                    MessageBox.Show("Registered Successfully");
                    main m = new main();
                    m.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Not Registered");
                }
            }

            else
            {
                MessageBox.Show("Please fill all the details");
            }
        }
Beispiel #5
0
        private void label1_Click_1(object sender, EventArgs e)
        {
            count += 1;
            main newMain = new main();

            newMain.Show();
            newMain.Text = "New Window";
        }
Beispiel #6
0
        private void butLogin_Click(object sender, EventArgs e)
        {
            bool M_bl_yn = false;

            if (textName.Text == string.Empty || textPass.Text == string.Empty)
            {
                MessageBox.Show("账号或密码不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
            }
            else
            {
                #region 数据库连接
                string        contsql = "Server=DESKTOP-RGQI6KB;Database=RSGL;uid=sa;pwd=123456";
                SqlConnection mysql   = new SqlConnection(contsql);
                mysql.Open();
                SqlCommand    mycmd = new SqlCommand("SELECT * FROM zhanghao ", mysql);
                SqlDataReader sqldr = mycmd.ExecuteReader();
                #endregion
                #region 账号判断
                while (sqldr.Read())
                {
                    string M_str_sql_pwd  = sqldr["e_password"].ToString();
                    string M_str_sql_user = sqldr["e_username"].ToString();
                    if (M_str_sql_user == textName.Text.Trim())
                    {
                        if (this.textName.Text.Trim() == M_str_sql_user && this.textPass.Text.Trim() == M_str_sql_pwd)
                        {
                            main login = new main();
                            login.Show();
                            this.FormClosing -= new System.Windows.Forms.FormClosingEventHandler(this.login_FormClosing);
                            this.Hide();
                            M_bl_yn = true;
                            break;
                        }
                    }
                }
                if (M_bl_yn == false)
                {
                    MessageBox.Show("账号或密码错误,请重新输入!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }



                #endregion
            }
            SqlConnection lo_conn = new SqlConnection("Server=DESKTOP-RGQI6KB;Database=RSGL;uid=sa;pwd=123456");
            lo_conn.Open();
            SqlCommand    lo_cmd    = new SqlCommand("select * from zhanghao where e_username = "******"'" + textName.Text + "'", lo_conn);
            SqlDataReader lo_reader = lo_cmd.ExecuteReader();

            if (lo_reader.HasRows)
            {
                while (lo_reader.Read())
                {
                    temp.e_num = Convert.ToString(lo_reader["e_number"]);
                }
            }
        }
Beispiel #7
0
        private void validate_Click(object sender, EventArgs e)//Validate our users creds
        {
            string U1     = (User1.UN);
            string U2     = (User2.UN);
            string U1P    = (User1.PW);
            string U2P    = (User2.PW);
            int    logged = 0;
            int    log;

            log = logged;
            string Check1;
            string Check2;

            Check1 = userName.Text;
            Check2 = password.Text;
            // working for now.. still want this cleaned into seperate functions
            // starting to move in some of these admin checks, need to add superusers still
            if (Check1 == @U1 && Check2 == @U1P)
            {
                try { auths.IsAdmin = 1; }
                finally
                {
                    var myForm = new main();
                    myForm.Show();
                    this.Hide();
                    log = 1;
                }
            }
            //if (Check1 == @U2 && Check2 == @U2P)
            if ((auths.IsAdmin) == (0) && (Check1 == @U2 && Check2 == @U2P))
            {
                try
                {
                    var myForm = new main();
                    myForm.Show();
                    this.Hide();
                }
                finally
                {
                    log = 1;
                }
            }
            if (log == 0)
            {
                MessageBox.Show("Invalid username or password.", "Login Error.");
            }
        }
Beispiel #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection Con = new SqlConnection(@"Data Source=DESKTOP-85FCCNA\MINU; Integrated Security=true; Initial Catalog=event_management");

            Con.Open();
            SqlCommand    cmd = new SqlCommand("Select * from reg WHERE uname='" + textBox1.Text + "' and pass='******' ", Con);
            SqlDataReader dr  = cmd.ExecuteReader();

            //String a = textBox1.Text;
            //String b = textBox2.Text;
            if (dr.HasRows)
            {
                MessageBox.Show("Success");
                main m = new main();
                m.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Failed");
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            // for login
            con.Open();
            string sqe = "SELECT count(*) FROM login where username = '******' AND password = '******'";

            sda = new SqlDataAdapter(sqe, con);
            dt  = new DataTable();
            sda.Fill(dt);

            textBox2.Text = "";

            if (dt.Rows[0][0].ToString() == "1")
            {
                main m = new main();
                m.Show();
            }
            else
            {
                MessageBox.Show("Please Correct the username and password\n\tor\nChoose another account.", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            con.Close();
        }
Beispiel #10
0
        /*******************登录功能******************************************/
        private void loginBtn_Click(object sender, EventArgs e)
        {
            string account = userName.Text;
            string psw     = passWord.Text;

            if (account != "" && psw != "")
            {
                string res = ValidateUser.validateUser(account, psw);
                if (res == "密码正确")
                {
                    main m = new main();
                    m.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show(res);
                }
            }
            else
            {
                MessageBox.Show("请输入用户名/密码");
            }
        }