private void btnThayDoiGiaDV_Click(object sender, EventArgs e) { float giamoi; float.TryParse(txbGiaMoi.Text, out giamoi); if (txbmk.Text == "") { MessageBox.Show("Lỗi", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (giamoi != 0) { if (XuLyDAL.ktKhopMK(this.Text, txbmk.Text)) { DichVuDAL.thayDoiGiaDV(giamoi); MessageBox.Show("Thay đổi giá dịch vụ thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txbGiaMoi.Text = ""; txbmk.Text = ""; } else { MessageBox.Show("Mật khẩu không đúng !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Lỗi", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnThongKe_Click(object sender, EventArgs e) { lsvThongKe.Clear(); string[] str = XuLyDAL.thongKe().Split(','); lsvThongKe.Columns.Add("Doanh thu ngày"); lsvThongKe.Columns.Add("Danh thu tháng"); lsvThongKe.Columns.Add("Doanh thu năm"); ListViewItem item = new ListViewItem(); item.Text = str[0] + " đồng"; item.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = str[1] + " đồng" }); item.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = str[2] + " đồng" }); lsvThongKe.Items.Add(item); }
private void btnDoiMK_Click(object sender, EventArgs e) { TaiKhoan tk = TaiKhoanDAL.layTaiKhoan(this.Text); if (tk.MatKhau.Trim() != XuLyDAL.maHoaMK(txbMKhienTai.Text)) { MessageBox.Show("Mật khẩu hiện tại không đúng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (!XuLyDAL.ktMatKhauHopLe(txbMKmoi1.Text)) { MessageBox.Show(" Mật khẩu không hợp lệ \n ( Mật khẩu phải có ít nhất 8 kí tự, phải bao gồm cả chữ và số)", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (txbMKmoi1.Text != txbMKmoi2.Text) { MessageBox.Show("Mật khẩu mới nhập lại không khớp", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } XuLyDAL.doiMatKhau(this.Text, txbMKmoi1.Text); MessageBox.Show("Đổi mật khẩu thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); }
private void btnDoiMK_Click(object sender, EventArgs e) { if (txbMKhienTai.Text == "" || txbMKmoi.Text == "" || txbMKnhapLai.Text == "") { MessageBox.Show("Lỗi", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string str = XuLuTK_BUS.doiMK(this.Text, txbMKhienTai.Text, txbMKmoi.Text, txbMKnhapLai.Text); if (str == "kkmk") { MessageBox.Show("Mật khẩu hiện tại không đúng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (str == "mkKhongHopLe") { MessageBox.Show("Mật khẩu mới không hợp lệ !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (str == "KhacMKnhapLai") { MessageBox.Show("Mật khẩu nhập lại không khớp !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { XuLyDAL.doiMatKhau(this.Text, txbMKmoi.Text); txbMKhienTai.Text = ""; txbMKmoi.Text = ""; txbMKnhapLai.Text = ""; MessageBox.Show("Đổi mật khẩu thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public static bool suaThongTin(string tentk, string mk) { if (!XuLyDAL.ktMatKhauHopLe(mk)) { return(false); } return(true); }
public static bool themTien(string tentk, float soTienThem) { if (soTienThem > 0) { XuLyDAL.themTien(tentk, soTienThem); return(true); } return(false); }
private void btnThoat_Click(object sender, EventArgs e) { if (DialogResult.Yes == MessageBox.Show("Bạn có muốn thoát ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { float tgConLai = XuLyDAL.chuyenChuoiSangFLoat(txbTGconLai.Text); float tgSuDung = XuLyDAL.chuyenChuoiSangFLoat(txbTGsuDung.Text); TaiKhoanDAL.upDate_Exit(this.Text, tgConLai, tgSuDung); this.Close(); } }
private void frmKhachHang_Load(object sender, EventArgs e) { TaiKhoan tk = TaiKhoanDAL.layTaiKhoan(this.Text); txbGiaDV.Text = DichVuDAL.layGiaDV().ToString() + " đồng/h"; TimeSpan tongTG = LayTimeSpan(tk.TongTG.Value); TimeSpan tgConLai = LayTimeSpan(tk.TGconLai.Value); txbTGconLai.Text = XuLyDAL.chuyenTimeSpanVeString(tgConLai); txbTGsuDung.Text = "00:00:00"; txbTongTG.Text = XuLyDAL.chuyenTimeSpanVeString(tongTG); }
public static string doiMK(string tentk, string mkCu, string mkMoi, string mkNhapLai) { if (!XuLyDAL.ktKhopMK(tentk, mkCu)) { return("kkmk"); } else if (!XuLyDAL.ktMatKhauHopLe(mkMoi)) { return("mkKhongHopLe"); } else if (mkMoi != mkNhapLai) { return("KhacMKnhapLai"); } return("ok"); }
private void timerBamGio_Tick(object sender, EventArgs e) { TimeSpan timetick = DateTime.Now - timeStart; if (tf == 0) { khh = LayTimeSpan(TaiKhoanDAL.layTaiKhoan(this.Text).TGconLai.Value); } tf = 1; TimeSpan tmp = new TimeSpan(0, 0, 1); khh -= tmp; txbTGsuDung.Text = XuLyDAL.chuyenTimeSpanVeString(timetick); txbTGconLai.Text = XuLyDAL.chuyenTimeSpanVeString(khh); }
public static bool dangNhap(string tentk, string mk) { if (mk == "") { return(false); } TaiKhoan tk = XuLyDAL.dangNhap(tentk, mk); if (tk == null) { return(false); } else if (tk.TenTK.Trim() != tentk || tk.MatKhau.Trim() != mk) { return(false); } tk.TrangThai = true; return(true); }
private void btnDangNhap_Click(object sender, EventArgs e) { if (txbMatKhau.Text == "" || txbTenTK.Text == "") { MessageBox.Show("Tên đăng nhập hoặc mật khẩu không đúng", "Thống báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string tentk = txbTenTK.Text; string matKhau = XuLyDAL.maHoaMK(txbMatKhau.Text); if (XuLuTK_BUS.dangNhap(tentk, matKhau)) { this.Dispose(false); if (tentk == "admin") { frmAdmin n = new frmAdmin(); n.Text = tentk; n.Show(); } else { frmKhachHang n = new frmKhachHang(); n.Text = tentk; n.Show(); } } else { txbTenTK.Text = ""; txbMatKhau.Text = ""; MessageBox.Show("Tên đăng nhập hoặc mật khẩu không đúng", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void btnThucHien_Click(object sender, EventArgs e) { if (yeuCau == "XOA") { if (txbTenTK.Text == "admin") { MessageBox.Show("Bạn không thể xóa tài khoản quản lý!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { if (XuLuTK_BUS.xoaTK(txbTenTK.Text) == false) { MessageBox.Show("Tài khoản không tồn tại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else if (XuLuTK_BUS.xoaTK(txbTenTK.Text)) { if (DialogResult.Yes == MessageBox.Show("Bạn có muốn xóa tài khoản này ?", "Chú ý", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { XuLyDAL.xoaTK(txbTenTK.Text); //trangThaiBanDau(); MessageBox.Show("Đã xóa thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); trangThaiTextBoxBanDau(); trangThaiBanDau(); } } } } else if (yeuCau == "THEM_TK") { if (txbTenTK.Text == "") { MessageBox.Show("Tên tài khoản không được bỏ trống !", "Chú ý !", MessageBoxButtons.OK, MessageBoxIcon.Information); //btnThemTK_Click(sender, e); return; } else if (txbMatKhau.Text == "") { MessageBox.Show("Mật khẩu không được bỏ trống !", "Chú ý!", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (!XuLuTK_BUS.themTK(txbTenTK.Text)) { MessageBox.Show("Tên tài khoản đã tồn tại !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { if (XuLyDAL.ktMatKhauHopLe(txbMatKhau.Text)) { float tienThem = 0; if (txbSoTienThem.Text.Replace(" ", string.Empty) != "") { tienThem = float.Parse(txbSoTienThem.Text.Replace(" ", string.Empty)); } if (txbSDT.Text.Trim() != "") { if (txbSDT.Text.Replace(" ", string.Empty).Length != 10) { MessageBox.Show("Số điện thoại không hợp lệ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } //if(txbSDT.Text) if (txbEmail.Text != "") { if (!TaiKhoanDAL.ktEmailHopLe(txbEmail.Text)) { MessageBox.Show("Email không hợp lệ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } XuLyDAL.themTK(txbTenTK.Text, /*XuLyDAL.maHoaMK(txbMatKhau.Text)*/ txbMatKhau.Text, tienThem); XuLyDAL.themThongTin(txbTenTK.Text, txbSDT.Text.Replace(" ", string.Empty), txbEmail.Text); MessageBox.Show("Tài khoản đã được thêm !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); trangThaiTextBoxBanDau(); trangThaiBanDau(); } else { MessageBox.Show(" Mật khẩu không hợp lệ \n ( Mật khẩu phải có ít nhất 8 kí tự, phải bao gồm cả chữ và số)", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } else if (yeuCau == "CHINH_SUA") { if (XuLuTK_BUS.suaThongTin(txbTenTK.Text, txbMatKhau.Text)) { float tienThem = 0; if (txbSoTienThem.Text.Replace(" ", string.Empty) != "") { tienThem = float.Parse(txbSoTienThem.Text.Replace(" ", string.Empty)); } if (txbSDT.Text.Trim() != "") { if (txbSDT.Text.Replace(" ", string.Empty).Length != 10) { MessageBox.Show("Số điện thoại không hợp lệ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } //if(txbSDT.Text) if (txbEmail.Text != "") { if (!TaiKhoanDAL.ktEmailHopLe(txbEmail.Text)) { MessageBox.Show("Email không hợp lệ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } XuLyDAL.suaThongTin(txbTenTK.Text, txbMatKhau.Text, txbSDT.Text.Replace(" ", string.Empty), txbEmail.Text, tienThem); MessageBox.Show("Chỉnh sữa hoàn tất !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); trangThaiTextBoxBanDau(); trangThaiBanDau(); } else { MessageBox.Show("Mật khẩu không hợp lệ !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } else if (yeuCau == "THEM_TIEN") { float tienThem = 0; if (txbSoTienThem.Text.Replace(" ", string.Empty) != "") { tienThem = float.Parse(txbSoTienThem.Text.Replace(" ", string.Empty)); XuLyDAL.themTien(txbTenTK.Text, tienThem); trangThaiBanDau(); trangThaiTextBoxBanDau(); MessageBox.Show("Nạp tiền thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } yeuCau = ""; lsvShow.Clear(); showData(); }