public void UpdateTimeXuatban()
        {
            T_NewsDAL _DAL   = new T_NewsDAL();
            string    _where = string.Empty;

            if (Page.Request.Params["id"] != null)
            {
                int _ID = int.Parse(Page.Request["id"].ToString());
                if (!string.IsNullOrEmpty(txtTimeXB.Text))
                {
                    DateTime dt = new DateTime();
                    try
                    {
                        dt = DateTime.Parse(txtTimeXB.Text, new CultureInfo("fr-FR"));
                    }
                    catch { return; }
                    _where = string.Format(" News_Status = " + ConstNews.NewsPublishingSchedule + ", News_PublishedID=" + _user.UserID + " , News_DatePublished = convert(datetime,'" + dt.ToString("dd/MM/yyyy HH:mm") + "',105) Where News_ID = " + _ID);
                }
                else
                {
                    _where = string.Format(" News_DatePublished = convert(datetime,null,103) Where News_ID = " + _ID);
                }
                _DAL.UpdateFromT_NewsDynamic(_where);
            }
        }
        private void ReturnNewsPublisher(DataGrid dgr)
        {
            T_NewsDAL tt  = new T_NewsDAL();
            T_News    obj = new T_News();

            foreach (DataGridItem m_Item in dgr.Items)
            {
                CheckBox chk_Select = (CheckBox)m_Item.FindControl("optSelect");
                if (chk_Select != null && chk_Select.Checked)
                {
                    LinkButton linkname = (LinkButton)m_Item.FindControl("linkTittle");
                    double     News_ID  = double.Parse(dgr.DataKeys[m_Item.ItemIndex].ToString());
                    obj = tt.GetOneFromT_NewsByID(News_ID);
                    tt.IsLock(News_ID, 0);
                    //if (obj.Lang_ID == 1)
                    //{
                    //    tt.UpdateStatus_T_News_ex_New_HV(News_ID, ConstNews.NewsReturn_tk, _user.UserID, DateTime.Now);
                    //    tt.Insert_Version_From_T_News_WithUserModify(News_ID, ConstNews.NewsUnPublishing, ConstNews.NewsReturn_tk, _user.UserID);
                    //    WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, linkname.Text,
                    //           Request["Menu_ID"].ToString(), "[Xuất bản tin bài] [Danh sách tin bài hủy đăng] [Trả lại Trình bày bài viết]", News_ID, ConstAction.BaoDT);
                    //}
                    //else
                    //{
                    tt.UpdateStatus_T_News_ex_New_HV(News_ID, ConstNews.NewsReturn_tb, _user.UserID, DateTime.Now);
                    tt.Insert_Version_From_T_News_WithUserModify(News_ID, ConstNews.NewsUnPublishing, ConstNews.NewsReturn_tb, _user.UserID);
                    WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, linkname.Text,
                                                                   Request["Menu_ID"].ToString(), "[Xuất bản tin bài] [Danh sách tin bài hủy đăng] [Trả lại Biên tập tin bài]", News_ID, ConstAction.BaoDT);
                    //}
                }
            }
            this.LoadData_UnPublisher();
        }
        private void SendPub(double id, int _status)
        {
            T_News    obj_T_News = new T_News();
            T_NewsDAL tt         = new T_NewsDAL();

            tt.Update_Status_tintuc(double.Parse(id.ToString()), _status, _user.UserID, DateTime.Now);
            tt.Insert_Version_From_T_News_WithUserModify(double.Parse(id.ToString()), ConstNews.NewsAppro_tbt, _status, _user.UserID);
        }
        //end

        #endregion

        #region Event click
        protected void btnLayout_Click(object sender, EventArgs e)
        {
            int ChildID = Convert.ToInt32(Request["ID"]);

            HPCBusinessLogic.DAL.T_NewsDAL tt = new HPCBusinessLogic.DAL.T_NewsDAL();
            T_News _objNewsCurr  = new T_NewsDAL().load_T_news(ChildID);
            int    Get_T_News_ID = int.Parse(_objNewsCurr.News_CopyFrom.ToString());
            T_News _objNews      = new T_News();

            if (tt.Get_NewsVersion(Get_T_News_ID, 7, 92) || tt.Get_NewsVersion(Get_T_News_ID, 7, 82))
            {
                _objNews              = tt.load_T_news(Get_T_News_ID);
                this.txt_tomtat.Text  = txt_tomtat.Text + "<br />" + _objNews.News_Summary;
                this.txt_noidung.Text = txt_noidung.Text + "<br />" + _objNews.News_Body;
            }
        }
