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 btnCapNhat_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;
            //}
            if (txbEmail.Text != "")
            {
                if (!TaiKhoanDAL.ktEmailHopLe(txbEmail.Text))
                {
                    MessageBox.Show("Email không hợp lệ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            TaiKhoanDAL.capNhatThongTin(this.Text, txbSDT.Text.Replace(" ", string.Empty), txbEmail.Text);
            MessageBox.Show("Cập nhật thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);

            this.Close();
        }
Example #3
0
        public static string GetTenNguoiDung(string tenDangNhap)
        {
            foreach (DataRow row in TaiKhoanDAL.GetTenNguoiDung(tenDangNhap).Rows)
            {
                return(row["TenHienThi"].ToString());
            }

            return("");
        }
Example #4
0
        public static bool themTK(string tenTK)
        {
            TaiKhoan tk = TaiKhoanDAL.layTaiKhoan(tenTK);

            if (tk != null)
            {
                return(false);
            }
            return(true);
        }
        public IHttpActionResult Login([FromBody] TaiKhoanDTO taiKhoanDTO)
        {
            TaiKhoanDAL taiKhoanDAL = new TaiKhoanDAL();

            if (taiKhoanDAL.checkLogin(taiKhoanDTO, "CV1004"))
            {
                return(ResponseToOk(taiKhoanDTO));
            }
            return(ResponseToOk(null, "Không tìm thấy tên tài khoản hoặc mật khẩu", HttpStatusCode.BadRequest));
        }
Example #6
0
 public static DTO.TaiKhoanDTO SelectTaiKhoanByTenTaiKhoan(string tenTaiKhoan)
 {
     if (!TaiKhoanDAL.CheckTaiKhoanByTenTaiKhoan(tenTaiKhoan))
     {
         return(null);
     }
     else
     {
         return(TaiKhoanDAL.SelectTaiKhoanByTenTaiKhoan(tenTaiKhoan));
     }
 }
Example #7
0
        public bool LogIn(string ten, string mk)
        {
            TaiKhoan tkSoSanh = TaiKhoanDAL.GetInstance().Read(ten);

            if (tkSoSanh == null)
            {
                return(false);
            }

            return(mk == tkSoSanh.MatKhau);
        }
Example #8
0
        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();
            }
        }
        public IHttpActionResult updatePassWord([FromBody] TaiKhoanDTO taiKhoanDTO)
        {
            TaiKhoanDAL taiKhoanDAL = new TaiKhoanDAL();

            if (!taiKhoanDAL.updatePass(taiKhoanDTO))
            {
                return(ResponseToOk(null, "Nhập sai mật khẩu", HttpStatusCode.BadRequest));
            }
            else
            {
                return(ResponseToOk(taiKhoanDTO, "Đổi mật khẩu thành công", HttpStatusCode.OK));
            }
        }
        public void showData()
        {
            lsvShow.FullRowSelect = true;

            lsvShow.Columns.Add("TenTK");
            lsvShow.Columns.Add("SĐT");
            lsvShow.Columns.Add("Email");
            lsvShow.Columns.Add("Tổng TG");
            lsvShow.Columns.Add("TG còn lại");
            lsvShow.Columns.Add("Trạng Thái");

            List <TaiKhoan>   dsTaiKhoan = TaiKhoanDAL.layDsTaiKhoan();
            List <ThongTinTK> dsThongTin = ThongTinTK_DAL.laDsThongTin();

            for (int i = 0; i < dsTaiKhoan.Count; i++)
            {
                ListViewItem item = new ListViewItem();
                item.Text = dsTaiKhoan[i].TenTK.Trim();

                item.SubItems.Add(new ListViewItem.ListViewSubItem()
                {
                    Text = dsThongTin[i].SDT
                });
                item.SubItems.Add(new ListViewItem.ListViewSubItem()
                {
                    Text = dsThongTin[i].Email
                });

                item.SubItems.Add(new ListViewItem.ListViewSubItem()
                {
                    Text = dsTaiKhoan[i].TongTG.ToString() + " giờ"
                });
                item.SubItems.Add(new ListViewItem.ListViewSubItem()
                {
                    Text = dsTaiKhoan[i].TGconLai.ToString() + " giờ"
                });

                string trangThai = "Online";
                if (dsTaiKhoan[i].TrangThai == false)
                {
                    trangThai = "Ofline";
                }

                item.SubItems.Add(new ListViewItem.ListViewSubItem()
                {
                    Text = trangThai
                });
                lsvShow.Items.Add(item);
            }
        }
Example #11
0
        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);
        }
