Esempio n. 1
0
        public void login()
        {
            button2.Enabled  = false;
            button1.Enabled  = false;
            textBox1.Enabled = false;
            textBox2.Enabled = false;
            SqlClass SqlFucntion = new SqlClass();

            if (SqlFucntion.checkUserLogin(textBox1.Text, textBox2.Text))
            {
                MessageBox.Show("เข้าสู่ระบบสำเร็จ", "ดำเนินการสำเร็จ");
                userInformation userInfo = new userInformation();
                userInfo.Username = textBox1.Text;
                userInfo.loadInfo();
                userInfo.Show();
                button2.Enabled  = true;
                button1.Enabled  = true;
                textBox1.Enabled = true;
                textBox2.Enabled = true;
                this.Hide();
            }
            else
            {
                MessageBox.Show("เข้าสู่ระบบล้มเหลว", "ดำเนินการล้มเหลว");
                button2.Enabled  = true;
                button1.Enabled  = true;
                textBox1.Enabled = true;
                textBox2.Enabled = true;
            }
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlClass SqlFucntion = new SqlClass();

            if (SqlFucntion.userChangePassword(UID, textBox1.Text, textBox2.Text))
            {
                MessageBox.Show("เปลี่ยนรหัสผ่านสำเร็จ", "ดำเนินการสำเร็จ");
                loadInfo();
                textBox2.Text = textBox1.Text = "";
            }
            else
            {
                MessageBox.Show("เปลี่ยนรหัสผ่านไม่สำเร็จ", "ดำเนินการล้มเหลว");
            }
        }
Esempio n. 3
0
        public void loadInfo()
        {
            SqlClass      SqlFucntion    = new SqlClass();
            SqlDataReader UserDataReader = SqlFucntion.getUserInfo(Username);

            UID          = UserDataReader["UID"].ToString();
            FirstName    = UserDataReader["FirstName"].ToString();
            LastName     = UserDataReader["LastName"].ToString();
            RegisterDate = UserDataReader["RegisterDate"].ToString();

            label1.Text = "Username: "******"User ID: " + UID;
            label3.Text = "FirstName: " + FirstName;
            label4.Text = "LastName: " + LastName;
            label5.Text = "RegisterDate: " + RegisterDate;
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlClass SqlFucntion = new SqlClass();

            if (SqlFucntion.addUserToDatabse(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text))
            {
                MessageBox.Show("เพิ่มข้อมูลสำเร็จ", "ดำเนินการสำเร็จ");
                Form1 loginForm = new Form1();
                loginForm.textBox1.Text = textBox1.Text;
                loginForm.textBox2.Text = textBox2.Text;
                loginForm.login();
                this.Hide();
            }
            else
            {
                MessageBox.Show("เพิ่มข้อมูลล้มเหลว", "ดำเนินการล้มเหลว");
            }
        }