public ResponseInfo UpdateTaiKhoan(NewTaiKhoan data, int id)
        {
            ResponseInfo response = new ResponseInfo();

            try
            {
                var kt = Convert.ToInt64(new GetPermission().GetQuyen("ACCOUNT_UPD")) & Convert.ToInt64(Common.Common.GetTongQuyen());
                if (kt != 0)
                {
                    response = new QuanLyTaiKhoanModel().UpadateTaiKhoan(data, id);
                }
                else
                {
                    var errorMsg = new GetErrorMsg().GetMsg((int)MessageEnum.MsgNO.BanKhongDuQuyen);
                    response.TypeMsgError = errorMsg.Type;
                    response.MsgError     = errorMsg.Msg;
                }
            }
            catch (Exception e)
            {
                response.Code = (int)ConstantsEnum.CodeResponse.ServerError;
                var errorMsg = new GetErrorMsg().GetMsg((int)MessageEnum.MsgNO.ServerError);
                response.TypeMsgError    = errorMsg.Type;
                response.MsgError        = errorMsg.Msg;
                response.ThongTinBoSung1 = e.Message;
            }
            return(response);
        }
        /// <summary>
        /// Cập nhật thông tin tài khoản
        /// Author       :   HoangNM - 18/03/2019 - create
        /// </summary>
        /// <param name="taiKhoan">thông tin về tài khoản muốn thay đổi</param>
        /// <returns>Trả về các thông tin khi cập nhật tài khoản, Excetion nếu có lỗi</returns>
        public ResponseInfo UpadateTaiKhoan(NewTaiKhoan taiKhoan, int id)
        {
            DbContextTransaction transaction = context.Database.BeginTransaction();
            ResponseInfo         response    = new ResponseInfo();

            try
            {
                TblTaiKhoan TK = context.TaiKhoans.FirstOrDefault(x => x.Username == taiKhoan.Username && x.Id != id && !x.DelFlag);
                if (TK == null)
                {
                    TK = context.TaiKhoans.FirstOrDefault(x => x.Email == taiKhoan.Email && x.Id != id && !x.DelFlag);
                    if (TK == null)
                    {
                        var kt = Convert.ToInt64(new GetPermission().GetQuyen("ACCOUNT_MAN")) & Convert.ToInt64(Common.Common.GetTongQuyen());
                        if (kt != 0)
                        {
                            TblTaiKhoan updateTaiKhoan = context.TaiKhoans.Where(x => x.Id == id && !x.DelFlag).FirstOrDefault();
                            updateTaiKhoan.Username     = taiKhoan.Username;
                            updateTaiKhoan.Email        = taiKhoan.Email;
                            updateTaiKhoan.Id_TrangThai = taiKhoan.IdTrangThai;
                            updateTaiKhoan.Id_NhomDich  = taiKhoan.IdNhom;
                            updateTaiKhoan.Id_PhanQuyen = taiKhoan.IdQuyen;
                            //updateTaiKhoan.ThongTinNguoiDung.Ten = taiKhoan.HoTen;
                            //updateTaiKhoan.ThongTinNguoiDung.NgaySinh = taiKhoan.NgaySinh;
                            //updateTaiKhoan.ThongTinNguoiDung.GioiTinh = taiKhoan.GioiTinh;
                            //updateTaiKhoan.hash_Pass = BaoMat.GetMD5(BaoMat.GetSimpleMD5(taiKhoan.pass), updateTaiKhoan.salt_Pass);
                        }
                        else
                        {
                            int id_nhomDich = Common.Common.GetAccount().IdNhom;

                            TblTaiKhoan updateTaiKhoan = context.TaiKhoans.Where(x => x.Id == id && x.Id_NhomDich == id_nhomDich && !x.DelFlag).FirstOrDefault();
                            updateTaiKhoan.Username     = taiKhoan.Username;
                            updateTaiKhoan.Email        = taiKhoan.Email;
                            updateTaiKhoan.Id_TrangThai = taiKhoan.IdTrangThai;
                            updateTaiKhoan.Id_NhomDich  = taiKhoan.IdNhom;
                            updateTaiKhoan.Id_PhanQuyen = taiKhoan.IdQuyen;
                            //updateTaiKhoan.ThongTinNguoiDung.Ten = taiKhoan.HoTen;
                            //updateTaiKhoan.ThongTinNguoiDung.NgaySinh = taiKhoan.NgaySinh;
                            //updateTaiKhoan.ThongTinNguoiDung.GioiTinh = taiKhoan.GioiTinh;
                            //updateTaiKhoan.hash_Pass = BaoMat.GetMD5(BaoMat.GetSimpleMD5(taiKhoan.pass), updateTaiKhoan.salt_Pass);
                        }

                        context.SaveChanges();
                        response.IsSuccess = true;
                        transaction.Commit();
                        var errorMsg = new GetErrorMsg().GetMsg((int)MessageEnum.MsgNO.CapNhatDuLieuThanhCong);
                        response.TypeMsgError = errorMsg.Type;
                        response.MsgError     = errorMsg.Msg;
                    }
                    else
                    {
                        var errorMsg = new GetErrorMsg().GetMsg((int)MessageEnum.MsgNO.EmailDaTonTai);
                        response.TypeMsgError = errorMsg.Type;
                        response.MsgError     = errorMsg.Msg;
                    }
                }
                else
                {
                    var errorMsg = new GetErrorMsg().GetMsg((int)MessageEnum.MsgNO.UserNameDaDung);
                    response.TypeMsgError = errorMsg.Type;
                    response.MsgError     = errorMsg.Msg;
                }


                return(response);
            }
            catch (Exception e)
            {
                response.IsSuccess = false;
                transaction.Rollback();
                throw e;
            }
        }