Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            DangNhapWeb DNW;

            DNW = new DangNhapWeb();
            string s = textBox1.Text;
            string a = textBox2.Text;

            textBox1.Text = DNW.ChuanHoa(s);
            textBox2.Text = DNW.ChuanHoa(a);

            KiemTraDangKy Kiemtra = new KiemTraDangKy();
            DangNhapWeb   KT1     = new DangNhapWeb();
            bool          KT      = Kiemtra.KiemTraDangKi(textBox1.Text, textBox2.Text);
            int           KQ      = KT1.KiemTraTK(textBox1.Text);

            if (textBox1.Text != "" && textBox2.Text != "" && KT == true && SDT.Text != "" && Email.Text != "" && DiaChi.Text != "" && HoTen.Text != "" && KQ == 0 && SDT.Text.Length == 10)
            {
                DangKy   Dk = new DangKy();
                DangNhap DN;
                DN           = new DangNhap();
                DN.DangNhap1 = textBox1.Text;
                DN.MatKhau   = textBox2.Text;
                Dk.ThemKH(HoTen.Text, DiaChi.Text, NgaySinh.Value.Date, Email.Text, SDT.Text);
                DN.MaKhachHang = TT.LayMaKH(HoTen.Text, SDT.Text);
                Dk.DangKyTK(DN);
                MessageBox.Show(" Dang Ky Thanh Cong");
                this.Hide();
                Form1 f = new Form1();
                f.ShowDialog();
                this.Close();
            }
            else if (SDT.Text == "" | Email.Text == "" | DiaChi.Text == "" | HoTen.Text == "" | textBox1.Text == "" | textBox2.Text == "")
            {
                MessageBox.Show(" Vui long dien vao tat ca thong tin");
            }
            else if (SDT.Text.Length < 10 | SDT.Text.Length > 10)
            {
                MessageBox.Show("SDT phai la 10 so");
            }

            else if (KT == false)
            {
                MessageBox.Show(" Mat Khau khong hop le phai co 1 chu hoa va 1 chu thuong va 1 chu so va co 8 ki tu tro len ");
            }
            else if (KQ == 1)
            {
                MessageBox.Show(" ten TK bi trung moi nhap Ten TK khac");
            }
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            DangNhapWeb DN;

            DN = new DangNhapWeb();
            string s = txtdangnhap.Text;
            string a = txtmatkhau.Text;

            txtdangnhap.Text = DN.ChuanHoa(s);
            txtmatkhau.Text  = DN.ChuanHoa(a);

            if (txtdangnhap.Text == "" || txtmatkhau.Text == "")
            {
                MessageBox.Show("ten dang nhap hoac mat khau khong duoc de trong");
            }
            else
            {
                int kq = DN.KiemTraDN(txtdangnhap.Text.ToString(), txtmatkhau.Text.ToString());

                if (kq == 1)
                {
                    MessageBox.Show(" dang nhap thanh cong");
                    this.Hide();
                    //Form1 f = new Form1();

                    //f.ShowDialog();

                    //this.Close();
                }
                else if (kq == 2)
                {
                    MessageBox.Show(" sai ten dang nhap ");
                }
                else if (kq == 3)
                {
                    MessageBox.Show(" sai mat khau");
                }
                else
                {
                    MessageBox.Show(" sai ten dang nhap va mat khau ");
                }
            }
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            DangNhapWeb DN;

            DN = new DangNhapWeb();
            string s = txtdangnhap.Text;
            string a = txtmatkhau.Text;

            txtdangnhap.Text = DN.ChuanHoa(s);
            string DN1 = txtdangnhap.Text;

            txtmatkhau.Text = DN.ChuanHoa(a);


            if (txtdangnhap.Text == "" || txtmatkhau.Text == "")
            {
                MessageBox.Show("ten dang nhap hoac mat khau khong duoc de trong");
            }

            else if (DN1.ElementAt(0).ToString() == "N" && DN1.ElementAt(1).ToString() == "V")
            {
                int kq = DN.DangNhapNV(txtdangnhap.Text.ToString(), txtmatkhau.Text.ToString());

                if (kq == 1)
                {
                    MessageBox.Show(" dang nhap thanh cong");
                    this.Hide();
                    Menu MN = new Menu();
                    MN.MaNV = 1;
                    MN.ShowDialog();
                }
                else if (kq == 2)
                {
                    MessageBox.Show(" sai ten dang nhap hoac mat khau sai ");
                }
                else if (kq == 3)
                {
                    MessageBox.Show("  sai ten dang nhap hoac mat khau sai");
                }
                else
                {
                    MessageBox.Show(" sai ten dang nhap hoac mat khau sai ");
                }
            }
            else
            {
                int kq = DN.KiemTraDN(txtdangnhap.Text.ToString(), txtmatkhau.Text.ToString());

                if (kq == 1)
                {
                    MessageBox.Show(" dang nhap thanh cong");
                    this.Hide();
                    Menu MN = new Menu();
                    MN.MaNV = 0;
                    MN.ShowDialog();
                }
                else if (kq == 2)
                {
                    MessageBox.Show(" sai ten dang nhap hoac mat khau sai ");
                }
                else if (kq == 3)
                {
                    MessageBox.Show("  sai ten dang nhap hoac mat khau sai");
                }
                else
                {
                    MessageBox.Show(" sai ten dang nhap hoac mat khau sai ");
                }
            }
        }