Ejemplo n.º 1
0
 public ActionResult ChinhsuaTK(TaiKhoanViewModel tk)
 {
     ViewBag.MaNV    = new SelectList(NhanVienQueries.LayDanhSachNhanVien(), "MaNV", "HoTen", tk.MaNV);
     ViewBag.MaQuyen = new SelectList(QuyenQueries.LayDanhSachQuyen(), "MaQuyen", "TenQuyen", tk.MaQuyen);
     TaiKhoanQueries.ChinhsuaTaiKhoan(tk);
     return(RedirectToAction("MenuDanhSachTaiKhoan", "TaiKhoan"));
 }
Ejemplo n.º 2
0
        public IActionResult AddAccountForEmployee(string emp_id, string account_name, string account_password)
        {
            NhanVien tmp = new NhanVien();

            tmp.MaNhanVien = int.Parse(emp_id);
            NhanVien          editNv        = db.NhanVien.Find(tmp.MaNhanVien);
            TaiKhoanViewModel query_account = new TaiKhoanViewModel(db);
            TaiKhoan          newAcc        = new TaiKhoan
            {
                TenTaiKhoan = account_name,
                MatKhau     = account_password,
                MaPhanQuyen = "nv",
                Email       = editNv.Email,
                AnhDaiDien  = editNv.HinhAnh
            };

            query_account.InsertTaiKhoan(newAcc);
            editNv.MaTaiKhoan = newAcc.MaTaiKhoan;//get last inserted id
            NhanVienViewModel query_employee = new NhanVienViewModel(db);

            query_employee.EditNhanVien(editNv);
            var response = query_employee.GetNhanVienById(emp_id);

            return(Json(response));
        }
