コード例 #1
0
        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());
            }
        }
コード例 #2
0
        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());
        }