コード例 #1
0
ファイル: F_DangNhap.cs プロジェクト: taoqn/PMQLDD
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            try
            {
                if (String.IsNullOrEmpty(textEdit_tenDangNhap.Text) || String.IsNullOrEmpty(textEdit_matKhau.Text))
                {
                    DevExpress.XtraEditors.XtraMessageBox.Show("Vui Lòng Nhập Đầy Đủ Thông Tin !");
                    return;
                }
                SQLConnect sql = (SQLConnect)SQL_con_object;
                string     s   = "SELECT * FROM Taikhoan WHERE (TenDangNhap='" + textEdit_tenDangNhap.Text + "') AND (MatKhau='" + sql.StringToMD5(textEdit_matKhau.Text) + "')";
                if (String.IsNullOrEmpty(sql.GetData(s, 0)))
                {
                    DevExpress.XtraEditors.XtraMessageBox.Show("Username và Password không đúng !", "Cảnh Báo");
                    return;
                }
                if (checkEdit_luu.Checked)
                {
                    Registry.SetValue(RegistryDocMIS, "Login_Check", "true");
                    Registry.SetValue(RegistryDocMIS, "Login_Username", textEdit_tenDangNhap.Text);
                    Registry.SetValue(RegistryDocMIS, "Login_Password", textEdit_matKhau.Text);
                }
                else
                {
                    Registry.SetValue(RegistryDocMIS, "Login_Check", "false");
                }

                NguoiDung person = new NguoiDung(sql.GetData(s, 0), sql.GetData(s, 1), sql.GetData(s, 2), sql.GetData(s, 3), sql.GetData(s, 4), sql.GetData(s, 5), sql.GetData(s, 6), int.Parse(sql.GetData(s, 7)), sql.GetData(s, 8));
                person_object = (NguoiDung)person;

                s = "INSERT INTO Taikhoan_Lichsu VALUES (" + person.MaID + ",'" + DateTime.Now + "',NULL,N'" + sql.GetLocalIPAddress() + "',0)";
                sql.ExecuteData(s);

                form_Main = new F_Main(this);
                form_Main.Show();
                khay_HeThong.Visible = true;
                khay_HeThong.ShowBalloonTip(10);
                this.Hide();
            }
            catch
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa kết nối CSDL !", "Cảnh Báo");
                form_DangNhap_CauHinh = new F_DangNhap_CauHinh();
                form_DangNhap_CauHinh.Show();
            }
            Cursor = Cursors.Default;
        }
コード例 #2
0
ファイル: F_DangNhap.cs プロジェクト: taoqn/PMQLDD
 private void simpleButton2_Click(object sender, EventArgs e)
 {
     form_DangNhap_CauHinh = new F_DangNhap_CauHinh();
     form_DangNhap_CauHinh.Show();
 }