Example #12
0
        public static bool DangNhap(string TenDangNhap, string MatKhau)
        {
            TaiKhoanDAL tkDAL = new TaiKhoanDAL();

            var tk = tkDAL.Lay(TenDangNhap, MatKhau);

            // Neu khong tim thay
            if (tk == null)
            {
                return(false);
            }

            _tk = tk;
            return(true);
        }
        private void autocomplete(TextBox txbTenTK)
        {
            List <string> str = TaiKhoanDAL.layDsTenTK();

            txbTenTK.Enabled = true;

            txbTenTK.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            txbTenTK.AutoCompleteSource = AutoCompleteSource.CustomSource;

            var n = new AutoCompleteStringCollection();

            n.AddRange(str.ToArray());

            txbTenTK.AutoCompleteCustomSource = n;
        }
Example #14
0
        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);
        }
Example #15
0
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            TaiKhoanDAL db    = new TaiKhoanDAL();
            bool        hopLe = false;

            if (String.IsNullOrWhiteSpace(txtTenDangNhap.Text) || String.IsNullOrWhiteSpace(txtMatKhau.Text))
            {
                MessageBox.Show("Tên đăng nhập hoặc mật khẩu không được để trống hoặc khoảng trắng!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            hopLe = db.KiemTraDangNhap(txtTenDangNhap.Text, txtMatKhau.Text);
            if (hopLe)
            {
                frmMain frm = new frmMain(txtTenDangNhap.Text);
                this.Hide();
                frm.Show();
            }
            else
            {
                MessageBox.Show("Tên đăng nhập hoặc mật khẩu không hợp lệ!", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Example #16
0
        public int SuaTaiKhoan(TaiKhoan obj)
        {
            TaiKhoanDAL db = new TaiKhoanDAL();

            return(db.SuaTaiKhoan(obj));
        }
Example #17
0
        public int XoaTaiKhoan(string Email)
        {
            TaiKhoanDAL db = new TaiKhoanDAL();

            return(db.XoaTaiKhoan(Email));
        }
Example #18
0
        public static ObservableCollection <TaiKhoan> HienThiTatCa()
        {
            TaiKhoanDAL db = new TaiKhoanDAL();

            return(db.HienThiTatCa());
        }
Example #19
0
 public bool ExistInDatabase(string ma)
 {
     return(TaiKhoanDAL.GetInstance().Read(ma) != null);
 }
Example #20
0
 public TaiKhoan Read(string tenTk)
 {
     return(TaiKhoanDAL.GetInstance().Read(tenTk));
 }
Example #21
0
 public List <TaiKhoan> ReadAllByKeyWord(string key)
 {
     return(TaiKhoanDAL.GetInstance().ReadAllByKeyword(key));
 }
Example #22
0
 public TaiKhoanBUS()
 {
     this.TaiKhoanDAL = new TaiKhoanDAL();
 }
Example #23
0
 public bool Update(TaiKhoan cd)
 {
     return(TaiKhoanDAL.GetInstance().Update(cd));
 }
Example #24
0
 public bool Add(TaiKhoan cd)
 {
     return(TaiKhoanDAL.GetInstance().Add(cd));
 }
Example #25
0
        public static ObservableCollection <TaiKhoan> HienThiTaiKhoan(string Email)
        {
            TaiKhoanDAL db = new TaiKhoanDAL();

            return(db.HienThiTaiKhoan(Email));
        }
        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();
        }
Example #27
0
        public static ObservableCollection <TaiKhoan> KiemTraDangNhap(string Email, string Password)
        {
            TaiKhoanDAL db = new TaiKhoanDAL();

            return(db.KiemTraDangNhap(Email, Password));
        }
        public IHttpActionResult getthongtinphuxe(string tentaikhoan)
        {
            TaiKhoanDAL taiKhoanDAL = new TaiKhoanDAL();

            return(ResponseToOk(taiKhoanDAL.GetThongTinPhuXe(tentaikhoan, "CV1004")));
        }
Example #29
0
 public TaiKhoanBUS()
 {
     TaiKhoanDAL = new TaiKhoanDAL();
 }
Example #30
0
 public bool Delete(TaiKhoan cd)
 {
     return(TaiKhoanDAL.GetInstance().Delete(cd));
 }