Example #1
0
        private void buttonDangKy_Click(object sender, EventArgs e)
        {
            string username = textBoxUsername.Text.TrimEnd();
            string pass     = textBoxPassword.Text.Trim();
            string confirm  = textBoxConfirm.Text.TrimEnd();
            string maNV     = textBoxEmail.Text.Trim();

            bool check   = database.Check(username, "SELECT Username FROM dbo.TaiKhoan");
            bool checkNV = database.Check(maNV, "SELECT MaNV FROM dbo.HoSoNV");
            bool checkTK = database.Check(maNV, "SELECT SDT_Email FROM dbo.TaiKhoan");

            if (username.Length != 0 && pass.Length != 0 && confirm.Length != 0 && maNV.Length != 0)
            {
                if (check == false)
                {
                    if (confirm == pass)
                    {
                        if (checkNV == true)
                        {
                            if (checkTK == false)
                            {
                                string insert = "INSERT INTO dbo.TaiKhoan VALUES  ( '" + username + "' ,'" + pass + "' ,N'" + maNV + "' ,1)";
                                database.ThucThiKetNoi(insert);
                                DialogResult result;
                                result = MessageBox.Show("Bạn muốn đăng nhập ngay không?", "Đăng Ký Thành Công", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                                if (result == System.Windows.Forms.DialogResult.Yes)
                                {
                                    FormLOGIN lg = new FormLOGIN();
                                    lg.Show();
                                    this.Hide();
                                }
                            }
                            else
                            {
                                MessageBox.Show("Bạn " + maNV + " đã được cấp tài khoản, không thể đăng ký!", "", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                            }
                        }
                        else
                        {
                            MessageBox.Show("Bạn chưa được xác nhận là nhân viên của chúng tôi!", "", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Nhập lại mật khẩu không đúng!", "", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    }
                }
                else
                {
                    //labelThongBao.Text = "Tài khoản đã tồn tại! Vui lòng thử lại!";
                    MessageBox.Show("Username đã tồn tại!", "", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
            }
            else
            {
                MessageBox.Show("Vui lòng điền đầy đủ các trường!", "", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            DialogResult ret = MessageBox.Show("Bạn muốn hủy bỏ đăng ký?", "Đăng ký chưa hoàn tất",
                                               MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (ret == DialogResult.Yes)

            {
                FormLOGIN lg = new FormLOGIN();
                lg.Show();
                this.Hide();
            }
        }
Example #3
0
        private void buttonDangXuat_Click(object sender, EventArgs e)
        {
            DialogResult ret = MessageBox.Show("Bạn muốn đăng xuất không, " + user + "!", "",
                                               MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (ret == DialogResult.Yes)

            {
                UI.FormLOGIN lg = new UI.FormLOGIN();
                lg.Show();
                this.Hide();
            }
        }
Example #4
0
        /// <summary>
        /// ///////////////
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void ToolStripMenuItemDN_Click(object sender, EventArgs e)
        {
            UI.FormLOGIN lg = new UI.FormLOGIN()
            {
                Dock = DockStyle.Fill, TopLevel = false, TopMost = true
            };
            lg.FormBorderStyle = FormBorderStyle.None;
            this.panelShow.Controls.Add(lg);
            foreach (Control ctrl in panelShow.Controls)
            {
                if (ctrl != lg)
                {
                    ctrl.Dispose();
                }
            }
            lg.Show();

            //FormDangNhap dangNhap = new FormDangNhap();
            //dangNhap.Show();
        }
Example #5
0
 private void buttonExit_Click(object sender, EventArgs e)
 {
     UI.FormLOGIN lg = new FormLOGIN();
     lg.Show();
     this.Hide();
 }