Ejemplo n.º 3
0
        public IActionResult EditProfile(IFormFile img, string email, string id, string old_img)
        {
            TaiKhoan tmp    = db.TaiKhoan.SingleOrDefault(x => x.MaTaiKhoan == int.Parse(id));
            TaiKhoan editTk = new TaiKhoan
            {
                MaPhanQuyen = "kh",
                MaTaiKhoan  = int.Parse(id),
                Email       = email,
                TenTaiKhoan = tmp.TenTaiKhoan,
                MatKhau     = tmp.MatKhau
            };

            if (img != null)
            {
                string path_to_image = "wwwroot/uploads/employee/" + img.FileName;
                using (var stream = new FileStream(path_to_image, FileMode.Create))
                {
                    img.CopyTo(stream);
                }
                editTk.AnhDaiDien = img.FileName;
            }
            else
            {
                editTk.AnhDaiDien = old_img;
            }
            TaiKhoanViewModel query = new TaiKhoanViewModel(db);

            query.EditTaiKhoan(editTk);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 4
0
        public PartialViewResult InfoPartial()
        {
            TaiKhoanViewModel TaiKhoan = Session["TaiKhoan"] as TaiKhoanViewModel;
            var model = NhanVienQueries.LayThongTinChiTiet(TaiKhoan.MaNV);

            return(PartialView(model));
        }
Ejemplo n.º 5
0
        public IActionResult GetAccountById(string account_id)
        {
            TaiKhoanViewModel query = new TaiKhoanViewModel(db);
            var response            = query.GetTaiKhoanById(account_id);

            return(Json(response));
        }
Ejemplo n.º 6
0
        public ActionResult DoiMatKhau(TaiKhoanViewModel TaiKhoan, String MatKhauCu, String MatKhauMoi)
        {
            var model = TaiKhoanQueries.LayThongTinTaiKhoan(TaiKhoan.TaiKhoanNV);
            int i = 0, j = 0;
            var check = TaiKhoanQueries.Login(TaiKhoan.TaiKhoanNV, MatKhauCu);

            if (check == null)
            {
                ViewBag.MatKhauSai = "Mật khẩu không đúng";
                i++;
            }
            else
            {
                i = 0;
            }
            if (TaiKhoan.MatKhau != MatKhauMoi)
            {
                ViewBag.MatKhauTrung = "Mật khẩu không trùng";
                j++;
            }
            else
            {
                j = 0;
            }
            if (i == 0 && j == 0)
            {
                TaiKhoanQueries.DoiMatKhau(TaiKhoan);
                ViewBag.Success = "Đổi thành công!!";
            }
            return(View(model));
        }
Ejemplo n.º 7
0
        public static Boolean TaoTaiKhoan(TaiKhoanViewModel taiKhoan)
        {
            var entity = new QuanLyThueXeEntities();

            try
            {
                var check = entity.TaiKhoans.SingleOrDefault(n => n.TaiKhoanNV == taiKhoan.TaiKhoanNV);
                if (check != null)
                {
                    return(false);
                }
                TaiKhoan tk = new TaiKhoan();
                tk.MaNV       = taiKhoan.MaNV;
                tk.MaQuyen    = taiKhoan.MaQuyen;
                tk.TaiKhoanNV = taiKhoan.TaiKhoanNV;
                tk.MatKhau    = taiKhoan.MatKhau;
                tk.Online     = false;
                entity.TaiKhoans.Add(tk);
                entity.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                entity.Dispose();
                return(false);
            }
        }
Ejemplo n.º 8
0
        public JsonResult LayChiTietTaiKhoan(int id)
        {
            try
            {
                db.Configuration.ProxyCreationEnabled = false;

                var taiKhoan = db.tblNhanViens.Find(id);

                tblChucVu modelChucVu = db.tblChucVus.Where(x => x.ma_chuc_vu == taiKhoan.ma_chuc_vu).SingleOrDefault();

                TaiKhoanViewModel taiKhoanViewModel = new TaiKhoanViewModel();
                taiKhoanViewModel.ID          = taiKhoan.ma_nv;
                taiKhoanViewModel.HoTen       = taiKhoan.ho_ten;
                taiKhoanViewModel.DiaChi      = taiKhoan.dia_chi;
                taiKhoanViewModel.SoDienThoai = taiKhoan.sdt;
                taiKhoanViewModel.TenTaiKhoan = taiKhoan.tai_khoan;
                taiKhoanViewModel.Email       = taiKhoan.mail;
                taiKhoanViewModel.MatKhau     = taiKhoan.mat_khau;
                taiKhoanViewModel.ChucVu      = modelChucVu.chuc_vu;

                return(Json(new
                {
                    data = taiKhoanViewModel,
                    status = true
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception error)
            {
                return(Json(new { status = false, message = error.ToString() }, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 9
0
        public PartialViewResult SidebarPartial()
        {
            TaiKhoanViewModel TaiKhoan = Session["TaiKhoan"] as TaiKhoanViewModel;
            var LoaiController         = LoaiControllerQueries.LayDanhSachNghiepVu();

            ViewBag.LoaiAction = LoaiActionQueries.LayDanhSachActionTheoQuyen(TaiKhoan.MaQuyen);
            return(PartialView(LoaiController));
        }
Ejemplo n.º 10
0
        public ActionResult LockScreen()
        {
            TaiKhoanViewModel TaiKhoan = Session["TaiKhoan"] as TaiKhoanViewModel;

            ViewBag.TaiKhoanNV = TaiKhoan.TaiKhoanNV;
            var model = NhanVienQueries.LayThongTinChiTiet(TaiKhoan.MaNV);

            return(View(model));
        }
        public IActionResult UpdateEmployee(IFormFile emp_img, string emp_name,
                                            string emp_identity, string emp_email,
                                            string emp_position, string emp_salary,
                                            string emp_info, string old_emp_img,
                                            string emp_id, string acc_id)
        {
            NhanVien editEmployee = new NhanVien
            {
                MaNhanVien = int.Parse(emp_id),
                HoTen      = emp_name,
                MaChucVu   = int.Parse(emp_position),
                Luong      = float.Parse(emp_salary),
                Email      = emp_email,
                MoTa       = emp_info,
                Cmnd       = emp_identity
            };

            if (acc_id == "0")
            {
                editEmployee.MaTaiKhoan = null;
            }
            else
            {
                editEmployee.MaTaiKhoan = int.Parse(acc_id);
            }
            if (emp_img == null)
            {
                editEmployee.HinhAnh = old_emp_img;
            }
            else
            {
                string path_to_image = "wwwroot/uploads/employee/" + emp_img.FileName;
                using (var stream = new FileStream(path_to_image, FileMode.Create))
                {
                    emp_img.CopyTo(stream);
                }
                editEmployee.HinhAnh = emp_img.FileName;
            }
            NhanVien tmp = db.NhanVien.SingleOrDefault(x => x.MaNhanVien == int.Parse(emp_id));

            editEmployee.NgayBatDau = tmp.NgayBatDau;
            NhanVienViewModel query = new NhanVienViewModel(db);

            query.EditNhanVien(editEmployee);
            if (editEmployee.MaTaiKhoan != null)
            {
                TaiKhoan thisTaiKhoan = db.TaiKhoan.Where(x => x.MaTaiKhoan == editEmployee.MaTaiKhoan).SingleOrDefault();
                thisTaiKhoan.AnhDaiDien = editEmployee.HinhAnh;
                thisTaiKhoan.Email      = editEmployee.Email;
                TaiKhoanViewModel query_tk = new TaiKhoanViewModel(db);
                query_tk.EditTaiKhoan(thisTaiKhoan);
            }
            var response = query.GetDsNhanVien();

            return(Json(response));
        }
Ejemplo n.º 12
0
        private void btnUpdateTK_Click(object sender, EventArgs e)
        {
            var _nhanVien = new NhanVienViewModel()
            {
                MaNhanVien  = nhanVien.MaNhanVien,
                TenNhanVien = txtName.Text.ToString().Trim(),
                NgaySinh    = dtNgaySinh.Value,
                DiaChi      = txtDiaChi.Text.ToString(),
                Email       = txtEmail.Text.ToString(),
                GioiTinh    = true,
                NgayBatDau  = dtNgayBatDau.Value,
                SDT         = txtSDT.Text.ToString(),
                HinhAnh     = nhanVien.HinhAnh
            };

            if (cbNam.Checked == true)
            {
                _nhanVien.GioiTinh = true;
            }
            else
            {
                _nhanVien.GioiTinh = false;
            }

            //var _nhanVienOthen = requestData.GetNhanVienByMaNhanVien(taiKhoan.Id.ToString());
            if (txtMatKhauXacNhan.Text == taiKhoan.PassWord)
            {
                var _taiKhoan = new TaiKhoanViewModel()
                {
                    MaTaiKhoan  = taiKhoan.MaTaiKhoan,
                    MaNhanVien  = nhanVien.MaNhanVien,
                    MatKhau     = txtMatKhauMoi.Text.Trim(),
                    TenNhanVien = taiKhoan.Identity,
                    TenTaiKhoan = taiKhoan.UserName
                };
                var checkNhanVien = requestData.PutNhanVien(_nhanVien);
                var checkTaiKhoan = false;
                if (txtMatKhauMoi.Text != "")
                {
                    checkTaiKhoan = requestData.PutTaiKhoan(_taiKhoan, taiKhoan.Token);
                }
                if (checkNhanVien == true && checkTaiKhoan == true)
                {
                    MessageBox.Show("Done!");
                }
                else
                {
                    MessageBox.Show("!");
                }
            }
            else
            {
                MessageBox.Show("Mật khẩu xác nhận không chính xác!");
            }
        }
Ejemplo n.º 13
0
 private void taiKhoan(object sender, RoutedEventArgs e)
 {
     DataContext          = new TaiKhoanViewModel();
     TaiKhoan.Background  = Brushes.LightGreen;
     donhang.Background   = Brushes.ForestGreen;
     MonAn.Background     = Brushes.ForestGreen;
     loaimonan.Background = Brushes.ForestGreen;
     nhanvien.Background  = Brushes.ForestGreen;
     _HinhAnhAdmin        = LoadImage(UserService.GetCurrentUser.HINHANH);
     DoanhThu.Background  = Brushes.ForestGreen;
 }
Ejemplo n.º 14
0
        public TaiKhoanViewModel Register(TaiKhoanViewModel TaiKhoanVm, string s)
        {
            var taiKhoan = Mapper.Map <TaiKhoanViewModel, TaiKhoan>(TaiKhoanVm);
            var today    = DateTime.Today.ToShortDateString();

            taiKhoan.thoigiandk = today;

            int checkEmail = _repository.FindAllNoTracking().Where(x => x.email == TaiKhoanVm.email).Count();

            if (checkEmail > 0)
            {
                TaiKhoanVm.email = "";
            }
            int checkSdt = _repository.FindAllNoTracking().Where(x => x.sdt == TaiKhoanVm.sdt).Count();

            if (checkSdt > 0)
            {
                TaiKhoanVm.sdt = "";
            }
            if (checkEmail < 1 && checkSdt < 1)
            {
                if (TaiKhoanVm.UserType == Data.Enum.UserType.Customer)
                {
                    taiKhoan.KhachhangNavigation = new Khachhang();
                }
                if (TaiKhoanVm.UserType == Data.Enum.UserType.Merchant)
                {
                    taiKhoan.NccNavigation = new Ncc();
                }

                _repository.AddReturn(taiKhoan);
                taiKhoan.matk    = taiKhoan.KeyId;
                TaiKhoanVm.KeyId = taiKhoan.KeyId;



                ActiveCode newCode = new ActiveCode();
                newCode.KeyId      = 0;
                newCode.code       = s;
                newCode.CodeType   = Data.Enum.CodeType.Active;
                newCode.DateCreate = DateTime.Now;
                newCode.User_FK    = taiKhoan.KeyId;
                newCode.CodeStatus = Data.Enum.CodeStatus.UnActivated;
                _repositoryCode.Add(newCode);
            }


            //sanphamVm.Id = _convertFunction.Instance.Create_Code(true, sp.KeyId,
            //CommonConstants.defaultLengthNumberCode, const_AddressbookType.Employee);
            //sp.Id = HP_EmployeeVm.Id;
            //employee.UserBy.IsEmployee = true;

            return(TaiKhoanVm);
        }
Ejemplo n.º 15
0
        public ActionResult Index(TaiKhoanViewModel userViewModel)
        {
            var errorStr = "";
            var isError  = false;

            if (string.IsNullOrEmpty(userViewModel.Username))
            {
                errorStr += "<li>Tên truy cập không được trống</li>";
                isError   = true;
            }

            if (string.IsNullOrEmpty(userViewModel.Password))
            {
                errorStr += "<li>Mật khẩu không được trống</li>";
                isError   = true;
            }

            if (string.IsNullOrEmpty(userViewModel.Code))
            {
                errorStr += "<li>Mã xác thực không được trống</li>";
                isError   = true;
            }
            else if (Regex.Replace(userViewModel.Code.Trim(), @"\s+", "")
                     != Regex.Replace(userViewModel.CurentCode.Trim(), @"\s+", ""))
            {
                errorStr += "<ol>Mã xác thực không đúng<ol>";
                isError   = true;
            }

            if (isError)
            {
                ViewBag.ErrorMessage = $"<ol>{errorStr}</ol>";
                return(View(userViewModel));
            }
            db = new QRCodeEntities();
            var user = db.TaiKhoans.FirstOrDefault(n => n.Username == userViewModel.Username.Trim() && n.Password == userViewModel.Password);

            if (user != null && user.Username != null)
            {
                Session["PhanQuyen"] = new VaiTroController().VaiTroPhanQuyenStr(user.VaiTroId);
                Session["User"]      = !string.IsNullOrEmpty(user.Username) ? user.Username : "";
                return(RedirectToAction("Index", user.VaiTro.Menu.Ten));
            }

            ViewBag.ErrorMessage = $"<ol><li>Tên truy cập hoặc mật khẩu không đúng</li></ol>";

            return(View(userViewModel));
        }
Ejemplo n.º 16
0
        public JsonResult Register(TaiKhoanViewModel TaikhoanVm)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    IEnumerable <ModelError> allErrors = ModelState.Values.SelectMany(v => v.Errors);
                    return(Json(allErrors, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    var s = UtilityFunction.RandomString(6, false);
                    _userService.Register(TaikhoanVm, s);
                    if (TaikhoanVm.KeyId == 0)
                    {
                        if (TaikhoanVm.email == "")
                        {
                            return(Json(new { Result = const_Error.EXISTED_EMAIL, Status = "FAIL" }, JsonRequestBehavior.AllowGet));
                        }
                        if (TaikhoanVm.sdt == "")
                        {
                            return(Json(new { Result = const_Error.EXISTED_SDT, Status = "FAIL" }, JsonRequestBehavior.AllowGet));
                        }
                    }
                    else
                    {
                        string MailContent = System.IO.File.ReadAllText(Server.MapPath("/Models/template.html"));
                        MailContent = MailContent.Replace("{{Code}}", s);

                        new MailHelper().SendMail(TaikhoanVm.email, "Register Code", MailContent);
                        if (_userService.Save())
                        {
                            return(Json(new { Result = TaikhoanVm, Status = "OK" }, JsonRequestBehavior.AllowGet));
                        }
                    }
                }


                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                return(Json(new { Result = Response, Status = "FAIL" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                return(Json(new { Result = ex.Message, Status = "FAIL" }, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 17
0
        public static Boolean DoiMatKhau(TaiKhoanViewModel taiKhoan)
        {
            var entity = new QuanLyThueXeEntities();

            try
            {
                var result = entity.TaiKhoans.SingleOrDefault(n => n.TaiKhoanNV == taiKhoan.TaiKhoanNV);
                result.MatKhau = taiKhoan.MatKhau;
                entity.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                entity.Dispose();
                return(false);
            }
        }
Ejemplo n.º 18
0
        public ActionResult MenuTaoTaiKhoan(TaiKhoanViewModel taiKhoan)
        {
            var model = NhanVienQueries.LayDanhSachNhanVien();

            ViewBag.Quyen = QuyenQueries.LayDanhSachQuyen();
            if (!TaiKhoanQueries.TaoTaiKhoan(taiKhoan))
            {
                ViewBag.TrungTK   = "Tài khoản đã được sử dụng";
                ViewBag.ThanhCong = "Tạo tài khoản thất bại";
                return(View(model));
            }
            else
            {
                TaiKhoanQueries.TaoTaiKhoan(taiKhoan);
                ViewBag.ThanhCong = "Tạo tài khoản thành công";
                return(View(model));
            }
        }
Ejemplo n.º 19
0
        public ActionResult MenuThemHopDong(HopDongViewModel HD, CT_HopDongViewModel CTHD, KhachHangViewModel KH, TuyenDuongMoiViewModel tuyenDuongMoi, string LoaiXe, string strSoLuong, string strMaChiPhi, string strSoLuongCP, string iNgayLech = "1")
        {
            TaiKhoanViewModel taiKhoan = Session["TaiKhoan"] as TaiKhoanViewModel;

            HD.MaNV           = taiKhoan.MaNV;
            ViewBag.LoTrinh   = LoTrinhQueries.LayDanhSachLoTrinh();
            ViewBag.LoaiXe    = LoaiXeQueries.LayDanhSachLoaiXe();
            ViewBag.KhachHang = KhachHangQueries.DanhSachKhachHang();
            if (String.IsNullOrEmpty(LoaiXe))
            {
                var model = HopDongQueries.ThemHopDongTuyenDuongMoi(HD, CTHD, KH, tuyenDuongMoi);
            }
            else
            {
                var model = HopDongQueries.ThemHopDong(HD, CTHD, KH, LoaiXe, strSoLuong, strMaChiPhi, strSoLuongCP, iNgayLech);
            }
            return(RedirectToAction("MenuDanhSachHopDong", "HopDong"));
        }
Ejemplo n.º 20
0
        /// <summary>
        /// chỉnh sửa tài khoản
        /// </summary>
        /// <param name="tk"></param>
        /// <returns></returns>
        public static Boolean ChinhsuaTaiKhoan(TaiKhoanViewModel tk)
        {
            var entity = new QuanLyThueXeEntities();

            try
            {
                var TK = entity.TaiKhoans.SingleOrDefault(n => n.TaiKhoanNV == tk.TaiKhoanNV);
                TK.MaNV    = TK.MaNV;
                TK.MaQuyen = tk.MaQuyen;
                TK.MatKhau = TK.MatKhau;
                entity.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                entity.Dispose();
                return(false);
            }
        }
Ejemplo n.º 21
0
 public ActionResult BeginEdit(int id)
 {
     using (DBNoiThat db = new DBNoiThat())
     {
         TaiKhoanViewModel tk = (from t in db.TaiKhoans.Where(p => p.ID == id)
                                 select new TaiKhoanViewModel
         {
             ID = t.ID,
             HoTen = t.HoTen,
             Email = t.Email,
             GioiTinh = t.GioiTinh,
             NgaySinh = t.NgaySinh,
             Sdt = t.Sdt,
             DiaChi = t.DiaChi,
             IDQuyen = t.IDQuyen,
             MatKhau = t.MatKhau
         }).FirstOrDefault();
         return(Json(tk, JsonRequestBehavior.AllowGet));
     }
 }
Ejemplo n.º 22
0
        public bool PutTaiKhoan(TaiKhoanViewModel taiKhoan, string token)
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("http://localhost:49365/api/");
                client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token.Trim());
                //HTTP POST
                var responseTask = client.PutAsJsonAsync("TaiKhoans", taiKhoan);
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 23
0
        public IHttpActionResult GetTaiKhoan(int maTaiKhoan)
        {
            var taiKhoan = db.TaiKhoans.SingleOrDefault(v => v.MaTaiKhoan == maTaiKhoan);

            if (taiKhoan == null)
            {
                return(NotFound());
            }
            else
            {
                var result = new TaiKhoanViewModel()
                {
                    MaTaiKhoan  = taiKhoan.MaTaiKhoan,
                    TenTaiKhoan = taiKhoan.TenTaiKhoan,
                    MatKhau     = taiKhoan.MatKhau,
                    MaNhanVien  = taiKhoan.MaNhanVien,
                    MaKhachHang = taiKhoan.MaKhachHang
                };

                return(Ok(result));
            }
        }
Ejemplo n.º 24
0
 public MainWindow()
 {
     _HinhAnhAdmin = LoadImage(UserService.GetCurrentUser.HINHANH);
     InitializeComponent();
     DataContext = new TaiKhoanViewModel();
 }
Ejemplo n.º 25
0
 public TaiKhoan()
 {
     InitializeComponent();
     home             = new TaiKhoanViewModel();
     this.DataContext = home;
 }
Ejemplo n.º 26
0
        public JsonResult LuuTaiKhoan(TaiKhoanViewModel model)
        {
            bool   status  = false;
            string message = string.Empty;

            //tblLoaiPhong modelLoaiPhong = db.tblLoaiPhongs.Where(x => x.mo_ta == model.Type).SingleOrDefault();
            //tblTang modelTang = db.tblTangs.Where(x => x.ten_tang == model.Level).SingleOrDefault();
            tblChucVu modelChucVu = db.tblChucVus.Where(x => x.chuc_vu == model.ChucVu).SingleOrDefault();

            tblNhanVien nhanVien = new tblNhanVien();

            nhanVien.ma_nv                = model.ID;
            nhanVien.ho_ten               = model.HoTen;
            nhanVien.dia_chi              = model.DiaChi;
            nhanVien.sdt                  = model.SoDienThoai;
            nhanVien.tai_khoan            = model.TenTaiKhoan;
            nhanVien.mat_khau             = model.MatKhau;
            nhanVien.ma_chuc_vu           = modelChucVu.ma_chuc_vu;
            nhanVien.trang_thai_tai_khoan = true;
            nhanVien.mail                 = model.Email;

            if (model.ID == 0)
            {
                db.tblNhanViens.Add(nhanVien);
                try
                {
                    db.SaveChanges();
                    status = true;
                }
                catch (Exception ex)
                {
                    status  = false;
                    message = ex.Message;
                }
            }
            else
            {
                //Đang cập nhật dữ liệu
                var entity = db.tblNhanViens.Find(model.ID);
                entity.ho_ten     = model.HoTen;
                entity.dia_chi    = model.DiaChi;
                entity.sdt        = model.SoDienThoai;
                entity.tai_khoan  = model.TenTaiKhoan;
                entity.mat_khau   = model.MatKhau;
                entity.ma_chuc_vu = modelChucVu.ma_chuc_vu;
                entity.mail       = model.Email;

                try
                {
                    db.SaveChanges();
                    status = true;
                }
                catch (Exception ex)
                {
                    status  = false;
                    message = ex.Message;
                }
            }

            return(Json(new
            {
                status = status,
                message = message
            }));
        }