示例#5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _user = _userDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name);
     if (_user != null)
     {
         if (!Page.IsPostBack)
         {
             int          id    = int.Parse(Page.Request.QueryString["ID"].ToString());
             T_News       obj   = new T_News();
             T_NewsDAL    dal   = new T_NewsDAL();
             ChuyenmucDAL caDal = new ChuyenmucDAL();
             obj = dal.load_T_news(id);
             if (obj.CAT_ID > 0)
             {
                 this.litCatName.Text = caDal.GetOneFromT_ChuyenmucByID(int.Parse(obj.CAT_ID.ToString())).Ten_ChuyenMuc;
             }
             else
             {
                 this.litCatName.Text = "";
             }
             this.litDanNhap.Text = obj.News_Sub_Title.ToString();
             this.litTittle.Text  = obj.News_Tittle.ToString();
             this.LitSummery.Text = CleanHTMLFont(CleanHTMLSummary(obj.News_Summary.ToString()));
             this.litContent.Text = CleanHTMLFont(obj.News_Body.ToString());
             if (obj.News_Status == 6)
             {
                 this.LitDatePublisher.Text = obj.News_DateEdit.ToString("dd/MM/yyyy HH:mm") + " (GMT + 7)";
             }
             string count = this.litContent.Text;
             this.LitCount.Text = UltilFunc.WordCount(count) + " từ ";
         }
     }
     else
     {
         Response.Redirect("~/Errors/AccessDenied.aspx");
     }
 }
