private void bt_thucthi_Click(object sender, EventArgs e) { if (txt_foldername.Text == "") { lb_loi.Text = "Hãy chọn đường dẫn."; } else { string url = txt_foldername.Text; if (BUS_hethong.restore(url, a)) { if (a == 0) { lb_loi.Text = "Phục hồi lưu thành công."; } else { lb_loi.Text = "Tạo cơ sở dữ liệu thành công"; reload(); this.Close(); } } else { if (a == 0) { lb_loi.Text = "Phục hồi thất bại, hãy kiểm tra đường dẫn."; } else { lb_loi.Text = "Tạo cơ sở dữ liệu thất bại"; } } } }
private void bt_xoa_Click(object sender, EventArgs e) { if (quyen > radio_Quyen.SelectedIndex) { if (ten == txt_tenTK.Text) { lb_loi.Text = "Bạn không thể xoá chính bạn"; } else if (MessageBox.Show("Bạn có muốn xóa tài khoản " + txt_tenTK.Text + " hay không?", "thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (BUS_hethong.deleteTaikhoan(txt_tenTK.Text) == "true") { lb_loi.Text = "Xóa tài khoản thành công."; loadfull(); } else { lb_loi.Text = "Lỗi từ hệ thống"; } } } else { lb_loi.Text = "Bạn không thể xóa tài khoản admin"; } }
public void Dangnhap() { DataTable dt = BUS_hethong.dangnhap(txtUser.Text, txtPass.Text); if (dt.Rows.Count > 0) { if (checkLuutaikhoanlogin.Checked == true) { BUS_hethong.setnhotaikhoan(txtUser.Text); } else { BUS_hethong.setnhotaikhoan(""); } frmMainForm frm = new frmMainForm(dt); frm.thoat = new frmMainForm.Thoat(thoat1); frm.Show(); Hide(); } else { lbCanhbao.Visible = true; image_canhbao.Visible = true; } }
private void bt_thucthi_Click(object sender, EventArgs e) { if (txt_foldername.Text == "") { lb_loi.Text = "Hãy chọn đường dẫn."; } else if (txt_name.Text == "") { lb_loi.Text = "Hãy nhập tên cơ sở dữ liệu cần lưu."; } else { string url = ""; string s = txt_foldername.Text; string c = s[2].ToString(); string b = s[s.Length - 1].ToString(); if (c != b) { s = s + c; } url = s + txt_name.Text + ".bak"; if (BUS_hethong.backup(url) == "true") { lb_loi.Text = "Sao lưu thành công."; } else { lb_loi.Text = "Sao lưu thất bại, hãy kiểm tra đường dẫn."; } } }
private void sua() { if (kiemtra()) { string q = radio_Quyen.SelectedIndex.ToString(); if (quyen == 2) { q = "2"; } if (BUS_hethong.updateTaikhoan(txt_hoten.Text, tencu, txt_tenTK.Text, txt_MK.Text, q) == "true") { lb_loi.Text = "Sửa tài khoản thành công."; loadfull(); } else { lb_loi.Text = "Tên tài khoản đã trùng."; } } }
private void loadfull() { grid_Taikhoan.DataSource = BUS_hethong.selectTaikhoan(); Binding(); EnableText(false); layoutmatkhau.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization; layoutxacnhanmk.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization; bt_them.Enabled = true; grid_Taikhoan.Enabled = true; bt_luu.Enabled = false; bt_restart.Enabled = false; lb_loi.Text = ""; if (grid_Taikhoan.MainView.RowCount > 0) { bt_sua.Enabled = bt_xoa.Enabled = true; } else { bt_sua.Enabled = bt_xoa.Enabled = false; txt_hoten.Text = txt_tenTK.Text = lb_quyen.Text = ""; } }
private void bt_luu_Click(object sender, EventArgs e) { if (flag1 == "1") { if (kiemtra()) { if (BUS_hethong.insertTaikhoan(txt_hoten.Text, txt_tenTK.Text, txt_MK.Text, radio_Quyen.SelectedIndex.ToString()) == "true") { lb_loi.Text = "Thêm tài khoản Thành công."; loadfull(); } else { lb_loi.Text = "Tên tài khoản đã tồn tại."; } } } else { sua(); } }
private void frmlogin_Load(object sender, EventArgs e) { if (!BUS_hethong.KT_ketnoi()) { frmRestore frm = new frmRestore(1); frm.reload = new frmRestore.Reload(hien); frm.Show(); this.WindowState = FormWindowState.Minimized; } else { txtUser.Text = BUS_hethong.nhoTaikhoan(); if (txtUser.Text == "") { checkLuutaikhoanlogin.Checked = false; } else { checkLuutaikhoanlogin.Checked = true; } } }