private void ViewDetailOfficial(int Id)
        {
            OfficialBSO officialBSO = new OfficialBSO();
            ETO.Official official = officialBSO.GetOfficialById(Id);
            litNoCode.Text = official.NoCode;
            litOfficialName.Text = official.OfficialName;
            litDatePublic.Text = official.DatePublic.ToString("dd/MM/yyyy");// Convert.ToString(official.DatePublic);
            litCompany.Text = official.Company;
            litClassify.Text = official.Classify;
            litWriter.Text = official.Writer;
            litQuote.Text = official.Quote;
            litKeyShort.Text = official.KeyShort;
            if (official.Attached != "")
            {
                litAttached.Text = "<a href='" + ResolveUrl("~/") + "Admin/Upload/Files/" + official.Attached + "'>Tải về</a>";
            }

            OfficialFileBSO officialFileBSO = new OfficialFileBSO();
            DataTable tableFile = officialFileBSO.GetOfficialFileByOfficial(official.OfficialID);
            if (tableFile.Rows.Count > 0)
            {
                Repeater1.DataSource = tableFile;
                Repeater1.DataBind();
            }


            OfficialFollow(official.OfficialID, official.CateOfficialID);
            //Page.Title = "Thủy điện Sơn La : " + GetString(official.OfficialName);
            Page.Title = GetString(official.OfficialName);
        }
        private void initControl(int Id)
        {
            if (Id > 0)
            {
                btn_add.Visible = false;
                btn_edit.Visible = true;
                try
                {
                    OfficialFileBSO officialFileBSO = new OfficialFileBSO();
                    OfficialFile officialFile = officialFileBSO.GetOfficialFileByID(Id);


                    hddOfficialFileID.Value = Convert.ToString(officialFile.OfficialFileID);
                    hddOfficialID.Value = Convert.ToString(officialFile.OfficialID);
                    hddFileName.Value = Convert.ToString(officialFile.FileName);
                    txtTitle.Text = officialFile.Title;


                }
                catch (Exception ex)
                {
                    clientview.Text = ex.Message.ToString();
                }
            }
            else
            {
                btn_edit.Visible = false;
                btn_add.Visible = true;



            }
        }
        private void ViewFiles(int cId)
        {
            OfficialFileBSO officialFilesBSO = new OfficialFileBSO();
            DataTable table = new DataTable();
            if (cId != 0)
                table = officialFilesBSO.GetOfficialFileByOfficial(cId);
            else
                table = officialFilesBSO.GetOfficialFileAll();

            commonBSO commonBSO = new commonBSO();
            commonBSO.FillToGridView(grvFiles, table);
        }
        protected void grvFiles_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int Id = Convert.ToInt32(e.CommandArgument.ToString());
            string nName = e.CommandName.ToLower();
            switch (nName)
            {
                case "_edit":
                    Response.Redirect("~/Admin/editofficialfiles/" + hddOfficialID.Value + "/" + Id + "/Default.aspx");
                    break;

                case "_delete":
                    OfficialFileBSO officialFileBSO = new OfficialFileBSO();
                    officialFileBSO.DeleteOfficialFile(Id);

                    ViewFiles(Convert.ToInt32(hddOfficialID.Value));
                    break;
            }
        }
 protected void btn_delall_Click(object sender, EventArgs e)
 {
     if (FilesID() != "")
     {
         OfficialFileBSO fileBSO = new OfficialFileBSO();
         fileBSO.DeleteOfficialFile(FilesID());
     }
     ViewFiles(Convert.ToInt32(hddOfficialID.Value));
 }
        protected void btn_edit_Click(object sender, EventArgs e)
        {
            try
            {
                OfficialFile file = new OfficialFile();
                file = ReceiveHtml();


                OfficialFileBSO filesBSO = new OfficialFileBSO();
                filesBSO.UpdateOfficialFile(file);


                ViewFiles(Convert.ToInt32(hddOfficialID.Value));
                clientview.Text = String.Format(Resources.StringAdmin.AddNewsSuccessful);
            }
            catch (Exception ex)
            {
                clientview.Text = ex.Message.ToString();
            }
        }
        protected void btn_add_Click(object sender, EventArgs e)
        {

            try
            {
                if (String.IsNullOrEmpty(file_attached.FileName))
                {

                    ViewFiles(Convert.ToInt32(hddOfficialID.Value));
                    clientview.Text = "Chưa có file đính kèm";

                }
                else
                {
                    OfficialFile file = new OfficialFile();
                    file = ReceiveHtml();


                    OfficialFileBSO filesBSO = new OfficialFileBSO();
                    filesBSO.CreateOfficialFile(file);


                    ViewFiles(Convert.ToInt32(hddOfficialID.Value));
                    clientview.Text = String.Format(Resources.StringAdmin.AddNewsSuccessful);


                }


            }
            catch (Exception ex)
            {
                clientview.Text = ex.Message.ToString();
            }

        }