示例#6
0
        private T_News SetItem(int _status)
        {
            T_NewsDAL Dal  = new T_NewsDAL();
            T_News    _obj = new T_News();

            if (Page.Request.Params["id"] != null)
            {
                _obj.News_ID = int.Parse(Page.Request["id"].ToString());
            }
            else
            {
                _obj.News_ID = 0;
            }

            int       butdanhID = 0;
            T_Butdanh obj_BD    = new T_Butdanh();

            HPCBusinessLogic.DAL.T_ButdanhDAL obj = new HPCBusinessLogic.DAL.T_ButdanhDAL();
            if (!string.IsNullOrEmpty(txt_Author_name.Text.Trim()))
            {
                obj_BD.BD_ID   = 0;
                obj_BD.UserID  = _user.UserID;
                obj_BD.BD_Name = txt_Author_name.Text.Trim();
                butdanhID      = obj.Insert_Butdang(obj_BD);
            }
            _obj.News_TacgiaID  = butdanhID;
            _obj.Lang_ID        = Convert.ToInt32(this.cbo_lanquage.SelectedValue.ToString());
            _obj.CAT_ID         = Convert.ToInt32(this.cbo_chuyenmuc.SelectedValue.ToString());
            _obj.News_Tittle    = this.Txt_tieude.Text.Trim();
            _obj.Images_Summary = this.txtThumbnail.Text.Trim();
            _obj.News_Sub_Title = this.txt_TieuDePhu.Text.Trim();
            _obj.News_Summary   = this.txt_tomtat.Text;
            _obj.News_Body      = this.txt_noidung.Text.Trim();
            _obj.News_EditorID  = _user.UserID;
            _obj.News_DateEdit  = DateTime.Now;
            if (_status == 6)
            {
                _obj.News_PublishNumber = DateTime.Now.Month;
                _obj.News_PublishYear   = DateTime.Now.Year;
                _obj.News_PublishedID   = _user.UserID;

                _obj.News_DatePublished = DateTime.Now;
                _obj.News_DateApproved  = DateTime.Now;
                _obj.News_AprovedID     = _user.UserID;
            }
            _obj.News_Comment    = this.Txt_Comments.Text.Trim();
            _obj.News_AuthorName = this.txt_Author_name.Text.Trim();
            _obj.News_AuthorID   = _user.UserID;
            //if (ddlNews_Priority.Items.Count > 0)
            //    _obj.News_Priority = int.Parse(ddlNews_Priority.SelectedValue.ToString());
            _obj.News_IsCategorys       = this.chk_IsCategorys.Checked;
            _obj.News_IsHomePages       = this.chk_IsHomePages.Checked;
            _obj.News_IsCategoryParrent = this.chk_IsCategoryParrent.Checked;
            _obj.News_Status            = _status;
            _obj.Keywords       = this.txtTukhoa.Text;
            _obj.News_IsHot     = this.chkNewsIsHot.Checked;
            _obj.News_IsFocus   = this.chkNewsIsFocus.Checked;
            _obj.News_Realate   = "";
            _obj.News_IsImages  = this.chkImages.Checked;
            _obj.News_IsVideo   = this.chkVideo.Checked;
            _obj.News_IsHistory = this.chkHistorys.Checked;
            int tien = 0;

            if (this.txtTienNhuanBut.Text.Trim().Length > 0)
            {
                tien = int.Parse(txtTienNhuanBut.Text.Replace(",", ""));
                if (tien > 0)
                {
                    _obj.News_TienNB        = tien;
                    _obj.News_Ngaycham      = DateTime.Now;
                    _obj.News_NguoichamNBID = _user.UserID;
                }
                else
                {
                    _obj.News_TienNB        = 0;
                    _obj.News_NguoichamNBID = 0;
                }
            }
            //Add By nvthai
            _obj.News_CopyFrom      = 0;
            _obj.News_Realate       = ReturnFilterListRelation();
            _obj.News_PhotoAtt      = txtVideoPath.Text;
            _obj.News_DescImages    = txtChuthichanh.Text;
            _obj.Image_Hot          = cbHienthiAnh.Checked;
            _obj.News_Nguon         = txtNguon.Text;
            _obj.News_DisplayMobile = cbDisplayMobile.Checked;
            _obj.News_Delete        = cbMoreViews.Checked;
            return(_obj);
        }
        protected void linkSave_Click(object sender, EventArgs e)
        {
            //dung them vao de kiem tra dieu dau vao và để busybox khong bi dung trong IE
            if (Txt_tieude.Text.Length <= 0)
            {
                System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + CommonLib.ReadXML("lblXacnhanLuu") + "');", true);
                return;
            }
            if (cbo_lanquage.SelectedIndex == 0)
            {
                System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + CommonLib.ReadXML("lblXacnhanLuu") + "');", true);
                return;
            }

            if (cbo_chuyenmuc.SelectedIndex == 0)
            {
                System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + CommonLib.ReadXML("lblXacnhanLuu") + "');", true);
                return;
            }
            if (!string.IsNullOrEmpty(txtTienNhuanBut.Text))
            {
                try { int.Parse(txtTienNhuanBut.Text.Replace(",", "")); }
                catch
                {
                    System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + CommonLib.ReadXML("lblXacnhanTien") + "');", true);
                    return;
                }
            }
            T_News    _t_news    = SetItem(ConstNews.NewsApproving_tb);
            int       id         = 0;
            T_NewsDAL _T_newsDAL = new T_NewsDAL();

            //T_News _objSet = SetItem(ConstNews.NewsApproving_tb);
            // Insert
            id = _T_newsDAL.InsertT_news(_t_news);
            // Insert keyword
            InsertKeyword(id, _user.UserID);
            UltilFunc.Insert_News_Image(txt_noidung.Text.Trim(), Convert.ToDouble(Page.Request["id"]));
            int tab = 0;

            if (Request["ID"] == null)
            {
                if (Page.Request["Tab"] != null && Page.Request["Tab"].ToString() != "-1")
                {
                    tab = Convert.ToInt32(Page.Request["Tab"].ToString());
                    if (tab == 10)
                    {
                        WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, _t_news.News_Tittle,
                                                                       Request["Menu_ID"].ToString(), "[Tin tức đang đăng] [Thao tác cập nhật]", id, ConstAction.BaoDT);
                    }
                    else
                    {
                        WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, _t_news.News_Tittle,
                                                                       Request["Menu_ID"].ToString(), "[Biên tập tin bài] [Tin bài đang biên tập] [Thao tác cập nhật]", id, ConstAction.BaoDT);
                    }
                }
                else
                {
                    WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, _t_news.News_Tittle,
                                                                   Request["Menu_ID"].ToString(), "[Biên tập tin bài] [Tin tức đang chờ xuất bản:] [Thao tác cập nhật]", id, ConstAction.BaoDT);
                }
            }
            else
            {
                if (Page.Request["Tab"] != null && Page.Request["Tab"].ToString() != "-1")
                {
                    tab = Convert.ToInt32(Page.Request["Tab"].ToString());
                    if (tab == 10)
                    {
                        WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, _t_news.News_Tittle,
                                                                       Request["Menu_ID"].ToString(), "[Tin tức đang đăng] [Thao tác cập nhật]", _t_news.News_ID, ConstAction.BaoDT);
                    }
                    else
                    {
                        WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, _t_news.News_Tittle,
                                                                       Request["Menu_ID"].ToString(), "[Biên tập tin bài] [Tin bài đang biên tập] [Thao tác cập nhật]", _t_news.News_ID, ConstAction.BaoDT);
                    }
                }
                else
                {
                    WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, _t_news.News_Tittle,
                                                                   Request["Menu_ID"].ToString(), "[Biên tập tin bài] [Tin tức đang chờ xuất bản] [Thao tác cập nhật]", _t_news.News_ID, ConstAction.BaoDT);
                }
            }
            if (_t_news.Images_Summary.Length > 0)
            {
                this.ImgTemp.Src = HPCComponents.Global.TinPathBDT + "/" + _t_news.Images_Summary;
            }
            _T_newsDAL.IsLock(double.Parse(_t_news.News_ID.ToString()), 1, _user.UserID);
            if (Request["Tab"] != null && Request["Tab"].ToString() != "" && Request["Tab"].ToString() != String.Empty)
            {
                Response.Redirect("ArticleApproveEditTB.aspx?Menu_ID=" + Request["Menu_ID"].ToString() + "&Tab=" + Page.Request["Tab"].ToString() + "&ID=" + id.ToString());
            }
            else
            {
                Response.Redirect("ArticleApproveEditTB.aspx?Menu_ID=" + Request["Menu_ID"].ToString() + "&ID=" + id.ToString());
            }
        }
