protected void dgr_tintuc1_EditCommand(object source, DataGridCommandEventArgs e) { HPCBusinessLogic.DAL.T_NewsDAL tt = new HPCBusinessLogic.DAL.T_NewsDAL(); T_News _obj_T_News = new T_News(); switch (e.CommandArgument.ToString().ToLower()) { case "downloadalias": LoadFileDoc(Convert.ToInt32(this.dgr_tintuc1.DataKeys[e.Item.ItemIndex].ToString())); break; case "edit": { string _ID = dgr_tintuc1.DataKeys[e.Item.ItemIndex].ToString(); _obj_T_News = tt.load_T_news(Convert.ToInt32(_ID)); if (_obj_T_News.News_Lock) { if (_obj_T_News.News_EditorID == _user.UserID) { //Lock tt.IsLock(Convert.ToInt32(_ID), 1, _user.UserID); Response.Redirect("PublishedEdit.aspx?Menu_ID=" + Request["Menu_ID"].ToString() + "&ID=" + _ID.ToString() + "&Tab=0"); } else { System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('Bài đang có người làm việc!.');", true); return; } } else { //Lock tt.IsLock(Convert.ToInt32(_ID), 1, _user.UserID); Response.Redirect("PublishedEdit.aspx?Menu_ID=" + Request["Menu_ID"].ToString() + "&ID=" + _ID.ToString() + "&Tab=0"); } } break; case "copycm": { ddlLang.Items.Clear(); UltilFunc.BindCombox(this.ddlLang, "Ma_AnPham", "Ten_AnPham", "T_AnPham", " 1=1 ", CommonLib.ReadXML("lblTatca")); if (this.ddlLang.Items.Count >= 3) { this.ddlLang.SelectedIndex = HPCComponents.Global.DefaultLangID; } else { this.ddlLang.SelectedIndex = UltilFunc.GetIndexControl(this.ddlLang, HPCComponents.Global.DefaultCombobox); } NewsID = Convert.ToDouble(this.dgr_tintuc1.DataKeys[e.Item.ItemIndex].ToString()); LoadCM(); ModalPopupExtender1.Show(); } break; } }
public static string GetNews_IDFrom_NewsID_Version(int News_ID, int intFieldIndex) { string str = ""; T_NewsDAL dalnews = new T_NewsDAL(); try { DataSet ds = HPCDataProvider.Instance().GetStoreDataSet("[CMS_getSenderIDFrom_NewsID]", new string[] { "@News_ID" }, new object[] { News_ID }); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { if (intFieldIndex == 0) { str = UltilFunc.GetUserName(int.Parse(dt.Rows[0]["News_EditorID"].ToString())); } else { str = Convert.ToDateTime(dt.Rows[0]["News_DateEdit"]).ToString("dd/MM/yyyy HH:mm"); } } else { if (intFieldIndex == 0) { int EditorID = dalnews.load_T_news(News_ID).News_EditorID; str = UltilFunc.GetUserName(EditorID); } else { str = Convert.ToDateTime(dalnews.load_T_news(News_ID).News_DateEdit).ToString("dd/MM/yyyy HH:mm"); } } return(str); } catch (Exception ex) { throw ex; } }
public void LoadFileDoc(int _ID) { string strHTML = ""; HPCBusinessLogic.DAL.T_NewsDAL dal = new HPCBusinessLogic.DAL.T_NewsDAL(); T_News obj = dal.load_T_news(_ID); strHTML += "<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b>" + obj.News_Tittle + "<o:p></o:p></b></p>"; strHTML += "<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><br>" + obj.News_Summary + "<u1:p></u1:p></b></p>"; strHTML += "<p style='text-align:justify'>" + obj.News_Body + "<o:p></o:p></p>"; if (strHTML.Length > 0) { SaveAsText(strHTML); } }
//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; } }
private void DelRecordsCheckedBox() { HPCBusinessLogic.DAL.T_NewsDAL tt = new HPCBusinessLogic.DAL.T_NewsDAL(); T_News _obj_T_News = new T_News(); if (TabContainer1.ActiveTabIndex == 1) { foreach (DataGridItem m_Item in dgListNewsUnPublish.Items) { CheckBox chk_Select = (CheckBox)m_Item.FindControl("optSelect"); if (chk_Select != null && chk_Select.Checked) { _obj_T_News = tt.load_T_news(Convert.ToInt32(dgListNewsUnPublish.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString())); if (_obj_T_News.News_Lock) { if (_obj_T_News.News_EditorID == _user.UserID) { double News_ID = double.Parse(dgListNewsUnPublish.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString()); tt.Update_Status_tintuc(News_ID, 55, _user.UserID, DateTime.Now); WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, _obj_T_News.News_Tittle, Request["Menu_ID"].ToString(), "[Bài đang xuất bản] [Danh sách tin bài ngừng đăng] [Xóa bài]", _obj_T_News.News_ID, ConstAction.BaoDT); } else { System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('Bài đang có người làm việc!');", true); return; } } else { double News_ID = double.Parse(dgListNewsUnPublish.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString()); tt.Update_Status_tintuc(News_ID, 55, _user.UserID, DateTime.Now); WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, _obj_T_News.News_Tittle, Request["Menu_ID"].ToString(), "[Bài đang xuất bản] [Danh sách tin bài ngừng đăng] [Xóa bài]", _obj_T_News.News_ID, ConstAction.BaoDT); } } } } this.LoadData_UnPublisher(); }
protected T_News SetItem() { HPCBusinessLogic.DAL.T_NewsDAL Dal = new HPCBusinessLogic.DAL.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()); obj_news.News_EditorID = _user.UserID; obj_news = Dal.load_T_news(int.Parse(Request["id"])); if (obj_news.News_Status != 55) { obj_news.News_DateEdit = DateTime.Now; } else { obj_news.News_DateEdit = obj_news.News_DateEdit; } } else { obj_news.News_ID = 0; obj_news.News_DateCreated = DateTime.Now; obj_news.News_AuthorID = _user.UserID; } if (Txt_tieude.Text.Length > 0) { obj_news.News_Tittle = UltilFunc.CleanFormatTags(Txt_tieude.Text); } if (txt_TieuDePhu.Text.Length > 0) { 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_IsImages = this.chkImages.Checked; obj_news.News_IsVideo = this.chkVideo.Checked; obj_news.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.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; } obj_news.Images_Summary = this.txtThumbnail.Text.Trim(); obj_news.News_AuthorName = UltilFunc.CleanFormatTags(txt_Author_name.Text); 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.News_TacgiaID = butdanhID; obj_news.News_Comment = UltilFunc.CleanFormatTags(Txt_Comments.Text); //obj_news.Keywords = this.txtTukhoa.Text; 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_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.AddNew; } else if (tab == -1) { obj_news.News_Status = ConstNews.AddNew; } else if (tab == 1) { obj_news.News_Status = ConstNews.NewsReturn; } else if (tab == 3) { obj_news.News_Status = ConstNews.NewsDelete; } obj_news.News_Realate = ReturnFilterListRelation(); //Add By nvthai obj_news.News_Priority = 1; 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); }
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(); HPCBusinessLogic.DAL.T_NewsDAL ObjDAl = new HPCBusinessLogic.DAL.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.ToString().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() != "") { 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; }
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 HPCBusinessLogic.DAL.T_NewsDAL _untilDAL = new HPCBusinessLogic.DAL.T_NewsDAL(); HPCInfo.T_News _obj = new T_News(); _obj = _untilDAL.load_T_news(_id); if (_obj != null) { cbo_lanquage.SelectedIndex = UltilFunc.GetIndexControl(cbo_lanquage, _obj.Lang_ID.ToString()); 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 Ten_ChuyenMuc ASC"); cbo_chuyenmuc.UpdateAfterCallBack = true; cbo_chuyenmuc.SelectedIndex = CommonLib.GetIndexControl(cbo_chuyenmuc, _obj.CAT_ID.ToString()); } else { this.cbo_chuyenmuc.DataSource = null; this.cbo_chuyenmuc.DataBind(); this.cbo_chuyenmuc.UpdateAfterCallBack = true; } this.txt_Author_name.Text = _obj.News_AuthorName; this.Txt_tieude.Text = _obj.News_Tittle; this.txt_TieuDePhu.Text = _obj.News_Sub_Title; this.txt_noidung.Text = _obj.News_Body; //this.ddlNews_Priority.SelectedValue = _obj.News_Priority.ToString(); this.chk_IsCategorys.Checked = _obj.News_IsCategorys; this.chk_IsHomePages.Checked = _obj.News_IsHomePages; this.chk_IsCategoryParrent.Checked = _obj.News_IsCategoryParrent; this.chkHistorys.Checked = _obj.News_IsHistory; this.chkImages.Checked = _obj.News_IsImages; this.chkVideo.Checked = _obj.News_IsVideo; //if (_obj.News_TienNB > 0.0) // this.txtTienNhuanBut.Text = _obj.News_TienNB.ToString(); //System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "Comma('" + txtTienNhuanBut.ClientID + "');", true); if (_obj.News_TienNB > 0.0) { this.txtTienNhuanBut.Text = string.Format("{0:#,#}", _obj.News_TienNB).Replace(".", ","); } //this.ddlNews_IsType.SelectedValue = _obj.News_IsType.ToString(); this.chkNewsIsFocus.Checked = _obj.News_IsFocus; this.chkNewsIsHot.Checked = _obj.News_IsHot; if (_obj.Images_Summary.Length > 0) { this.ImgTemp.Src = HPCComponents.Global.TinPathBDT + "/" + _obj.Images_Summary; } else { this.ImgTemp.Attributes.CssStyle.Add("display", "none"); } this.Txt_Comments.Text = _obj.News_Comment; this.txt_tomtat.Text = _obj.News_Summary; this.txtThumbnail.Text = _obj.Images_Summary; this.txtTukhoa.Text = _untilDAL.GetKeywordsByNewsID(_id); //bind bai viet lien quan if (_obj.News_Realate.ToString().Trim() != "") { txtListID.Text = _obj.News_Realate.ToString().Trim().Replace(",0", ""); } LoadNewRealation(); txtVideoPath.Text = _obj.News_PhotoAtt; txtChuthichanh.Text = _obj.News_DescImages; this.cbHienthiAnh.Checked = _obj.Image_Hot; this.txtNguon.Text = _obj.News_Nguon; this.cbDisplayMobile.Checked = _obj.News_DisplayMobile; this.cbMoreViews.Checked = _obj.News_Delete; } }
private 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 HPCBusinessLogic.DAL.T_NewsDAL _untilDAL = new HPCBusinessLogic.DAL.T_NewsDAL(); HPCInfo.T_News _obj = new T_News(); _obj = _untilDAL.load_T_news(_id); if (_obj != null) { this.txt_Author_name.Text = _obj.News_AuthorName; this.Txt_tieude.Text = _obj.News_Tittle; this.txt_TieuDePhu.Text = _obj.News_Sub_Title; this.txt_noidung.Text = _obj.News_Body; //this.ddlNews_Priority.SelectedValue = _obj.News_Priority.ToString(); this.chk_IsCategorys.Checked = _obj.News_IsCategorys; this.chk_IsHomePages.Checked = _obj.News_IsHomePages; this.chk_IsCategoryParrent.Checked = _obj.News_IsCategoryParrent; this.chkHistorys.Checked = _obj.News_IsHistory; this.chkImages.Checked = _obj.News_IsImages; this.chkVideo.Checked = _obj.News_IsVideo; if (_obj.News_TienNB > 0.0) { this.txtTienNhuanBut.Text = string.Format("{0:#,#}", _obj.News_TienNB).Replace(".", ","); } //this.ddlNews_IsType.SelectedValue = _obj.News_IsType.ToString(); this.chkNewsIsFocus.Checked = _obj.News_IsFocus; this.chkNewsIsHot.Checked = _obj.News_IsHot; if (_obj.Images_Summary.Length > 0) { this.ImgTemp.Src = HPCComponents.Global.UploadPathBDT + _obj.Images_Summary; } else { this.ImgTemp.Attributes.CssStyle.Add("display", "none"); } this.Txt_Comments.Text = _obj.News_Comment; this.txt_tomtat.Text = _obj.News_Summary; this.txtThumbnail.Text = _obj.Images_Summary; this.txtTukhoa.Text = _untilDAL.GetKeywordsByNewsID(_id); this.cbo_lanquage.SelectedValue = _obj.Lang_ID.ToString(); 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 Ten_ChuyenMuc ASC"); cbo_chuyenmuc.UpdateAfterCallBack = true; cbo_chuyenmuc.SelectedIndex = CommonLib.GetIndexControl(cbo_chuyenmuc, _obj.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.News_Realate.ToString().Trim() != "") { txtListID.Text = _obj.News_Realate.ToString().Trim().Replace(",0", ""); } LoadNewRealation(); txtVideoPath.Text = _obj.News_PhotoAtt; txtChuthichanh.Text = _obj.News_DescImages; this.cbHienthiAnh.Checked = _obj.Image_Hot; this.txtNguon.Text = _obj.News_Nguon; this.cbDisplayMobile.Checked = _obj.News_DisplayMobile; this.cbMoreViews.Checked = _obj.News_Delete; //if (_obj.Image_Hot) // this.cbHienthiAnh.Text = "Hiển thị trong tin chi tiết"; //else // this.cbHienthiAnh.Text = "Không hiển thị trong tin chi tiết"; if (_obj.News_DatePublished.ToString() != "1/1/0001 12:00:00 AM" && _obj.News_DatePublished.ToString() != "01/01/0001 12:00:00 SA") { this.txtTimeXB.Text = _obj.News_DatePublished.ToString("dd/MM/yyyy HH:mm"); } if (_untilDAL.Get_NewsVersion(_untilDAL.load_T_news(Convert.ToInt32(_id)).News_CopyFrom, 7, 92) || _untilDAL.Get_NewsVersion(_untilDAL.load_T_news(Convert.ToInt32(_id)).News_CopyFrom, 7, 82)) { btn_Layout.Visible = true; } else { btn_Layout.Visible = false; } } }