Пример #1
0
        private void PublisherNews(DataGrid dgr)
        {
            foreach (DataGridItem m_Item in dgr.Items)
            {
                CheckBox chk_Select = (CheckBox)m_Item.FindControl("optSelect");
                HPCBusinessLogic.DAL.T_NewsDAL tt = new HPCBusinessLogic.DAL.T_NewsDAL();
                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());
                    tt.IsLock(News_ID, 0);
                    tt.UpdateStatus_T_News_ex_New_HV(News_ID, ConstNews.NewsPublishing, _user.UserID, DateTime.Now);
                    tt.Insert_Version_From_T_News_WithUserModify(News_ID, ConstNews.NewsUnPublishing, ConstNews.NewsPublishing, _user.UserID);
                    WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, linkname.Text,
                                                                   Request["Menu_ID"].ToString(), "[Xuất bản] [Danh sách tin bài hủy đăng] [Đăng bài]", News_ID, ConstAction.BaoDT);
                    #region Sync
                    HPCBusinessLogic.DAL.T_NewsDAL _untilDAL = new HPCBusinessLogic.DAL.T_NewsDAL();
                    HPCInfo.T_News _obj = new HPCInfo.T_News();
                    _obj = _untilDAL.GetOneFromT_NewsByID(News_ID);
                    // DONG BO FILE
                    SynFiles _syncfile = new SynFiles();
                    if (_obj.Images_Summary.Length > 0)
                    {
                        _syncfile.SynData_UploadImgOne(_obj.Images_Summary, Global.ImagesService);
                    }

                    //Cap nhat anh trong bai viet - vao may dong bo
                    if (_obj.News_Body.Length > 5)
                    {
                        _syncfile.SearchImgTag(_obj.News_Body);
                        _syncfile.SearchTagSwf(_obj.News_Body);
                        _syncfile.SearchTagFLV(_obj.News_Body);
                    }
                    //END
                    #endregion
                }
            }
            //Tao cache
            //UltilFunc.GenCacheHTML();
            this.LoadData_UnPublisher();
        }
Пример #2
0
        //end

        #endregion

        #region Event click
        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;
                }
            }
            if (Page.IsValid)
            {
                HPCBusinessLogic.DAL.T_NewsDAL _untilDAL = new HPCBusinessLogic.DAL.T_NewsDAL();
                T_News _objSet = null;
                int    tab     = 0;
                if (Request["Tab"] != null)
                {
                    tab = Convert.ToInt32(Request["Tab"].ToString());
                }
                if (tab == 0)
                {
                    _objSet = SetItem(ConstNews.NewsPublishing);
                }
                else
                {
                    _objSet = SetItem(ConstNews.NewsUnPublishing);
                }
                UltilFunc.Insert_News_Image(txt_noidung.Text.Trim(), Convert.ToDouble(Page.Request["id"]));
                int _return = _untilDAL.InsertT_newsXb(_objSet);
                //key words
                InsertKeyword(_return, _user.UserID);
                if (_objSet.Images_Summary.ToString().Length > 0)
                {
                    this.ImgTemp.Src = HPCComponents.Global.TinPathBDT + "/" + _objSet.Images_Summary;
                }
                _untilDAL.IsLock(_return, 1, _user.UserID);//dung them vao de giu trang thai lock khi dang lam viec voi tin bai
                if (_objSet.News_Status != ConstNews.NewsPublishing)
                {
                    WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, _objSet.News_Tittle,
                                                                   Request["Menu_ID"].ToString(), "[Bài ngừng đăng] [Sửa bài ngừng xuất bản]", _objSet.News_ID, ConstAction.BaoDT);
                }
                else
                {
                    //Tao cache
                    //UltilFunc.GenCacheHTML();
                    WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, _objSet.News_Tittle,
                                                                   Request["Menu_ID"].ToString(), "[Bài đang xuất bản] [Sửa bài đang xuất bản]", _objSet.News_ID, ConstAction.BaoDT);
                }
                if (Request["Tab"].ToString() == "0")
                {
                    #region Sync
                    // DONG BO FILE
                    SynFiles _syncfile = new SynFiles();
                    if (_objSet.Images_Summary.Length > 0)
                    {
                        _syncfile.SynData_UploadImgOne(_objSet.Images_Summary, HPCComponents.Global.ImagesService);
                    }

                    //Cap nhat anh trong bai viet - vao may dong bo
                    if (_objSet.News_Body.Length > 5)
                    {
                        _syncfile.SearchImgTag(_objSet.News_Body);
                        _syncfile.SearchTagSwf(_objSet.News_Body);
                        _syncfile.SearchTagFLV(_objSet.News_Body);
                    }
                    //END
                    #endregion
                }
                if (Request["Tab"] != null && Request["Tab"].ToString() != "" && Request["Tab"].ToString() != String.Empty)
                {
                    Response.Redirect("PublishedEdit.aspx?Menu_ID=" + Request["Menu_ID"].ToString() + "&Tab=" + Page.Request["Tab"].ToString() + "&ID=" + _return.ToString());
                }
                else
                {
                    Response.Redirect("PublishedEdit.aspx?Menu_ID=" + Request["Menu_ID"].ToString() + "&ID=" + _return.ToString());
                }
            }
        }
Пример #3
0
        protected void btnXuatban_Click(object sender, EventArgs e)
        {
            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;
                }
            }
            if (Page.IsValid)
            {
                HPCBusinessLogic.DAL.T_NewsDAL _untilDAL = new HPCBusinessLogic.DAL.T_NewsDAL();
                T_News _objSet = SetItem(ConstNews.NewsPublishing);
                int    _return = _untilDAL.InsertT_news_ByRollXb(_objSet);
                UltilFunc.Insert_News_Image(txt_noidung.Text.Trim(), Convert.ToDouble(_return.ToString()));
                //key words
                InsertKeyword(_return, _user.UserID);
                _untilDAL.Insert_Version_From_T_News_WithUserModify(Convert.ToDouble(_return), ConstNews.NewsAppro_tbt, ConstNews.NewsPublishing, _user.UserID);
                WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, _objSet.News_Tittle,
                                                               Request["Menu_ID"].ToString(), "[Duyệt tin bài] [Tin bài chờ xuất bản] [Thao tác xuất bản]", _return, ConstAction.BaoDT);
                new T_NewsDAL().IsLock(Convert.ToDouble(_objSet.News_ID), 0, 0); //UNLOCK
                //Tao cache
                //UltilFunc.GenCacheHTML();
                #region Sync
                // DONG BO FILE
                try
                {
                    SynFiles _syncfile = new SynFiles();
                    if (_objSet.Images_Summary.Length > 0)
                    {
                        _syncfile.SynData_UploadImgOne(_objSet.Images_Summary, HPCComponents.Global.ImagesService);
                    }

                    //Cap nhat anh trong bai viet - vao may dong bo
                    if (_objSet.News_Body.Length > 5)
                    {
                        _syncfile.SearchImgTag(_objSet.News_Body);
                        _syncfile.SearchTagSwf(_objSet.News_Body);
                        _syncfile.SearchTagFLV(_objSet.News_Body);
                    }
                }
                catch (Exception)
                {
                    throw;
                }

                //END
                #endregion
                linkExit_Click(sender, e);
            }
        }