示例#8
0
        public void LoadDetails(int NewsID, bool ViewHistory, bool chieu, int currentindex, bool clickgrid)
        {
            if (!ViewHistory)
            {
                T_News       obj   = new T_News();
                T_NewsDAL    dal   = new T_NewsDAL();
                ChuyenmucDAL caDal = new ChuyenmucDAL();
                obj = dal.load_T_news(NewsID);
                System.Text.StringBuilder _Builer = new System.Text.StringBuilder();
                string _image = "";
                if (obj != null && obj.News_ID > 0)
                {
                    try
                    {
                        if (obj.News_DateEdit != null && obj.News_DateEdit.ToString().Length > 0)
                        {
                            this.litDateTime.Text = Convert.ToDateTime(obj.News_DateEdit.ToString()).ToString("dd/MM/yyyy HH:mm");
                        }
                        if (obj.News_DatePublished != null && obj.News_DatePublished.ToString().Length > 0)
                        {
                            this.litDateTime.Text = Convert.ToDateTime(obj.News_DatePublished.ToString()).ToString("dd/MM/yyyy HH:mm");
                        }
                        this.litTittle.Text    = obj.News_Tittle.ToString();
                        this.litSapo.Text      = obj.News_Summary.ToString();
                        this.litCategorys.Text = "<a href=\"#\">" + HPCBusinessLogic.UltilFunc.GetCategoryName(obj.CAT_ID) + "</a>";
                        if (obj.News_PhotoAtt != null && obj.News_PhotoAtt.ToString().Length > 0)
                        {
                            if (UltilFunc.CheckFrames(obj.News_PhotoAtt.ToString()) == false)
                            {
                                _Builer.Append("<div id=\"liveTV\"></div>");
                                _Builer.Append(" <script type=\"text/javascript\">jwplayer('liveTV').setup({ ");
                                _Builer.Append(" image: '" + HPCComponents.Global.TinPath + obj.Images_Summary.ToString() + "',");
                                _Builer.Append(" file: '" + HPCComponents.Global.TinPath + obj.News_PhotoAtt.ToString() + "', ");
                                _Builer.Append(" width: 665,height: 400,autostart: false,");
                                _Builer.Append(" backcolor: '#000000',frontcolor: '#ffffff',lightcolor: '#ffffff',screencolor: '#ffffff',");
                                _Builer.Append(" allowscriptaccess: true,allowfullscreen: true,controlbar: 'over',stretching:'fill'});</script>");
                                if (obj.News_DescImages != null && obj.News_DescImages.ToString().Length > 0)
                                {
                                    _Builer.Append("<div class=\"title\"><span>" + obj.News_DescImages.ToString() + "</span></div>");
                                }
                                //this.litImage.Text = _Builer.ToString();
                            }
                            else
                            {
                                string _youReziHeigh = "";
                                try
                                {
                                    string _youReziWith = UltilFunc.ReplapceYoutoubeWidth(obj.News_PhotoAtt.ToString(), "665");
                                    _youReziHeigh = UltilFunc.ReplapceYoutoubeHight(_youReziWith.ToString(), "400");
                                }
                                catch
                                {
                                    _youReziHeigh = "";
                                }
                                //this.litImage.Text = _youReziHeigh.ToString();
                            }
                        }
                        else
                        {
                            if (obj.Images_Summary != null && obj.Images_Summary.ToString().Length > 0)
                            {
                                _image = "<img style=\"width:665px;\" alt=\"" + obj.News_Tittle.ToString() + "\" title=\"" + obj.News_Tittle.ToString() + "\" src=\"" + HPCComponents.Global.TinPath + obj.Images_Summary.ToString() + "\" />";
                                if (obj.News_DescImages != null && obj.News_DescImages.ToString().Length > 0)
                                {
                                    _image += "<div class=\"title\"><span>" + obj.News_DescImages.ToString() + "</span></div>";
                                }
                            }
                            //this.litImage.Text = _image.ToString();
                        }
                        this.litContents.Text = SearchImgTag(SearchSlideImg(obj.News_Body.ToString()));
                        //this.litCategorys.Text = "<a href=\"#\">" + dt.Rows[0]["Categorys_Name"] + "</a>";
                        if (obj.News_AuthorName != null && obj.News_AuthorName.ToString().Length > 0)
                        {
                            this.litAuthor.Text = "<div class=\"author\">" + obj.News_AuthorName.ToString() + "</div>";
                        }
                        //this.LitNhuanbut.Text = obj.News_TienNB.ToString();
                        if (obj.News_TienNB > 0.0)
                        {
                            this.LitNhuanbut.Text = string.Format("{0:#,#}", obj.News_TienNB).Replace(".", ",");
                        }
                        else
                        {
                            this.LitNhuanbut.Text = "";
                        }
                        //string count = string.Empty;
                        //count = this.litContents.Text;
                        //if (count != "")
                        //    this.LitCount.Text = UltilFunc.WordCount(count) + " từ ";
                        //else
                        //    this.LitCount.Text = "";
                        this.Literal_nguoinhap.Text = HPCBusinessLogic.UltilFunc.GetUserFullName(obj.News_AuthorID);
                        this.Literal_nguoiluu.Text  = HPCBusinessLogic.UltilFunc.GetUserFullName(obj.News_EditorID);
                        this.Literal_ngayluu.Text   = Convert.ToDateTime(obj.News_DateEdit).ToString("dd/MM/yyyy HH:mm");

                        ViewState["ver"] = -1;
                    }
                    catch {; }
                }
            }
            else
            {
                T_News       obj   = new T_News();
                T_NewsDAL    dal   = new T_NewsDAL();
                ChuyenmucDAL caDal = new ChuyenmucDAL();
                obj = dal.load_T_news(NewsID);
                DataSet ds = dal.GetDetailHistory(NewsID);
                System.Text.StringBuilder _Builer = new System.Text.StringBuilder();
                string _image         = "";
                int    gridview_index = 0;
                if (ds != null)
                {
                    try
                    {
                        DataTable dt = ds.Tables[0];
                        if (dt.Rows[0]["News_DateEdit"] != null && dt.Rows[0]["News_DateEdit"].ToString().Length > 0)
                        {
                            this.litDateTime.Text = Convert.ToDateTime(dt.Rows[0]["News_DateEdit"].ToString()).ToString("dd/MM/yyyy HH:mm");
                        }
                        if (dt.Rows[0]["News_DatePublished"] != null && dt.Rows[0]["News_DatePublished"].ToString().Length > 0)
                        {
                            this.litDateTime.Text = Convert.ToDateTime(dt.Rows[0]["News_DatePublished"].ToString()).ToString("dd/MM/yyyy HH:mm");
                        }
                        this.litTittle.Text    = dt.Rows[0]["News_Tittle"].ToString();
                        this.litSapo.Text      = dt.Rows[0]["News_Summary"].ToString();
                        this.litCategorys.Text = "<a href=\"#\">" + HPCBusinessLogic.UltilFunc.GetCategoryName(dt.Rows[0]["CAT_ID"]) + "</a>";

                        if (dt.Rows[0]["News_PhotoAtt"] != null && dt.Rows[0]["News_PhotoAtt"].ToString().Length > 0)
                        {
                            if (UltilFunc.CheckFrames(dt.Rows[0]["News_PhotoAtt"].ToString()) == false)
                            {
                                _Builer.Append("<div id=\"liveTV\"></div>");
                                _Builer.Append(" <script type=\"text/javascript\">jwplayer('liveTV').setup({ ");
                                _Builer.Append(" image: '" + HPCComponents.Global.TinPath + dt.Rows[0]["Images_Summary"].ToString() + "',");
                                _Builer.Append(" file: '" + HPCComponents.Global.TinPath + dt.Rows[0]["News_PhotoAtt"].ToString() + "', ");
                                _Builer.Append(" width: 665,height: 400,autostart: false,");
                                _Builer.Append(" backcolor: '#000000',frontcolor: '#ffffff',lightcolor: '#ffffff',screencolor: '#ffffff',");
                                _Builer.Append(" allowscriptaccess: true,allowfullscreen: true,controlbar: 'over',stretching:'fill'});</script>");

                                //this.litImage.Text = _Builer.ToString();
                            }
                            else
                            {
                                string _youReziHeigh = "";
                                try
                                {
                                    string _youReziWith = UltilFunc.ReplapceYoutoubeWidth(dt.Rows[0]["News_PhotoAtt"].ToString(), "665");
                                    _youReziHeigh = UltilFunc.ReplapceYoutoubeHight(_youReziWith.ToString(), "400");
                                }
                                catch
                                {
                                    _youReziHeigh = "";
                                }
                                //this.litImage.Text = _youReziHeigh.ToString();
                            }
                        }
                        else
                        {
                            if (dt.Rows[0]["Images_Summary"] != null && dt.Rows[0]["Images_Summary"].ToString().Length > 0)
                            {
                                _image = "<img style=\"width:665px;\" alt=\"" + dt.Rows[0]["News_Tittle"].ToString() + "\" title=\"" + dt.Rows[0]["News_Tittle"].ToString() + "\" src=\"" + HPCComponents.Global.TinPath + dt.Rows[0]["Images_Summary"].ToString() + "\" />";
                            }
                            //this.litImage.Text = _image.ToString();
                        }

                        if (!string.IsNullOrEmpty(lbl_index.Text))
                        {
                            gridview_index = int.Parse(lbl_index.Text);
                            DataSet ds1 = dal.GetDetailHistory(int.Parse(this.dgr_tintuc1.DataKeys[gridview_index].ToString()));

                            if (clickgrid)
                            {
                                this.litContents.Text = MergeEngineCompare(ds1.Tables[0].Rows[0]["News_Body"].ToString(),
                                                                           dt.Rows[0]["News_Body"].ToString());
                            }
                            else
                            {
                                this.litContents.Text = MergeEngineCompare(ds1.Tables[0].Rows[0]["News_Body"].ToString(), dt.Rows[0]["News_Body"].ToString());
                            }
                        }
                        else
                        {
                            this.litContents.Text = SearchImgTag(SearchSlideImg(dt.Rows[0]["News_Body"].ToString()));
                        }
                        if (dt.Rows[0]["News_AuthorName"] != null && dt.Rows[0]["News_AuthorName"].ToString().Length > 0)
                        {
                            this.litAuthor.Text = "<div class=\"author\">" + dt.Rows[0]["News_AuthorName"].ToString() + "</div>";
                        }
                        if (double.Parse(dt.Rows[0]["News_TienNB"].ToString()) > 0.0)
                        {
                            this.LitNhuanbut.Text = string.Format("{0:#,#}", dt.Rows[0]["News_TienNB"]).Replace(".", ",");
                        }
                        else
                        {
                            this.LitNhuanbut.Text = "";
                        }
                        //string count = string.Empty;
                        //count = this.litContents.Text;
                        //if (count != "")
                        //    this.LitCount.Text = UltilFunc.WordCount(count) + " từ ";
                        //else
                        //    this.LitCount.Text = "";
                        this.Literal_nguoinhap.Text = HPCBusinessLogic.UltilFunc.GetUserFullName(dt.Rows[0]["News_AuthorID"]);
                        this.Literal_nguoiluu.Text  = HPCBusinessLogic.UltilFunc.GetUserFullName(dt.Rows[0]["News_EditorID"]);
                        this.Literal_ngayluu.Text   = Convert.ToDateTime(dt.Rows[0]["News_DateEdit"]).ToString("dd/MM/yyyy HH:mm");

                        ViewState["ver"] = -1;
                    }
                    catch {; }
                }
            }
        }
        protected T_News SetItem(int status)
        {
            T_NewsDAL Dal      = new T_NewsDAL();
            T_News    obj_news = new T_News();

            if (Page.Request.Params["id"] != null)
            {
                obj_news.News_ID = Convert.ToInt32(Page.Request["id"].ToString());
            }
            else
            {
                obj_news.News_ID = 0;
            }
            obj_news = Dal.load_T_news(int.Parse(Request["id"]));
            //if (obj_news.News_Status == 73)
            //    obj_news.News_DateEdit = obj_news.News_DateEdit;
            //else
            //    obj_news.News_DateEdit = DateTime.Now;
            if (Txt_tieude.Text != "")
            {
                obj_news.News_Tittle = UltilFunc.CleanFormatTags(Txt_tieude.Text);
            }
            if (txt_TieuDePhu.Text.Length > 0) //added by haolm
            {
                obj_news.News_Sub_Title = UltilFunc.CleanFormatTags(txt_TieuDePhu.Text);
            }
            if (txt_tomtat.Text.Length > 0)
            {
                obj_news.News_Summary = txt_tomtat.Text;
            }
            if (int.Parse(cbo_chuyenmuc.SelectedIndex.ToString()) > 0)
            {
                obj_news.CAT_ID = int.Parse(cbo_chuyenmuc.SelectedValue.ToString());
            }
            if (int.Parse(cbo_lanquage.SelectedIndex.ToString()) > 0)
            {
                obj_news.Lang_ID = int.Parse(cbo_lanquage.SelectedValue.ToString());
            }
            //obj_news.News_Priority = int.Parse(ddlNews_Priority.SelectedValue.ToString());
            obj_news.News_IsCategorys       = this.chk_IsCategorys.Checked;
            obj_news.News_IsHomePages       = this.chk_IsHomePages.Checked;
            obj_news.News_IsCategoryParrent = this.chk_IsCategoryParrent.Checked;

            obj_news.News_IsImages  = this.chkImages.Checked;
            obj_news.News_IsVideo   = this.chkVideo.Checked;
            obj_news.News_IsHistory = this.chkHistorys.Checked;
            //obj_news.News_TienNB = 0;
            //int tien = 0;
            //if (this.txtTienNhuanBut.Text.Trim().Length > 0)
            //{
            //    tien = int.Parse(txtTienNhuanBut.Text.Replace(",", ""));
            //    if (tien > 0)
            //    {
            //        obj_news.News_TienNB = tien;
            //        obj_news.News_Ngaycham = DateTime.Now;
            //        obj_news.News_NguoichamNBID = _user.UserID;
            //    }
            //    else
            //    {
            //        obj_news.News_TienNB = 0;
            //        obj_news.News_NguoichamNBID = 0;
            //    }
            //}
            if (txt_noidung.Text.Length > 0)
            {
                obj_news.News_Body = txt_noidung.Text.Trim();
            }
            obj_news.News_PublishNumber = DateTime.Now.Month;
            obj_news.News_PublishYear   = DateTime.Now.Year;
            if (txtThumbnail.Text.Length > 0)
            {
                obj_news.Images_Summary = this.txtThumbnail.Text.Trim();
            }
            obj_news.News_AuthorName = UltilFunc.CleanFormatTags(txt_Author_name.Text);
            //obj_news.News_DateCreated = DateTime.Now;
            if (obj_news.News_Status != 55)
            {
                obj_news.News_DateEdit = DateTime.Now;
            }
            else
            {
                obj_news.News_DateEdit = obj_news.News_DateEdit;
            }
            obj_news.News_EditorID = _user.UserID;
            //obj_news.News_DatePublished = DateTime.Now;
            //obj_news.News_AuthorID = _user.UserID;
            //obj_news.News_PublishedID = _user.UserID;
            //obj_news.News_Paper_ID = 0;
            int       butdanhID = 0;
            T_Butdanh obj_BD    = new T_Butdanh();

            HPCBusinessLogic.DAL.T_ButdanhDAL obj = new HPCBusinessLogic.DAL.T_ButdanhDAL();
            if (!string.IsNullOrEmpty(txt_Author_name.Text.Trim()))
            {
                obj_BD.BD_ID   = 0;
                obj_BD.BD_Name = txt_Author_name.Text.Trim();
                obj_BD.UserID  = _user.UserID;
                butdanhID      = obj.Insert_Butdang(obj_BD);
            }
            obj_news.News_TacgiaID = butdanhID;
            obj_news.News_Comment  = UltilFunc.CleanFormatTags(Txt_Comments.Text);
            obj_news.Keywords      = this.txtTukhoa.Text;
            obj_news.News_IsHot    = this.chkNewsIsHot.Checked;
            obj_news.News_IsFocus  = this.chkNewsIsFocus.Checked;
            int tab = 0;

            if (Page.Request["Tab"] != null)
            {
                tab = Convert.ToInt32(Page.Request["Tab"].ToString());
            }
            if (tab == 0)
            {
                obj_news.News_Status = ConstNews.NewsApproving_tk;
            }
            else if (tab == -1)
            {
                obj_news.News_Status = ConstNews.NewsApproving_tk;
            }
            else if (tab == 1)
            {
                obj_news.News_Status = ConstNews.NewsReturn_tk;
            }
            else if (tab == 3)
            {
                obj_news.News_Status = ConstNews.NewsDelete;
            }
            else if (tab == 10)
            {
                obj_news.News_Status = ConstNews.NewsPublishing;
            }
            //Add By nvthai
            obj_news.News_Realate       = ReturnFilterListRelation();
            obj_news.News_PhotoAtt      = txtVideoPath.Text;
            obj_news.News_DescImages    = txtChuthichanh.Text;
            obj_news.Image_Hot          = cbHienthiAnh.Checked;
            obj_news.News_Nguon         = txtNguon.Text;
            obj_news.News_DisplayMobile = cbDisplayMobile.Checked;
            obj_news.News_Delete        = cbMoreViews.Checked;
            return(obj_news);
        }
        private double Insert(Boolean _send)
        {
            T_News    obj;
            T_NewsDAL tt_DAL  = new T_NewsDAL();
            int       news_id = 0;

            if (Page.Request.Params["id"] != null)
            {
                news_id = Convert.ToInt32(Page.Request["id"]);
            }
            if (_send)
            {
                obj = SetItem(ConstNews.NewsApproving_tb);
            }
            else
            {
                obj = SetItem(ConstNews.NewsReturn);
            }
            if (obj.News_ID > 0)
            {
                obj.News_ID = tt_DAL.InsertT_news(obj);
                if (_send)
                {
                    //if (obj.Lang_ID == 1)
                    //{
                    //    obj.News_Status = ConstNews.NewsApproving_tbt;
                    //    SendPub(double.Parse(obj.News_ID.ToString()), ConstNews.NewsApproving_tbt);
                    //    WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, obj.News_Tittle,
                    //        Request["Menu_ID"].ToString(), "[Trình bày tin bài] [Tin bài đang chờ trình bày] [Gửi Duyệt tin bài]", obj.News_ID, ConstAction.BaoDT);
                    //}
                    //else
                    //{
                    obj.News_Status = ConstNews.NewsApproving_tb;
                    SendPub(double.Parse(obj.News_ID.ToString()), ConstNews.NewsApproving_tb);
                    WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, obj.News_Tittle,
                                                                   Request["Menu_ID"].ToString(), "[Trình bày tin bài] [Tin bài đang chờ trình bày] [Gửi Biên tập tin bài]", obj.News_ID, ConstAction.BaoDT);
                    //}
                }
                else
                {
                    obj.News_Status = ConstNews.NewsReturn;
                    SendPub(double.Parse(obj.News_ID.ToString()), ConstNews.NewsReturn);
                    WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, obj.News_Tittle,
                                                                   Request["Menu_ID"].ToString(), "[Trình bày tin bài] [Tin bài đang chờ trình bày] [Trả lại người nhập tin]", obj.News_ID, ConstAction.BaoDT);
                }
                return(double.Parse(obj.News_ID.ToString()));
            }
            else
            {
                return(0);
            }
            //T_News obj;
            //HPCBusinessLogic.DAL.T_NewsDAL tt_DAL = new HPCBusinessLogic.DAL.T_NewsDAL();
            //obj = SetItem();
            //obj.News_ID = tt_DAL.InsertT_news(obj);
            //int tab = 0;
            //if (_send)
            //{
            //    SendPub(double.Parse(obj.News_ID.ToString()));
            //    if (Page.Request["Tab"] != null)
            //        tab = Convert.ToInt32(Page.Request["Tab"].ToString());
            //    if (tab == 1)
            //    {
            //        WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, obj.News_Tittle,
            //                Request["Menu_ID"].ToString(), "[Viết bài mới] [Cập nhật tin bài bị trả lại] [Thao tác gửi thư ký duyệt]", obj.News_ID);
            //    }
            //    else
            //    {
            //        WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, obj.News_Tittle,
            //                Request["Menu_ID"].ToString(), "[Viết bài mới] [Cập nhật tin bài] [Thao tác gửi thư ký duyệt]", obj.News_ID);
            //    }
            //}
            //return double.Parse(obj.News_ID.ToString());
        }
        protected void PopulateItem(int _ID)
        {
            //Lấy ID trong T_AutoSave
            AutoSavesDAL _dal        = new AutoSavesDAL();
            int          id_autoSave = _dal.Get_ID_AutoSave(_ID, _user.UserID);

            txtID.Text = id_autoSave.ToString();
            //end
            T_News    obj_T_news = new T_News();
            T_NewsDAL ObjDAl     = new T_NewsDAL();

            obj_T_news                = ObjDAl.load_T_news(_ID);
            this.Txt_tieude.Text      = obj_T_news.News_Tittle.ToString();
            this.txtTukhoa.Text       = ObjDAl.GetKeywordsByNewsID(_ID);
            this.txt_TieuDePhu.Text   = obj_T_news.News_Sub_Title.ToString();
            this.txt_tomtat.Text      = obj_T_news.News_Summary.ToString();
            this.txt_noidung.Text     = obj_T_news.News_Body.ToString();
            this.Txt_Comments.Text    = obj_T_news.News_Comment.ToString();
            this.txt_Author_name.Text = obj_T_news.News_AuthorName.ToString();
            this.txtThumbnail.Text    = obj_T_news.Images_Summary;
            if (obj_T_news.Images_Summary.Length > 0)
            {
                this.ImgTemp.Src = HPCComponents.Global.UploadPathBDT + obj_T_news.Images_Summary;
            }
            else
            {
                this.ImgTemp.Attributes.CssStyle.Add("display", "none");
            }

            this.cbo_lanquage.SelectedValue = obj_T_news.Lang_ID.ToString();

            this.chk_IsCategorys.Checked       = obj_T_news.News_IsCategorys;
            this.chk_IsHomePages.Checked       = obj_T_news.News_IsHomePages;
            this.chk_IsCategoryParrent.Checked = obj_T_news.News_IsCategoryParrent;
            this.chkNewsIsFocus.Checked        = obj_T_news.News_IsFocus;
            this.chkNewsIsHot.Checked          = obj_T_news.News_IsHot;
            this.chkHistorys.Checked           = obj_T_news.News_IsHistory;
            this.chkImages.Checked             = obj_T_news.News_IsImages;
            this.chkVideo.Checked = obj_T_news.News_IsVideo;
            //if (obj_T_news.News_TienNB > 0.0)
            //    this.txtTienNhuanBut.Text = string.Format("{0:#,#}", obj_T_news.News_TienNB).Replace(".", ",");
            this.cbo_chuyenmuc.Items.Clear();
            if (cbo_lanquage.SelectedIndex > 0)
            {
                UltilFunc.BindCombox(cbo_chuyenmuc, "Ma_ChuyenMuc", "Ten_ChuyenMuc", "T_ChuyenMuc", string.Format("  HoatDong = 1 and HienThi_BDT = 1 and Ma_AnPham= " + this.cbo_lanquage.SelectedValue + "  AND Ma_ChuyenMuc IN ({0})", UltilFunc.GetCategory4User(_user.UserID)), CommonLib.ReadXML("lblTatca"), "Ma_Chuyenmuc_Cha", " Order by ThuTuHienThi ASC");
                cbo_chuyenmuc.UpdateAfterCallBack = true;
                cbo_chuyenmuc.SelectedIndex       = CommonLib.GetIndexControl(cbo_chuyenmuc, obj_T_news.CAT_ID.ToString());
            }
            else
            {
                this.cbo_chuyenmuc.DataSource = null;
                this.cbo_chuyenmuc.DataBind();
                this.cbo_chuyenmuc.UpdateAfterCallBack = true;
            }
            //bind bai viet lien quan
            if (obj_T_news.News_Realate.ToString().Trim().Length > 0)
            {
                txtListID.Text = obj_T_news.News_Realate.ToString().Trim().Replace(",0", "");
            }
            LoadNewRealation();
            //Add By nvthai
            //obj_T_news.News_Priority == 1;
            txtVideoPath.Text            = obj_T_news.News_PhotoAtt;
            txtChuthichanh.Text          = obj_T_news.News_DescImages;
            this.cbHienthiAnh.Checked    = obj_T_news.Image_Hot;
            this.txtNguon.Text           = obj_T_news.News_Nguon;
            this.cbDisplayMobile.Checked = obj_T_news.News_DisplayMobile;
            this.cbMoreViews.Checked     = obj_T_news.News_Delete;
            int Copyfrom = obj_T_news.News_CopyFrom;

            if (Copyfrom > 0)
            {
                ChuyenmucDAL _catDAL = new ChuyenmucDAL();
                int          catID   = ObjDAl.load_T_news(Copyfrom).CAT_ID;
                lblcm.Text = HPCBusinessLogic.UltilFunc.GetCategoryName(catID);
            }
            else
            {
                lblcm.Text = "";
            }
            if (ObjDAl.Get_NewsVersion(ObjDAl.load_T_news(Convert.ToInt32(_ID)).News_CopyFrom, 7, 92) ||
                ObjDAl.Get_NewsVersion(ObjDAl.load_T_news(Convert.ToInt32(_ID)).News_CopyFrom, 7, 82))
            {
                btn_Layout.Visible = true;
            }
            else
            {
                btn_Layout.Visible = false;
            }
        }