private T_News SetItem(double id) { T_News obj_news = new T_News(); T_Idiea _objIdiea = new T_Idiea(); HPCBusinessLogic.DAL.T_IdieaDAL _IdieaDAL = new HPCBusinessLogic.DAL.T_IdieaDAL(); _objIdiea = _IdieaDAL.GetOneFromT_IdieaByID(int.Parse(id.ToString())); obj_news.News_Tittle = _objIdiea.Title; obj_news.CAT_ID = _objIdiea.Cat_ID; obj_news.Lang_ID = _objIdiea.Lang_ID; obj_news.News_Body = _objIdiea.Diea_Articles; obj_news.News_PublishNumber = int.Parse(DateTime.Now.Month.ToString()); obj_news.News_PublishYear = int.Parse(DateTime.Now.Year.ToString()); obj_news.News_DateCreated = DateTime.Now; obj_news.News_DateEdit = DateTime.Now; obj_news.News_DatePublished = DateTime.Now; obj_news.News_DateApproved = DateTime.Now; obj_news.News_AuthorID = _objIdiea.User_Created; obj_news.News_AprovedID = _user.UserID; obj_news.News_EditorID = _user.UserID; obj_news.News_PublishedID = _user.UserID; obj_news.News_CopyFrom = 0; obj_news.News_Status = 22; return(obj_news); }
//获取前台数据封装成对象 private T_News GetModel(HttpContext context) { T_News model = new T_News(); try { model.Id = int.Parse(context.Request.Form["Id"].ToString()); } catch { } model.AdminUserId = admin.Id; try { model.NewsTypeId = int.Parse(context.Request.Form["NewsTypeId"].ToString()); } catch { } model.Keyword = context.Request.Form["Keyword"].ToString(); model.Content = context.Request.Form["Content"].ToString(); model.UnitCode = context.Request.Form["UnitCode"].ToString(); model.NewsTitle = context.Request.Form["NewsTitle"].ToString(); model.NewsSubheading = context.Request.Form["NewsSubheading"].ToString(); model.NewsSource = context.Request.Form["NewsSource"].ToString(); model.NewsContent = context.Request.Form["NewsContent"].ToString(); model.NewsImg = new UpLoadImg().uploadpeopleimg("175", "175"); try { model.NumClicks = int.Parse(context.Request.Form["NumClicks"].ToString()); } catch { } model.IfShow = admin.IsCheck; try { model.IfHost = int.Parse(context.Request.Form["IfHost"].ToString()); } catch { } try { model.IfDel = int.Parse(context.Request.Form["IfDel"].ToString()); } catch { } try { model.IfUp = int.Parse(context.Request.Form["IfUp"].ToString()); } catch { } model.IsCheck = admin.IsCheck; model.Editor = admin.AdminLogName; return(model); }
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(); }
public static int UpdateNews(DtoNews model) { try { var news = new T_News() { Id = model.Id, CurReadTimes = model.CurReadTimes, LastDealTime = DateTime.Now, LastReadTimes = model.LastReadTimes, IsHot = model.IsHot, IsDeal = 1, TotalComments = model.TotalComments, NewsHotClass = model.NewsHotClass, IntervalMinutes = model.IntervalMinutes, GroupId = model.GroupId, }; return(Sql.Update(news, "Id={0}".Formats(model.Id))); } catch (Exception ex) { Log.Error(ex.Message + ex.StackTrace); } return(1); }
protected void Bindzc() { NCPEP.Bll.T_News newsbll = new T_News(); DataTable dt = newsbll.GetList(6, " NewsTypeId=2", "CreateDate desc").Tables[0]; //this.repzcfg.DataSource = dt; //this.repzcfg.DataBind(); }
public List <T_News> GetPageList(int start, int end) { string sql = "select * from (select row_number() over(order by id) as num,* from T_News) as t where t.num>=@start and t.num<=@end"; SqlParameter[] pars = { new SqlParameter("@start", SqlDbType.Int), new SqlParameter("@end", SqlDbType.Int) }; pars[0].Value = start; pars[1].Value = end; DataTable da = SqlHelper.GetTable(sql, CommandType.Text, pars); List <T_News> list = null; if (da.Rows.Count > 0) { list = new List <T_News>(); T_News newInfo = null; foreach (DataRow row in da.Rows) { newInfo = new T_News(); LoadEntity(row, newInfo); list.Add(newInfo); } } return(list); }
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); }
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; } }
private void LoadEntity(DataRow row, T_News newInfo) { newInfo.id = Convert.ToInt32(row["ID"]); newInfo.Author = row["Author"] != DBNull.Value ? row["Author"].ToString() : string.Empty; newInfo.Title = row["Title"] != DBNull.Value ? row["Title"].ToString() : string.Empty; newInfo.Msg = row["Msg"] != DBNull.Value ? row["Msg"].ToString() : string.Empty; newInfo.ImagePath = row["ImagePath"] != DBNull.Value ? row["ImagePath"].ToString() : string.Empty; newInfo.SubDateTime = Convert.ToDateTime(row["SubDateTime"]); }
protected void dgData_EditCommand(object source, DataGridCommandEventArgs e) { HPCBusinessLogic.DAL.T_NewsDAL tt = new HPCBusinessLogic.DAL.T_NewsDAL(); T_News _obj_T_News = new T_News(); T_NewsVersion _obj_T_NewsVecion = new T_NewsVersion(); if (e.CommandArgument.ToString().ToLower() == "downloadalias") { int _ID = Convert.ToInt32(this.dgr_tintuc.DataKeys[e.Item.ItemIndex].ToString()); LoadFileDoc(_ID); } Search(); }
public int InsertT_news_ByRollXb(T_News objNews) { int _inserted; try { _inserted = HPCDataProvider.Instance().InsertObjectReturn(objNews, "[CMS_InsertT_News_RollXb]"); } catch (Exception ex) { throw ex; } return(_inserted); }
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); } }
private void SendPub(double id, int _status) { T_News obj_T_News = new T_News(); HPCBusinessLogic.DAL.T_NewsDAL tt = new HPCBusinessLogic.DAL.T_NewsDAL(); if (_status == ConstNews.NewsApproving_tbt) { tt.Update_Status_tintuc(double.Parse(id.ToString()), _status, _user.UserID, DateTime.Now); } else { //Hungviet add tt.UpdateStatus_T_News_ex_New_HV(double.Parse(id.ToString()), _status, 0, DateTime.Now); } tt.Insert_Version_From_T_News_WithUserModify(double.Parse(id.ToString()), ConstNews.NewsAppro_tb, _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; } }
//获取单个对象 public T_News GetModel(int id) { try { string strSql = string.Format("select top 1 Id,AdminUserId,NewsTypeId,Keyword,Content,UnitCode,NewsTitle,NewsSubheading,NewsSource,NewsContent,NewsImg,NumClicks,IfShow,IfHost,IfDel,IfUp,IsCheck,Editor,CreateDate from T_News where Id={0}", id); T_News model = null; using (dynamic read = DbHelper.Factory().ExecuteReader(strSql.ToString())) { model = new T_News(); if (read.Read()) { model.Id = int.Parse(read["Id"].ToString()); try { model.AdminUserId = int.Parse(read["AdminUserId"].ToString()); } catch { } try { model.NewsTypeId = int.Parse(read["NewsTypeId"].ToString()); } catch { } model.Keyword = read["Keyword"].ToString(); model.Content = read["Content"].ToString(); model.UnitCode = read["UnitCode"].ToString(); model.NewsTitle = read["NewsTitle"].ToString(); model.NewsSubheading = read["NewsSubheading"].ToString(); model.NewsSource = read["NewsSource"].ToString(); model.NewsContent = read["NewsContent"].ToString(); model.NewsImg = read["NewsImg"].ToString(); try { model.NumClicks = int.Parse(read["NumClicks"].ToString()); } catch { } try { model.IfShow = int.Parse(read["IfShow"].ToString()); } catch { } try { model.IfHost = int.Parse(read["IfHost"].ToString()); } catch { } try { model.IfDel = int.Parse(read["IfDel"].ToString()); } catch { } try { model.IfUp = int.Parse(read["IfUp"].ToString()); } catch { } try { model.IsCheck = int.Parse(read["IsCheck"].ToString()); } catch { } model.Editor = read["Editor"].ToString(); try { model.CreateDate = DateTime.Parse(read["CreateDate"].ToString()); } catch { } } read.Dispose(); } return(model); } catch (Exception) { throw; } }
//更新新闻 public bool Update(T_News model) { try { object[] obj = { model.AdminUserId, model.NewsTypeId, model.Keyword, model.Content, model.UnitCode, model.NewsTitle, model.NewsSubheading, model.NewsSource, model.NewsContent, model.NewsImg, model.NumClicks, model.IfShow, model.IfHost, model.IfDel, model.IfUp, model.IsCheck, model.Editor, model.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"), model.Id }; string strSql = string.Format("update T_News set AdminUserId={0},NewsTypeId={1},Keyword='{2}',Content='{3}',UnitCode='{4}',NewsTitle='{5}',NewsSubheading='{6}',NewsSource='{7}',NewsContent='{8}',NewsImg='{9}',NumClicks={10},IfShow={11},IfHost={12},IfDel={13},IfUp={14},IsCheck={15},Editor='{16}',CreateDate='{17}' where Id={18}", obj); if (DbHelper.Factory().ExecuteNonQuery(strSql) > 0) { return(true); } else { return(false); } } catch { return(false); } }
//创建新闻 public bool Create(T_News model) { try { object[] obj = { model.AdminUserId, model.NewsTypeId, model.Keyword, model.Content, model.UnitCode, model.NewsTitle, model.NewsSubheading, model.NewsSource, model.NewsContent, model.NewsImg, model.NumClicks, model.IfShow, model.IfHost, model.IfDel, model.IfUp, model.IsCheck, model.Editor, model.CreateDate.ToString("yyyy-MM-dd HH:mm:ss") }; string strSql = string.Format("insert into T_News(AdminUserId,NewsTypeId,Keyword,Content,UnitCode,NewsTitle,NewsSubheading,NewsSource,NewsContent,NewsImg,NumClicks,IfShow,IfHost,IfDel,IfUp,IsCheck,Editor,CreateDate) values ({0},{1},'{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}',{10},{11},{12},{13},{14},{15},'{16}','{17}')", obj); if (DbHelper.Factory().ExecuteNonQuery(strSql) > 0) { return(true); } else { return(false); } } catch (Exception) { throw; } }
/// <summary> /// 获取一条记录 /// </summary> /// <param name="id"></param> /// <returns></returns> public T_News GetModel(int id) { string sql = "select * from T_News where id=@id"; SqlParameter[] pars = { new SqlParameter("@id", SqlDbType.Int) }; pars[0].Value = id; DataTable da = SqlHelper.GetTable(sql, CommandType.Text, pars); T_News newInfo = null; if (da.Rows.Count > 0) { newInfo = new T_News(); LoadEntity(da.Rows[0], newInfo); } return(newInfo); }
protected void dgData_EditCommand(object source, DataGridCommandEventArgs e) { ActionHistoryDAL actionDAL = new ActionHistoryDAL(); T_ActionHistory action = new T_ActionHistory(); HPCBusinessLogic.DAL.T_NewsDAL tt = new HPCBusinessLogic.DAL.T_NewsDAL(); T_News _obj_T_News = new T_News(); T_NewsVersion _obj_T_NewsVecion = new T_NewsVersion(); action.UserID = _user.UserID; action.FullName = _user.UserName; action.HostIP = IpAddress(); action.DateModify = DateTime.Now; if (e.CommandArgument.ToString().ToLower() == "edit") { int _ID = Convert.ToInt32(this.dgr_tintuc1.DataKeys[e.Item.ItemIndex].ToString()); LoadDetails(_ID, true, true, e.Item.ItemIndex, true); lbl_index.Text = e.Item.ItemIndex.ToString(); } }
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(); }
private void GuiTinBai(string MaDoiTuong) { string Thaotac = ""; string _trace = string.Empty; _obj = SetItem(MaDoiTuong, 1); txtID.Text = Convert.ToString(_Daltinbai.SP_UpdateT_TinBai_WordOnline(_obj)); _matinbai = double.Parse(txtID.Text.Trim()); if (MaDetai != 0) { _Daltinbai.InsertT_Vitri_Tinbai_FromT_Tinbai(0, 0, _matinbai, MaDetai); } SaveImagesAttachAll(); _trace = _Daltinbai.GetTrace(_matinbai) + Request["MaDoiTuong"] + "_" + _user.UserID + ";"; _Daltinbai.Update_Status_tintuc(_matinbai, 1, _user.UserID, DateTime.Now, MaDoiTuong, _trace); _Daltinbai.Insert_Phienban_From_T_Tinbai(_matinbai, _user.UserID, DateTime.Now, Request["MaDoiTuong"].ToString()); _Daltinbai.Insert_Tulieu_From_T_Tinbai(_matinbai); Thaotac = "Thao tác gửi tin bài từ " + CommonLib.GetTenDoiTuong(Request["MaDoiTuong"].ToString()) + " đến " + CommonLib.GetTenDoiTuong(MaDoiTuong.ToString()) + " - Tiêu đề:" + Txt_tieude.Text.Trim(); UltilFunc.Log_Thaotactinbai(_user.UserID, _user.UserFullName, DateTime.Now, Thaotac, _matinbai); UltilFunc.Log_Action(_user.UserID, _user.UserFullName, DateTime.Now, int.Parse(Request["Menu_ID"]), Thaotac); if (checkbaoonline.Checked) { HPCBusinessLogic.DAL.T_NewsDAL _T_NewsDAL = new HPCBusinessLogic.DAL.T_NewsDAL(); T_News _objT_News = SetItemBaoDienTu(_matinbai); int _returnvnonline = 0; // Insert sang bao dien tu if (_statusvnonline == int.Parse(CommonLib.ReadXML("Status_BDT")) || _statusvnonline == 0) { _returnvnonline = _T_NewsDAL.InsertT_news(_objT_News); _T_NewsDAL.Update_Status_tintuc(_returnvnonline, int.Parse(CommonLib.ReadXML("Status_BDT")), _user.UserID, DateTime.Now); UltilFunc.Insert_News_Image(_objT_News.News_Body.Trim(), Convert.ToDouble(_returnvnonline.ToString())); } //end } Response.Redirect("~/Quytrinh/List_PV.aspx?Menu_ID=" + Request["Menu_ID"].ToString() + "&MaDoiTuong=" + Request["MaDoiTuong"].ToString() + "&Tab=" + Request["Tab"]); }
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"); } }
private void Gui_Duyet() { ArrayList ar = new ArrayList(); HPCBusinessLogic.DAL.T_IdieaDAL _T_IdieaDAL = new HPCBusinessLogic.DAL.T_IdieaDAL(); string sOrder = GetOrderString() == "" ? "" : " ORDER BY " + GetOrderString(); if (TabContainer1.ActiveTabIndex == 0) { foreach (DataGridItem m_Item in dgr_tintuc1.Items) { CheckBox chk_select = (CheckBox)m_Item.FindControl("optSelect"); if (chk_select != null && chk_select.Checked) { ar.Add(double.Parse(dgr_tintuc1.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString())); } } } if (TabContainer1.ActiveTabIndex == 1) { foreach (DataGridItem m_Item in dgr_tintuc2.Items) { CheckBox chk_select = (CheckBox)m_Item.FindControl("optSelect"); if (chk_select != null && chk_select.Checked) { ar.Add(double.Parse(dgr_tintuc2.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString())); } } } if (TabContainer1.ActiveTabIndex == 2) { foreach (DataGridItem m_Item in dgDXL.Items) { CheckBox chk_select = (CheckBox)m_Item.FindControl("optSelect"); if (chk_select != null && chk_select.Checked) { ar.Add(double.Parse(dgDXL.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString())); } } } for (int i = 0; i < ar.Count; i++) { double Diea_ID = double.Parse(ar[i].ToString()); T_Idiea obj_Idiea = new T_Idiea(); obj_Idiea = _T_IdieaDAL.GetOneFromT_IdieaByID(int.Parse(Diea_ID.ToString())); if (obj_Idiea.Diea_Lock == true && obj_Idiea.User_Edit != _user.UserID) { FuncAlert.AlertJS(this, "Bài đang có người làm việc.!"); return; } _T_IdieaDAL.IsLock(Diea_ID, 0, _user.UserID, DateTime.Now); if (obj_Idiea.Diea_Stype == 2) { if (obj_Idiea.Number != 1) { _T_IdieaDAL.Update_Status_tintuc(Diea_ID, 22, _user.UserID, DateTime.Now, 0); _T_IdieaDAL.Insert_Version_From_T_idiea_WithUserModify(Diea_ID, 6, 22, _user.UserID, DateTime.Now); ActionsCode = "[Danh sách Đề tài đang chờ xử lý TBT:]-->[Gửi TPPV][Diea_ID:" + Diea_ID + "]"; UltilFunc.Log_Action(_user.UserID, _user.UserName, DateTime.Now, int.Parse(Request["Menu_ID"].ToString()), ActionsCode); } else { T_Idiea _objIdiea = new T_Idiea(); HPCBusinessLogic.DAL.T_IdieaDAL _IdieaDAL = new HPCBusinessLogic.DAL.T_IdieaDAL(); HPCBusinessLogic.DAL.T_NewsDAL _T_NewsDAL = new HPCBusinessLogic.DAL.T_NewsDAL(); T_News _objT_News = SetItem(Diea_ID); _T_NewsDAL.InsertT_news(_objT_News); ActionsCode = "[TBT chuyển bài viết đề tài]-->[TKTS][Diea_ID =" + Diea_ID + "]"; UltilFunc.Log_Action(_user.UserID, _user.UserName, DateTime.Now, int.Parse(Request["Menu_ID"].ToString()), ActionsCode); _T_IdieaDAL.Update_Status_tintuc(Diea_ID, 64, _user.UserID, DateTime.Now, 1); } } else { if (obj_Idiea.Number != 1) { _T_IdieaDAL.Update_Status_tintuc(Diea_ID, 52, _user.UserID, DateTime.Now, 0); _T_IdieaDAL.Insert_Version_From_T_idiea_WithUserModify(Diea_ID, 2, 52, _user.UserID, DateTime.Now); ActionsCode = "[TBT duyệt đề tài:]-->[Gửi TPBT][Diea_ID:" + Diea_ID + "]"; UltilFunc.Log_Action(_user.UserID, _user.UserName, DateTime.Now, int.Parse(Request["Menu_ID"].ToString()), ActionsCode); } else { T_Idiea _objIdiea = new T_Idiea(); HPCBusinessLogic.DAL.T_IdieaDAL _IdieaDAL = new HPCBusinessLogic.DAL.T_IdieaDAL(); HPCBusinessLogic.DAL.T_NewsDAL _T_NewsDAL = new HPCBusinessLogic.DAL.T_NewsDAL(); T_News _objT_News = SetItem(Diea_ID); _T_NewsDAL.InsertT_news(_objT_News); ActionsCode = "[TBT chuyển bài viết đề tài]-->[TKTS][Diea_ID =" + Diea_ID + "]"; UltilFunc.Log_Action(_user.UserID, _user.UserName, DateTime.Now, int.Parse(Request["Menu_ID"].ToString()), ActionsCode); _T_IdieaDAL.Update_Status_tintuc(Diea_ID, 64, _user.UserID, DateTime.Now, 1); } } } if (TabContainer1.ActiveTabIndex == 0) { LoadData_DangXuly(); } else if (TabContainer1.ActiveTabIndex == 1) { LoadData_DetaiChoDuyet(); } else if (TabContainer1.ActiveTabIndex == 2) { LoadData_Bitralai(); } DataSet _dsReturn; DataSet _dsReturn1; DataSet _dsReturn2; _dsReturn = _T_IdieaDAL.BindGridT_IdieaEditor(pages.PageIndex, pages.PageSize, BuildSQL(62, sOrder)); _dsReturn1 = _T_IdieaDAL.BindGridT_IdieaEditor(pages2.PageIndex - 1, pages2.PageSize, BuildSQL(63, sOrder)); _dsReturn2 = _T_IdieaDAL.BindGridT_IdieaEditor(Pager3.PageIndex - 1, Pager3.PageSize, BuildSQL(64, sOrder)); System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "javascript", "javascript: SetTotal(" + _dsReturn.Tables[1].Rows[0].ItemArray[0].ToString() + "," + _dsReturn1.Tables[1].Rows[0].ItemArray[0].ToString() + "," + _dsReturn2.Tables[1].Rows[0].ItemArray[0].ToString() + ");", true); _dsReturn.Clear(); _dsReturn1.Clear(); _dsReturn2.Clear(); }
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); }
//end #endregion #region Event click protected void linkSave_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; } } string message = string.Empty; T_News _t_news = SetItem(); int id = 0; HPCBusinessLogic.DAL.T_NewsDAL _T_newsDAL = new HPCBusinessLogic.DAL.T_NewsDAL(); if (Page.IsValid) { id = _T_newsDAL.InsertT_news(_t_news); //Insert keywords InsertKeyword(id, _user.UserID); if (Request["ID"] == null) { WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, Txt_tieude.Text, Request["Menu_ID"].ToString(), "[Nhập tin bài] [Thao tác Thêm mới tin bài]", id, ConstAction.BaoDT); System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + HPCComponents.Global.RM.GetString("VALIDATE_ADDNEWS") + "');", true); } else { WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, Txt_tieude.Text, Request["Menu_ID"].ToString(), "[Nhập tin bài] [Thao tác cập nhật tin bài]", id, ConstAction.BaoDT); System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + HPCComponents.Global.RM.GetString("UpdateSuccessfully") + "');", true); } UltilFunc.Insert_News_Image(txt_noidung.Text.Trim(), Convert.ToDouble(id.ToString())); } if (_t_news.Images_Summary.Length > 0) { this.ImgTemp.Src = HPCComponents.Global.TinPathBDT + "/" + _t_news.Images_Summary; } if (Request["Tab"] != null && Request["Tab"].ToString() != "" && Request["Tab"].ToString() != String.Empty) { Response.Redirect("ArticleEdit.aspx?Menu_ID=" + Request["Menu_ID"].ToString() + "&Tab=" + Page.Request["Tab"].ToString() + "&ID=" + id.ToString()); } else { Response.Redirect("ArticleEdit.aspx?Menu_ID=" + Request["Menu_ID"].ToString() + "&ID=" + id.ToString()); } }
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; }
//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()); } } }
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 T_News SetItemBaoDienTu(double _id_newspaper) { T_ImageFiles _obj = new T_ImageFiles(); ImageFilesDAL _dalimgfile = new ImageFilesDAL(); DataTable _dt_img = new DataTable(); T_News obj_news = new T_News(); T_TinBai _objbaoin = new T_TinBai(); _objbaoin = _daltinbai.load_T_news(_id_newspaper); double _id_newsonline = UltilFunc.GetColumnValuesOne("T_News", "News_ID", "News_CopyFrom=" + _id_newspaper); if (_id_newsonline == 0) obj_news.News_ID = 0; else obj_news.News_ID = _id_newsonline; obj_news.News_Tittle = _objbaoin.Tieude; obj_news.News_Summary = _objbaoin.Tomtat; obj_news.CAT_ID = _objbaoin.Ma_Chuyenmuc; obj_news.Lang_ID = _objbaoin.Ma_NgonNgu; string _sqlimg = string.Empty; _sqlimg = "select TenFile_Hethong,Duongdan_Anh,Chuthich from t_anh where ma_anh in (select Ma_Anh from T_Tinbai_Anh where Ma_TinBai=" + _id_newspaper + ")"; _dt_img = ulti.ExecSqlDataSet(_sqlimg).Tables[0]; string DesPath = string.Empty; string PathSource = string.Empty; string UrlImg = string.Empty; if (_dt_img != null && _dt_img.Rows.Count > 0) { for (int i = 0; i < _dt_img.Rows.Count; i++) { if (_dt_img.Rows.Count > 1) { DesPath = System.Configuration.ConfigurationManager.AppSettings["UrlImageResize"].ToString() + DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() + "/"; DesPath = HttpContext.Current.Server.MapPath("/" + DesPath); if (Directory.Exists(DesPath) == false) Directory.CreateDirectory(DesPath); PathSource = HttpContext.Current.Server.MapPath("/" + System.Configuration.ConfigurationManager.AppSettings["viewimg"].ToString() + _dt_img.Rows[i]["Duongdan_Anh"].ToString()); DesPath += Path.GetFileName(PathSource); UrlImg = System.Configuration.ConfigurationManager.AppSettings["UrlImageResize"].ToString() + DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() + "/" + Path.GetFileName(PathSource); ResizeImages(PathSource, Convert.ToInt32(HPCComponents.Global.VNPResizeImagesContent), DesPath); if (i == 0) { string _strremove = "/" + UrlImg.Split('/').GetValue(1).ToString(); string _Images_Summary = UrlImg.Replace(_strremove, ""); obj_news.Images_Summary = _Images_Summary; obj_news.News_Body = _objbaoin.Noidung; } //insert table T_ImageFiles int _idImgFile = 0; int startchar = UrlImg.Substring(1, UrlImg.Length - 1).IndexOf("/"); startchar += 1; string _PathFile = UrlImg.Substring(startchar, UrlImg.Length - startchar); _obj = SetItemImgFile(_dt_img.Rows[i]["TenFile_Hethong"].ToString(), 0, _PathFile, "", _user.UserID, 1, 0); _idImgFile = _dalimgfile.InsertT_ImageFiles(_obj); //end obj_news.News_Body += "<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" style=\"width: 450px;\"><tbody><tr><td><img border=\"0\" hspace=\"3\" id=\"" + _idImgFile + "\" src=\"" + UrlImg + "\" style=\"cursor-pointer\" vspace=\"3\" /></td></tr>"; obj_news.News_Body += "<tr><td>" + _dt_img.Rows[i]["Chuthich"].ToString() + "</tr></td></tbody></table>"; } else { DesPath = System.Configuration.ConfigurationManager.AppSettings["UrlImageResize"].ToString() + DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() + "/"; DesPath = HttpContext.Current.Server.MapPath("/" + DesPath); if (Directory.Exists(DesPath) == false) Directory.CreateDirectory(DesPath); PathSource = HttpContext.Current.Server.MapPath("/" + System.Configuration.ConfigurationManager.AppSettings["viewimg"].ToString() + _dt_img.Rows[i]["Duongdan_Anh"].ToString()); DesPath += Path.GetFileName(PathSource); UrlImg = System.Configuration.ConfigurationManager.AppSettings["UrlImageResize"].ToString() + DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() + "/" + Path.GetFileName(PathSource); ResizeImages(PathSource, Convert.ToInt32(HPCComponents.Global.VNPResizeImagesContent), DesPath); int _idImgFile = 0; //insert table T_ImageFiles int startchar = UrlImg.Substring(1, UrlImg.Length - 1).IndexOf("/"); startchar += 1; string _PathFile = UrlImg.Substring(startchar, UrlImg.Length - startchar); _obj = SetItemImgFile(_dt_img.Rows[i]["TenFile_Hethong"].ToString(), 0, _PathFile, "", _user.UserID, 1, 0); _idImgFile = _dalimgfile.InsertT_ImageFiles(_obj); //end string _strremove = "/" + UrlImg.Split('/').GetValue(1).ToString(); string _Images_Summary = UrlImg.Replace(_strremove, ""); obj_news.Images_Summary = _Images_Summary; obj_news.News_Body = "<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" style=\"width: 450px;\"><tbody><tr><td><img border=\"0\" hspace=\"3\" id=\"" + _idImgFile + "\" src=\"" + UrlImg + "\" style=\"cursor-pointer\" vspace=\"3\" /></td></tr>"; obj_news.News_Body += "<tr><td>" + _dt_img.Rows[i]["Chuthich"].ToString() + "</tr></td></tbody></table>"; obj_news.News_Body += _objbaoin.Noidung; } } } else obj_news.News_Body = _objbaoin.Noidung; obj_news.News_PublishNumber = int.Parse(DateTime.Now.Month.ToString()); obj_news.News_PublishYear = int.Parse(DateTime.Now.Year.ToString()); obj_news.News_DateCreated = DateTime.Now; obj_news.News_DateEdit = DateTime.Now; obj_news.News_DatePublished = DateTime.Now; obj_news.News_DateApproved = DateTime.Now; obj_news.News_AuthorID = int.Parse(_objbaoin.Ma_Nguoitao.ToString()); obj_news.News_AprovedID = _user.UserID; obj_news.News_EditorID = _user.UserID; obj_news.News_PublishedID = _user.UserID; obj_news.News_CopyFrom = 0; obj_news.RefID = int.Parse(_id_newspaper.ToString()); obj_news.News_Status = int.Parse(CommonLib.ReadXML("Status_BDT")); return obj_news; }