private void btnXoa_Click(object sender, EventArgs e)
        {
            DialogResult dialog = XtraMessageBox.Show("Bạn có chắc chắn muốn xóa?", "Xóa", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dialog == DialogResult.Yes)
            {
                try
                {
                    idCategory = gvDanhMuc.GetRowCellValue(gvDanhMuc.FocusedRowHandle, gvDanhMuc.Columns["_id"]).ToString();
                    var client  = new RestClient(Config.BASEURL + "/api/category?idlogin="******"&id=" + idCategory);
                    var request = new RestRequest(Method.DELETE);
                    request.AddHeader("token", Config.TOKEN);
                    request.AddHeader("content-type", "application/json");
                    IRestResponse response = client.Execute(request);
                    StatusOBJ     obj      = JsonConvert.DeserializeObject <StatusOBJ>(response.Content);
                    XtraMessageBox.Show(obj.msg, "Xóa");
                    if (obj.status)
                    {
                        LoadData();
                    }
                }
                catch (Exception ex)
                {
                    XtraMessageBox.Show("Có lỗi xảy ra Vui lòng kiểm tra lại!", "Quản lý danh mục");
                }
            }
        }
        private void btnSuaDanhMuc_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(teTenVideo.Text) || string.IsNullOrEmpty(teLinkVideo.Text) || string.IsNullOrEmpty(teMoTa.Text))
            {
                XtraMessageBox.Show("Có trường rỗng! Vui lòng điền đủ thông tin!", "Thêm mới");
            }
            else
            {
                try
                {
                    var client  = new RestClient(Config.BASEURL + "/api/categoryDetail");
                    var request = new RestRequest(Method.PUT);
                    request.AddHeader("token", Config.TOKEN);
                    request.AddHeader("content-type", "application/json");

                    string[] result = teLinkVideo.Text.Split('=');

                    Object body = new
                    {
                        idlogin     = Config.ID_NHANVIEN,
                        category    = idCategory,
                        id          = idCategoryDetail,
                        description = teMoTa.Text,
                        link        = result[1],
                        namevideo   = teTenVideo.Text
                    };

                    request.AddParameter("application/json", JsonConvert.SerializeObject(body), ParameterType.RequestBody);
                    IRestResponse response = client.Execute(request);

                    StatusOBJ obj = JsonConvert.DeserializeObject <StatusOBJ>(response.Content);

                    XtraMessageBox.Show(obj.msg, "Sửa");

                    if (obj.status)
                    {
                        LoadData();
                    }
                }
                catch (Exception ex)
                {
                    XtraMessageBox.Show("Có lỗi xảy ra Vui lòng kiểm tra lại!", "Quản lý video");
                }
            }
        }
        private void DoiMatKhau()
        {
            try
            {
                if (string.IsNullOrEmpty(txbMatKhauCu.Text) || string.IsNullOrEmpty(txbMatKhauMoi.Text) || string.IsNullOrEmpty(txbXacNhanMK.Text))
                {
                    MessageBox.Show("Có trường đang trống! Vui lòng kiểm tra lại!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (!CheckOMatKhau())
                {
                    MessageBox.Show("Mật khẩu không trùng khớp! Vui lòng kiểm tra lại!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                var client  = new RestClient(Config.BASEURL + "/api/user/changepassword");
                var request = new RestRequest(Method.POST);
                request.AddHeader("token", Config.TOKEN);
                request.AddHeader("content-type", "application/json");

                Object body = new
                {
                    idlogin     = Config.ID_NHANVIEN,
                    username    = Config.USERNAME,
                    password    = txbMatKhauCu.Text,
                    newpassword = txbMatKhauMoi.Text
                };

                request.AddParameter("application/json", JsonConvert.SerializeObject(body), ParameterType.RequestBody);
                IRestResponse response = client.Execute(request);

                StatusOBJ obj = JsonConvert.DeserializeObject <StatusOBJ>(response.Content);

                XtraMessageBox.Show(obj.msg, "Đổi mật khẩu");
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Lỗi đổi mật khẩu! Vui lòng thử lại!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        private void btnThem_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(teTenDanhMuc.Text) || string.IsNullOrEmpty(teAnhDaiDien.Text) || string.IsNullOrEmpty(teMoTa.Text))
            {
                XtraMessageBox.Show("Có trường rỗng! Vui lòng điền đủ thông tin!", "Thêm mới");
            }
            else
            {
                try
                {
                    var client  = new RestClient(Config.BASEURL + "/api/category");
                    var request = new RestRequest(Method.POST);
                    request.AddHeader("token", Config.TOKEN);
                    request.AddHeader("content-type", "application/json");

                    Object body = new
                    {
                        idlogin     = Config.ID_NHANVIEN,
                        description = teMoTa.Text,
                        image       = teAnhDaiDien.Text,
                        name        = teTenDanhMuc.Text
                    };

                    request.AddParameter("application/json", JsonConvert.SerializeObject(body), ParameterType.RequestBody);
                    IRestResponse response = client.Execute(request);

                    StatusOBJ obj = JsonConvert.DeserializeObject <StatusOBJ>(response.Content);

                    XtraMessageBox.Show(obj.msg, "Thêm mới");

                    if (obj.status)
                    {
                        LoadData();
                    }
                }
                catch (Exception ex)
                {
                    XtraMessageBox.Show("Có lỗi xảy ra Vui lòng kiểm tra lại!", "Quản lý danh mục");
                }
            }
        }
        private void btnTaoTK_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(teUsername.Text) || string.IsNullOrEmpty(tePassword.Text))
            {
                XtraMessageBox.Show("Tài khoản hoặc mật khẩu là trường bắt buộc", "Tạo tài khoản");
            }
            else
            {
                try
                {
                    Object body = new
                    {
                        username      = teUsername.Text,
                        password      = tePassword.Text,
                        email         = teEmail.Text,
                        avatar        = "",
                        tokenfirebase = "",
                        fullname      = teFullname.Text,
                        dateofbirth   = deDate.Text
                    };

                    var client  = new RestClient(Config.BASEURL + "/api/user");
                    var request = new RestRequest(Method.POST);
                    request.AddHeader("content-type", "application/json");
                    request.AddParameter("application/json", JsonConvert.SerializeObject(body), ParameterType.RequestBody);
                    IRestResponse response = client.Execute(request);

                    StatusOBJ obj = JsonConvert.DeserializeObject <StatusOBJ>(response.Content);
                    XtraMessageBox.Show(obj.msg, "Tạo tài khoản");
                }
                catch (Exception ex)
                {
                    XtraMessageBox.Show("Có lỗi xảy ra. Vui lòng thử lại!", "Lỗi");
                }
            }
        }