protected void initControl()
        {

            ConfigBSO configBSO = new ConfigBSO();
            int Ngon_Ngu = Convert.ToInt32(ViewState["CauHinh_Viet"]);
            if (Ngon_Ngu == 1 || Ngon_Ngu == 0)
            {
                VideoBSO videoBSO = new VideoBSO();
                DataTable table = videoBSO.GetVideoAll(Language.language);
                commonBSO commonBSO = new commonBSO();
                commonBSO.FillToGridView(grvVideo, table);

            }
            else
            {
                VideoBSO videoBSO = new VideoBSO();
                DataTable table = videoBSO.GetVideoAll(Language.language_Eng);
                commonBSO commonBSO = new commonBSO();
                commonBSO.FillToGridView(grvVideo, table);
            }




        }
        private void GetVideobyId(int Id)
        {
            VideoBSO videoBSO = new VideoBSO();
            ETO.Video video = videoBSO.GetVideoById(Id);

            ConfigBSO configBSO = new ConfigBSO();
            Config config = configBSO.GetAllConfig(Language.language);

            if (video == null)
                Response.Redirect("~/Default.aspx");

            //if (video.VideoType == true)
            //    ltlVideo.Text = @"<object type='application/x-shockwave-flash' data='" + ResolveUrl("~/") 
            //        + "images/player_flv_multi.swf' width='480' height='320'><param name='movie' value='" 
            //        + ResolveUrl("~/") + "images/player_flv_multi.swf' /> <param name='allowFullScreen' value='true' /><param name='FlashVars' value='flv=" 
            //        + video.VideoUrl + "&title=" + video.VideoName + "&startimage=" + ResolveUrl("~/") + "Admin/Upload/Video/" 
            //        + video.Image + "&width=480&height=320&autoplay=0&autoload=0&margin=0&showstop=1&showvolume=1&showtime=2&showopen=2&showfullscreen=1&buffer=10&buffermessage=" 
            //        + video.ShortDescribe + "&shortcut=1&showtitleandstartimage=0' /></object>";
            //else
            //    ltlVideo.Text = @"<object type='application/x-shockwave-flash' data='" + ResolveUrl("~/") 
            //        + "images/player_flv_multi.swf' width='480' height='320'><param name='movie' value='" 
            //        + ResolveUrl("~/") + "images/player_flv_multi.swf' /> <param name='allowFullScreen' value='true' /><param name='FlashVars' value='flv=" 
            //        + ResolveUrl("~/") + "Admin/Upload/Video/Files/" + video.FileName + "&title=" + video.VideoName + "&startimage=" 
            //        + ResolveUrl("~/") + "Admin/Upload/Video/" + video.Image + "&width=480&height=320&autoplay=0&autoload=0&margin=0&showstop=1&showvolume=1&showtime=2&showopen=2&showfullscreen=1&buffer=10&buffermessage=" 
            //        + video.ShortDescribe + "&shortcut=1&showtitleandstartimage=0' /></object>";

            if (video.VideoType == true)
                ltlVideo.Text = @"<object width='480' height='320' data='" + (new commonBSO()).EmbedYoutubeLink(video.VideoUrl) + "'></object>";
            else
                ltlVideo.Text = @"<object type='application/x-shockwave-flash' data='http://flv-player.net/medias/player_flv_multi.swf' width='480' height='320'><param name='movie' value='http://flv-player.net/medias/player_flv_multi.swf' /> <param name='allowFullScreen' value='true' /><param name='FlashVars' value='flv="
                    + ResolveUrl("~/") + "Admin/Upload/Video/Files/" + video.FileName + "&title=" + video.VideoName + "&startimage="
                    + ResolveUrl("~/") + "Admin/Upload/Video/" + video.Image + "&width=480&height=320&autoplay=0&autoload=0&margin=0&showstop=1&showvolume=1&showtime=2&showopen=2&showfullscreen=1&buffer=10&buffermessage="
                    + video.ShortDescribe + "&shortcut=1&showtitleandstartimage=0' /></object>";

        }
        private void GetVideo()
        {
            VideoBSO videoBSO = new VideoBSO();
            DataTable table = videoBSO.GetVideoAll(Language.lang);

            Repeater1.DataSource = table;
            Repeater1.DataBind();
        }
        private void initControl(int Id)
        {
            if (Id > 0)
            {
                btn_add.Visible = false;
                btn_edit.Visible = true;
                try
                {
                    VideoBSO videoBSO = new VideoBSO();
                    Video video = videoBSO.GetVideoById(Id);
                    hddVideoID.Value = Convert.ToString(video.VideoID);
                    hddIcon.Value = video.Image;
                    uploadPreview.Src = ResolveUrl("~/Upload/Video/") + video.Image;
                    txtVideoName.Text = video.VideoName;
                    txtVideoUrl.Text = video.VideoEmbed;                    
                    txtShortDescribe.Text = video.ShortDescribe;
                    txtRadDate.SelectedDate = video.PostDate;
                    rdbIsHome.SelectedValue = Convert.ToString(video.IsHome);
                    NgonNgu.SelectedValue = video.Language;
                    hddFileName.Value = video.FileName;
                    rdbType.SelectedValue = Convert.ToString(video.VideoType);
                    rdbType.Enabled = false;

                    if (video.VideoType == true)
                    {
                        txtFileName.Visible = false;
                        txtVideoUrl.Visible = true;
                    }
                    else
                    {
                        txtFileName.Visible = true;
                        txtVideoUrl.Visible = false;
                    }
                }
                catch (Exception ex)
                {
                    clientview.Text = ex.Message.ToString();
                }
            }
            else
            {
                txtRadDate.SelectedDate = DateTime.Now;
                btn_add.Visible = true;
                btn_edit.Visible = false;

                rdbType.Enabled = true;

            }
        }
        //public void ViewVideo()
        //{
        //    VideoBSO videoBSO = new VideoBSO();
        //    DataTable table = videoBSO.GetVideoAll(Language.language);
        //    commonBSO commonBSO = new commonBSO();
        //    commonBSO.FillToGridView(grvVideo, table);
        //}
        #endregion
        protected void grvVideo_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int Id = Convert.ToInt32(e.CommandArgument.ToString());
            string nName = e.CommandName.ToLower();
            switch (nName)
            {

                case "_edit":
                    Response.Redirect("~/Admin/editvideo/" + Id + "/Default.aspx");
                    break;
                case "_delete":

                    VideoBSO videoBSO = new VideoBSO();
                    videoBSO.DeleteVideo(Id);
                    initControl();
                    break;
            }
        }
        protected void initControl()
        {


            DataTable dt = new DataTable();
            dt = _md.Get_pxn(Language.language);
            ConfigBSO configBSO = new ConfigBSO();
            int Ngon_Ngu = Convert.ToInt32(ViewState["CauHinh_Viet"]);
            if (Ngon_Ngu == 1 || Ngon_Ngu == 0)
            {
                VideoBSO videoBSO = new VideoBSO();
                DataTable table = videoBSO.GetVideoAll(Language.language);
                commonBSO commonBSO = new commonBSO();
                //commonBSO.FillToGridView(grv_NhapKetQua, dt);
                RadGrid1.DataSource = dt;
                RadGrid1.DataBind();

            }
            else
            {
                VideoBSO videoBSO = new VideoBSO();
                DataTable table = videoBSO.GetVideoAll(Language.language_Eng);
                commonBSO commonBSO = new commonBSO();
                //commonBSO.FillToGridView(grv_NhapKetQua, dt);
                RadGrid1.DataSource = dt;
                RadGrid1.DataBind();
            }
            //foreach (GridViewRow gdRow in grv_NhapKetQua.Rows)
            //{
            //    if (gdRow.RowType == DataControlRowType.DataRow)
            //    {
            //        var label1 = (Label)gdRow.Cells[8].FindControl("lbl_value");
            //        var lable2 = (Label)gdRow.Cells[8].FindControl("lbl_TrangThai");
            //        if (label1.Text == "1")
            //        {
            //            lable2.Text = "Đã có kết quả";
            //        }
            //        if (label1.Text == "0")
            //        {
            //            lable2.Text = "Chưa có kết quả";
            //        }
            //    }
            //}
        }
 protected void btn_edit_Click(object sender, EventArgs e)
 {
     try
     {
         Video video = ReceiveHtml();
         VideoBSO videoBSO = new VideoBSO();
         videoBSO.UpdateVideo(video);
         clientview.Text = String.Format(Resources.StringAdmin.UpdateSuccessful, "Video", video.VideoName);
     }
     catch (Exception ex)
     {
         clientview.Text = ex.Message.ToString();
     }
 }
 protected void btn_add_Click(object sender, EventArgs e)
 {
     try
     {
         Video video = ReceiveHtml();
         VideoBSO videoBSO = new VideoBSO();
         videoBSO.CreateVideo(video);
         clientview.Text = String.Format(Resources.StringAdmin.AddNewsSuccessful);
     }
     catch (Exception ex)
     {
         clientview.Text = ex.Message.ToString();
     }
 }