public void grdList_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { Label lblSTT = (Label)e.Item.FindControl("lblSTT"); if (lblSTT != null) { lblSTT.Text = (pages.PageIndex * pages.PageSize + e.Item.ItemIndex + 1).ToString(); } ImageButton btnDelete = (ImageButton)e.Item.FindControl("btnDelete"); if (btnDelete != null) { ChuyenmucDAL _dal = new ChuyenmucDAL(); int _id = Convert.ToInt32(grdListCate.DataKeys[e.Item.ItemIndex].ToString()); if (_dal.CheckExists_ChuyenMuc(_id) == 1) { btnDelete.Attributes.Add("onclick", "return alert(\"Chuyên mục này đang được sử dụng\");"); } else { btnDelete.Attributes.Add("onclick", "return confirm(\"Bạn có chắc chắn muốn xóa không?\");"); } } if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { e.Item.Attributes.Add("onmouseover", "currColor=this.style.backgroundColor;this.style.backgroundColor='" + CommonLib.HPCOnmouseoverGrid() + "'"); e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor=currColor"); } }
public void LoadCM() { string where = " Ma_Chuyenmuc_Cha = 0 AND HienThi_BDT = 1 and HienThi_BDT = 1 "; if (!String.IsNullOrEmpty(this.txtSearch_name.Text.Trim())) { where += " AND Ten_ChuyenMuc like N'%" + UltilFunc.SqlFormatText(this.txtSearch_name.Text.Trim()) + "%'"; } if (ddlLang.SelectedIndex > 0) { where += " AND Ma_AnPham =" + UltilFunc.SqlFormatText(ddlLang.SelectedValue); } //where += " Order by T_ChuyenMuc.ThuTuHienThi ASC"; ChuyenmucDAL _cateDAL = new ChuyenmucDAL(); DataSet _ds; _ds = _cateDAL.BindGridT_Cagegorys(0, 5000, where); int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString()); int TotalRecord = Convert.ToInt32(_ds.Tables[0].Rows.Count); DataTable _dv = _cateDAL.BindGridCategory(_ds.Tables[0]); _ds.Clear(); dgCategorysCopy.DataSource = _dv; dgCategorysCopy.DataBind(); }
private void GetItem(int _id) { T_ChuyenMuc _objChuyenmuc = new T_ChuyenMuc(); ChuyenmucDAL _chuyenmucDAL = new ChuyenmucDAL(); _objChuyenmuc = _chuyenmucDAL.GetOneFromT_ChuyenmucByID(_id); this.txtTenCM.Text = _objChuyenmuc.Ten_ChuyenMuc; this.txtThum.Text = _objChuyenmuc.Anh_ChuyenMuc; if (_objChuyenmuc.Anh_ChuyenMuc.ToString().Length > 0) { this.ImgTemp.Src = HPCComponents.Global.UploadPathBDT + _objChuyenmuc.Anh_ChuyenMuc; } else { this.ImgTemp.Attributes.CssStyle.Add("display", "none"); } this.ddl_ChuyenMucCha.SelectedIndex = UltilFunc.GetIndexControl(ddl_ChuyenMucCha, _objChuyenmuc.Ma_Chuyenmuc_Cha.ToString()); this.cbo_Anpham.SelectedIndex = UltilFunc.GetIndexControl(cbo_Anpham, _objChuyenmuc.Ma_AnPham.ToString()); this.chk_Hoatdong.Checked = _objChuyenmuc.HoatDong; this.txt_stt.Text = _objChuyenmuc.ThuTuHienThi.ToString(); this.CheckBoxBaoIn.Checked = _objChuyenmuc.HienThi_BaoIn; this.CheckBoxBaoDT.Checked = _objChuyenmuc.HienThi_BDT; this.CheckBoxRss.Checked = _objChuyenmuc.HienThi_RSS; this.CheckBoxCD.Checked = _objChuyenmuc.ChuyenDe; this.CheckBoxButtom.Checked = _objChuyenmuc.HienThiDuoi; this.CheckBoxCenter.Checked = _objChuyenmuc.HienThiGiua; this.CheckBoxRight.Checked = _objChuyenmuc.HienThiPhai; this.CheckBoxLeft.Checked = _objChuyenmuc.HienThiTrai; this.CheckBoxTop.Checked = _objChuyenmuc.HienThiTren; this.chkHienThi.Checked = _objChuyenmuc.HienThi; }
public void grdList_EditCommand(object source, DataGridCommandEventArgs e) { #region GhiLog Lichsu_Thaotac_HethongDAL actionDAL = new Lichsu_Thaotac_HethongDAL(); T_Lichsu_Thaotac_Hethong action = new T_Lichsu_Thaotac_Hethong(); action.Ma_Nguoidung = _user.UserID; action.TenDaydu = _user.UserFullName; action.HostIP = IpAddress(); action.NgayThaotac = DateTime.Now; #endregion ChuyenmucDAL obj_Cate = new ChuyenmucDAL(); int catID = Convert.ToInt32(this.grdListCate.DataKeys[e.Item.ItemIndex].ToString()); if (e.CommandArgument.ToString().ToLower() == "edit") { Response.Redirect("~/Danhmuc/EditChuyenMuc.aspx?Menu_ID=" + Page.Request["Menu_ID"].ToString() + "&ID=" + catID); } if (e.CommandArgument.ToString().ToLower() == "editdisplay") { bool check = obj_Cate.GetOneFromT_ChuyenmucByID(catID).HoatDong; if (check) { obj_Cate.UpdateFromT_ChuyenMucDynamic(" Hoatdong = 0, Ngaysua = Getdate(), Nguoisua=" + _user.UserID.ToString() + " Where Ma_ChuyenMuc = " + catID); action.Thaotac = "[Update T_ChuyenMuc]-->[Hoatdong = 0]"; } else { obj_Cate.UpdateFromT_ChuyenMucDynamic(" Hoatdong = 1, Ngaysua = Getdate(), Nguoisua=" + _user.UserID.ToString() + " Where Ma_ChuyenMuc = " + catID); action.Thaotac = "[Update T_ChuyenMuc]-->[Hoatdong = 1]"; } } if (e.CommandArgument.ToString().ToLower() == "active_bdt") { bool check = obj_Cate.GetOneFromT_ChuyenmucByID(catID).HienThi_BDT; if (check) { obj_Cate.UpdateFromT_ChuyenMucDynamic(" HienThi_BDT = 0, Ngaysua = Getdate(), Nguoisua=" + _user.UserID.ToString() + " Where Ma_ChuyenMuc = " + catID); action.Thaotac = "[Update T_ChuyenMuc]-->[HienThi_BDT = 0]"; } else { obj_Cate.UpdateFromT_ChuyenMucDynamic(" HienThi_BDT = 1, Ngaysua = Getdate(), Nguoisua=" + _user.UserID.ToString() + " Where Ma_ChuyenMuc = " + catID); action.Thaotac = "[Update T_ChuyenMuc]-->[HienThi_BDT = 1]"; } } if (e.CommandArgument.ToString().ToLower() == "delete") { if (obj_Cate.CheckExists_ChuyenMuc(catID) == 0) { obj_Cate.DeleteFromT_ChuyenmucByID(catID); action.Thaotac = "[Xóa T_ChuyenMuc]-->[Thao tác Xóa Trong Bảng T_ChuyenMuc][ID:" + this.grdListCate.DataKeys[e.Item.ItemIndex].ToString() + " ]"; } else { FuncAlert.AlertJS(this, "chuyên mục đã được sử dung biên tập tin bài!"); return; } } Danhsach_ChuyenMuc(); }
private void PopulateItem(int _id) { T_TinBai _obj = new T_TinBai(); ChuyenmucDAL _dalcm = new ChuyenmucDAL(); _obj = Daltinbai.load_T_news(_id); Txt_tieude.Text = _obj.Tieude; CKE_Noidung.Text = _obj.Noidung; txt_PVCTV.Text = _obj.TacGia; HiddenFieldTacgiatin.Value = _obj.Ma_TacGia.ToString(); Txt_Comments.Text = _obj.GhiChu; LoadDataImage(); }
protected void Save_Click(object sender, EventArgs e) { string Thaotac = string.Empty; this.Page.Validate(vs_Themmoi.ValidationGroup); if (!Page.IsValid) { return; } ChuyenmucDAL _ChuyenMucDAL = new ChuyenmucDAL(); T_ChuyenMuc _ChuyenMuc = SetItem(); if (cbo_Anpham.SelectedIndex == 0) { FuncAlert.AlertJS(this, "Bạn chưa chọn ấn phẩm!"); return; } else { int menuID = 0; if (Request["ID"] != null && Request["ID"].ToString() != "" && Request["ID"].ToString() != String.Empty) { menuID = int.Parse(Request["ID"].ToString()); } int _return = _ChuyenMucDAL.Insert_T_Chuyenmuc(_ChuyenMuc); // DONG BO FILE _ChuyenMuc = _ChuyenMucDAL.GetOneFromT_ChuyenmucByID(_return); SynFiles _syncfile = new SynFiles(); if (_ChuyenMuc.Anh_ChuyenMuc.Length > 0) { _syncfile.SynData_UploadImgOne(_ChuyenMuc.Anh_ChuyenMuc, HPCComponents.Global.ImagesService); } //END if (Page.Request.Params["id"] == null) { Thaotac = "[Thêm mới Chuyên mục]-->[mã chuyên mục:" + _return.ToString() + " ]"; Clear(); BindCombo(); } if (Page.Request.Params["id"] != null) { Thaotac = "[Sửa chuyên mục]-->[Mã chuyên mục:" + Page.Request["id"].ToString() + " ]"; Clear(); BindCombo(); } } }
protected void Page_Load(object sender, EventArgs e) { if (Request["Menu_ID"] != null && Request["Menu_ID"].ToString() != "" && Request["Menu_ID"].ToString() != String.Empty) { if (CommonLib.IsNumeric(Request["Menu_ID"]) == true) { if (!HPCSecurity.IsAccept(Convert.ToInt32(Request["Menu_ID"]))) { Response.Redirect("~/Errors/AccessDenied.aspx"); } _user = _NguoidungDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); if (!Page.IsPostBack) { int id = int.Parse(Page.Request.QueryString["ID"].ToString()); if (Page.Request.QueryString["Menu_ID"] != null) { T_Idiea obj = new T_Idiea(); T_IdieaDAL dal = new T_IdieaDAL(); ChuyenmucDAL caDal = new ChuyenmucDAL(); obj = dal.GetOneFromT_IdieaByID(id); //add by Hung viet if (obj.Cat_ID > 0) { this.litCatName.Text = caDal.GetOneFromT_ChuyenmucByID(int.Parse(obj.Cat_ID.ToString())).Ten_ChuyenMuc; } else { this.litCatName.Text = ""; } this.litTittle.Text = obj.Title.ToString(); this.litTacgia.Text = UltilFunc.GetUserFullName(obj.User_Created); this.litContent.Text = CleanHTMLFont(obj.Comment.ToString()); this.lit_baiviet.Text = CleanHTMLFont(obj.Diea_Articles.ToString()); string count = this.litContent.Text + "" + this.lit_baiviet.Text; this.LitCount.Text = UltilFunc.WordCount(count) + " từ "; if (obj.Status == 6) { this.LitDatePublisher.Text = obj.Date_Duyet.ToString("dd/MM/yyyy HH:mm") + " (GMT + 7)"; } ViewState["ver"] = -1; } } } } }
private void Save_GroupCategorys(int Group_ID) { NguoidungDAL _usermenuDAL = new NguoidungDAL(); ChuyenmucDAL _ChuyenmucDAL = new ChuyenmucDAL(); T_ChuyenMuc _objcm = new T_ChuyenMuc(); UltilFunc ulti = new UltilFunc(); int Cate_ID = 0; string[] arrCate; char[] sepparator; sepparator = ";".ToCharArray(); if (txtCateAccess.Value.Trim() != "") { arrCate = txtCateAccess.Value.Split(sepparator); string txt = ""; if (txtCateAccess.Value.StartsWith("on;")) { txt = txtCateAccess.Value.Remove(0, 3); arrCate = txt.Split(sepparator); } _nhomnguoidungDAL.DeleteFromT_GroupCategory(Group_ID); _usermenuDAL.DeleteFromT_UserCategoryDynamic(" Ma_Nhom=" + Group_ID); string _sqldelete = string.Empty; for (int x = 0; x < arrCate.Length; x++) { Cate_ID = Convert.ToInt32(arrCate[x].ToString()); _objcm = _ChuyenmucDAL.GetOneFromT_ChuyenmucByID(Cate_ID); if (_objcm.Ma_Chuyenmuc_Cha > 0) { _nhomnguoidungDAL.InsertT_GroupCategory(Cate_ID, Group_ID); _sqldelete = "delete from T_Nhom_Chuyenmuc where Ma_Nhom=" + Group_ID + " and Ma_Chuyenmuc=" + _objcm.Ma_Chuyenmuc_Cha; ulti.ExecSql(_sqldelete); _nhomnguoidungDAL.InsertT_GroupCategory(_objcm.Ma_Chuyenmuc_Cha, Group_ID); } else { _nhomnguoidungDAL.InsertT_GroupCategory(Cate_ID, Group_ID); } } } else { _usermenuDAL.DeleteFromT_UserCategoryDynamic(" Ma_Nhom=" + Group_ID); _nhomnguoidungDAL.DeleteFromT_GroupCategory(Group_ID); } }
public string GetCategoryName(Object ID, Object loaiid) { string str = ""; ChuyenmucDAL _dal = new ChuyenmucDAL(); if (_dal.GetOneFromT_ChuyenmucByID(Convert.ToInt32(loaiid)) != null) { string loaitinbaiID = "", loaianhID = "", loaivideoID = "", loaianhTsID = ""; loaitinbaiID = ConfigurationManager.AppSettings["NewsType"].ToString(); loaianhID = ConfigurationManager.AppSettings["ImageType"].ToString(); loaivideoID = ConfigurationManager.AppSettings["VideoType"].ToString();; loaianhTsID = ConfigurationManager.AppSettings["AnhTSType"].ToString(); if (loaiid.ToString().Trim() == loaitinbaiID) { try { if (_dal.GetOneFromT_ChuyenmucByID(Convert.ToInt32(ID)) == null) { str = ""; } else { str = _dal.GetOneFromT_ChuyenmucByID(Convert.ToInt32(ID)).Ten_ChuyenMuc.ToString(); } } catch (Exception ex) { } } else if (loaiid.ToString().Trim() == loaianhID) { str = "Góc ảnh"; } else if (loaiid.ToString().Trim() == loaivideoID) { str = "Âm thanh - Hình ảnh"; } else if (loaiid.ToString().Trim() == loaianhTsID) { str = "Thời sự qua ảnh"; } } return(str); }
public void LoadCategorys() { int _id = 0; int.TryParse(Request["ID"] == null ? "0" : Request["ID"], out _id); HPCBusinessLogic.ChuyenmucDAL _cateDAL = new ChuyenmucDAL(); DataTable _dt = null; _dt = _cateDAL.BindGridT_Cagegorys(int.Parse(cbo_lanquage.SelectedValue.ToString()), _id); if (_dt != null) { this.grdListCate.DataSource = _dt; this.grdListCate.DataBind(); } else { this.grdListCate.DataSource = null; this.grdListCate.DataBind(); } }
protected void dgCategorysCopy_EditCommand(object source, DataGridCommandEventArgs e) { if (e.CommandArgument.ToString().ToLower() == "editcopy") { HPCBusinessLogic.DAL.T_NewsDAL _NewsDAL = new HPCBusinessLogic.DAL.T_NewsDAL(); HPCBusinessLogic.ChuyenmucDAL _catDAL = new ChuyenmucDAL(); DataGridItem m_Item = e.Item; int CatalogID = int.Parse(dgCategorysCopy.DataKeys[m_Item.ItemIndex].ToString()); double _IDNewsCopy = _NewsDAL.Copy_To_Categorys(NewsID, CatalogID, 6, DateTime.Now, _user.UserID, _user.UserID, _user.UserName); if (_IDNewsCopy > 0) { WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Copy]", Request["Menu_ID"], "[Copy] [Bài đã xuất bản]: [Tin bài đã xuất bản] [Thao tác copy bài vào chuyên mục: " + _catDAL.GetOneFromT_ChuyenmucByID(CatalogID).Ten_ChuyenMuc + "]", _IDNewsCopy, ConstAction.BaoDT); } CheckBox checkcopy = (CheckBox)m_Item.FindControl("optSelect"); ImageButton btnCopy = (ImageButton)m_Item.FindControl("btnCopy"); btnCopy.Visible = false; checkcopy.Visible = false; checkcopy.Enabled = false; this.LoadData_DangXuly(); } }
public override void DataBind() { T_Idiea obj = new T_Idiea(); T_Allotments _Allotment = new T_Allotments(); T_IdieaDAL dal = new T_IdieaDAL(); T_AllotmentDAL _AllotmentDAL = new T_AllotmentDAL(); ChuyenmucDAL caDal = new ChuyenmucDAL(); if (Request["DT_id"] != null && Request["DT_id"].ToString() != "" && Request["DT_id"].ToString() != String.Empty) { int id = int.Parse(Page.Request["DT_id"].ToString()); _Allotment = _AllotmentDAL.GetOneFromT_AllotmentByID(id); obj = dal.GetOneFromT_IdieaByID(_Allotment.Idiea_ID); this.T_AllotmentNgayHT.Text = _Allotment.Date_End.ToString(); this.ltrYeuCau.Text = _Allotment.Request.ToString(); if (obj.Cat_ID > 0) { this.lblNameCM.Text = caDal.GetOneFromT_ChuyenmucByID(int.Parse(obj.Cat_ID.ToString())).Ten_ChuyenMuc; } if (obj.Title.ToString().Length > 0) { this.lbtieude.Text = obj.Title.ToString(); } if (_Allotment.Type == 1) { ltr_loaibai1.Text = "Bài viết"; } else { ltr_loaibai1.Text = "Bài ảnh"; } MaCM = obj.Cat_ID; } }
protected void but_XB_Click(object sender, EventArgs e) { HPCBusinessLogic.DAL.T_NewsDAL _NewsDAL = new HPCBusinessLogic.DAL.T_NewsDAL(); HPCBusinessLogic.ChuyenmucDAL _catDAL = new ChuyenmucDAL(); foreach (DataGridItem m_Item in dgCategorysCopy.Items) { CheckBox checkcopy = (CheckBox)m_Item.FindControl("optSelect"); if (checkcopy != null && checkcopy.Checked && checkcopy.Enabled) { int CatalogID = int.Parse(dgCategorysCopy.DataKeys[m_Item.ItemIndex].ToString()); double _IDNewsCopy = _NewsDAL.Copy_To_Categorys(NewsID, CatalogID, 6, DateTime.Now, _user.UserID, _user.UserID, _user.UserName); if (_IDNewsCopy > 0) { WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Copy]", Request["Menu_ID"], "[Copy] [Bài đã xuất bản]: [Tin bài đã xuất bản] [Thao tác copy bài vào chuyên mục: " + _catDAL.GetOneFromT_ChuyenmucByID(CatalogID).Ten_ChuyenMuc + "]", _IDNewsCopy, ConstAction.TSAnh); } } } ModalPopupExtender1.Hide(); this.LoadData_DangXuly(); //Tao cache //UltilFunc.GenCacheHTML(); System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('Xuất bản ra chuyên mục khác thành công !');", true); }
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"); } }
protected void Page_Load(object sender, EventArgs e) { if (Request["Menu_ID"] != null && Request["Menu_ID"].ToString() != "" && Request["Menu_ID"].ToString() != String.Empty) { if (CommonLib.IsNumeric(Request["Menu_ID"]) == true) { if (!HPCSecurity.IsAccept(Convert.ToInt32(Request["Menu_ID"]))) { Response.Redirect("~/Errors/AccessDenied.aspx"); } _user = _NguoidungDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); if (!Page.IsPostBack) { int id = int.Parse(Page.Request.QueryString["ID"].ToString()); if (Page.Request.QueryString["Menu_ID"] != null) { T_Idiea obj = new T_Idiea(); T_IdieaVersion _obj2 = new T_IdieaVersion(); T_IdieaDAL dal = new T_IdieaDAL(); ChuyenmucDAL caDal = new ChuyenmucDAL(); obj = dal.GetOneFromT_IdieaByID(id); //add by nvthai T_IdieaVersion _objVer = new T_IdieaVersion(); if (obj.Diea_Stype == 1) { _objVer = dal.GetOneFromT_IdieaVersionByIDVersion(id, 4, 54); _obj2 = dal.GetOneFromT_IdieaVersionByIDVersion(id, 1, 62); } else { _objVer = dal.GetOneFromT_IdieaVersionByIDVersion(id, 4, 54); _obj2 = dal.GetOneFromT_IdieaVersionByIDVersion(id, 3, 23); } //add by Hung viet if (obj.Cat_ID > 0) { this.litCatName.Text = caDal.GetOneFromT_ChuyenmucByID(int.Parse(_obj2.Cat_ID.ToString())).Ten_ChuyenMuc; this.litCM.Text = caDal.GetOneFromT_ChuyenmucByID(int.Parse(_objVer.Cat_ID.ToString())).Ten_ChuyenMuc; } else { this.litCatName.Text = ""; this.litCM.Text = ""; } this.litTittle.Text = _obj2.Title.ToString(); this.litTacgia.Text = UltilFunc.GetUserFullName(_obj2.User_Created); this.litContent.Text = CleanHTMLFont(_obj2.Comment.ToString()); this.lit_baiviet.Text = CleanHTMLFont(_obj2.Diea_Articles.ToString()); string coutstring = this.litContent.Text + " " + this.lit_baiviet.Text; this.litCounter.Text = UltilFunc.WordCount(coutstring).ToString() + " từ"; this.litTenDetai.Text = _objVer.Title.ToString(); this.literNguoiviet.Text = UltilFunc.GetUserFullName(_objVer.User_Edit); this.litContents.Text = CleanHTMLFont(_objVer.Comment.ToString()); this.litbai.Text = CleanHTMLFont(_objVer.Diea_Articles.ToString()); string coutstring2 = this.litContents.Text + " " + this.litbai.Text; this.litCouter2.Text = UltilFunc.WordCount(coutstring2).ToString() + " từ"; ViewState["ver"] = -1; } } } } }
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; } }
public static void Backup_fileDoc(double NewsID, string _UserName, string _Chucnang) { string _noidung = string.Empty; string _tieude = string.Empty; string _loaibao = string.Empty; string _sobao = string.Empty; int _lb = 0; int _sb = 0; string strFileName = string.Empty; string strHTML = string.Empty; AnPhamDAL _dalanpham = new AnPhamDAL(); ChuyenmucDAL dalcm = new ChuyenmucDAL(); SobaoDAL dalsb = new SobaoDAL(); HPCBusinessLogic.DAL.TinBaiDAL dalnews = new HPCBusinessLogic.DAL.TinBaiDAL(); _tieude += dalnews.load_T_news(NewsID).Tieude; _tieude += System.Environment.NewLine; _noidung += dalnews.load_T_news(NewsID).Noidung; _noidung += System.Environment.NewLine; if (dalnews.load_T_news(NewsID).Ma_NgonNgu != 0) { _lb = dalnews.load_T_news(NewsID).Ma_Anpham; _loaibao += _dalanpham.GetOneFromT_AnPhamByID(_lb).Ten_AnPham; } if (dalnews.load_T_news(NewsID).Ma_Chuyenmuc != 0) { _lb = dalnews.load_T_news(NewsID).Ma_Chuyenmuc; _loaibao += _dalanpham.GetOneFromT_AnPhamByID(dalcm.GetOneFromT_ChuyenmucByID(_lb).Ma_AnPham).Ten_AnPham; } if (dalnews.load_T_news(NewsID).Ma_Sobao != 0) { _sb = dalnews.load_T_news(NewsID).Ma_Sobao; _sobao += dalsb.GetOneFromT_SobaoByID(_sb).Ten_Sobao; } if (_noidung.Length > 0) { strHTML += "<html><BODY>"; strHTML += _tieude; strHTML += "<br />"; strHTML += "<br />"; strHTML += _noidung; strHTML += "</BODY></html>"; DirectoryInfo r = new DirectoryInfo(HttpContext.Current.Server.MapPath("~" + System.Configuration.ConfigurationManager.AppSettings["BackupDoc"].ToString())); if (File.Exists(r.ToString())) { FileInfo[] file; file = r.GetFiles("*.doc"); foreach (FileInfo i in file) { File.Delete(r.FullName + "\\" + i.Name); } } strFileName = _UserName + _Chucnang + "_" + string.Format("{0:dd-MM-yyyy_hh-mm-ss}", System.DateTime.Now); string pathStore = HttpContext.Current.Server.MapPath("~" + System.Configuration.ConfigurationManager.AppSettings["BackupDoc"].ToString() + _Chucnang + "/" + _loaibao + "/" + _sobao + "/" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + DateTime.Now.Day); string path = HttpContext.Current.Server.MapPath("~" + System.Configuration.ConfigurationManager.AppSettings["BackupDoc"].ToString() + _Chucnang + "/" + _loaibao + "/" + _sobao + "/" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + DateTime.Now.Day + "/" + strFileName + ".doc"); if (!File.Exists(pathStore)) { Directory.CreateDirectory(pathStore); } try { StreamWriter wr = new StreamWriter(path, false, System.Text.Encoding.Unicode); wr.Write(strHTML); wr.Close(); } catch (Exception ex) { throw ex; } } }
private void PopulateItem(int _id) { T_TinBai _obj = new T_TinBai(); ChuyenmucDAL _dalcm = new ChuyenmucDAL(); _obj = _Daltinbai.load_T_news(_id); Txt_tieude.Text = _obj.Tieude; Ma_QTBT = _obj.Ma_QTBT; DataTable dtnguoitao = _Daltinbai.Sp_SelectOneNguoitaoTinBai(_id).Tables[0]; if (dtnguoitao != null && dtnguoitao.Rows.Count > 0) { if (int.Parse(dtnguoitao.Rows[0][0].ToString()) != _user.UserID) { txt_PVCTV.Text = _obj.TacGia; HiddenFieldTacgiatin.Text = _obj.Ma_TacGia.ToString(); txt_PVCTV.ReadOnly = true; } else { txt_PVCTV.Text = _obj.TacGia; HiddenFieldTacgiatin.Text = _obj.Ma_TacGia.ToString(); } } else { txt_PVCTV.Text = _obj.TacGia; HiddenFieldTacgiatin.Text = _obj.Ma_TacGia.ToString(); } if (_obj.GhiChu != "") { Txt_Comments.Text = _obj.GhiChu; } else { Txt_Comments.Text = ""; } if (_obj.Ma_Anpham > 0) { cbo_AnPham.SelectedIndex = CommonLib.GetIndexControl(cbo_AnPham, _obj.Ma_Anpham.ToString()); } cbo_chuyenmuc.Items.Clear(); if (cbo_AnPham.SelectedIndex > 0) { UltilFunc.BindCombox_CategoryDequy(cbo_chuyenmuc, "Ma_ChuyenMuc", "Ten_ChuyenMuc", "T_ChuyenMuc", " WHERE Hoatdong=1 and Ma_ChuyenMuc in (select Ma_ChuyenMuc from T_Nguoidung_Chuyenmuc where Ma_Nguoidung = " + _user.UserID.ToString() + ") and Ma_AnPham= " + cbo_AnPham.SelectedValue, (string)HttpContext.GetGlobalResourceObject("cms.language", "lblChonchuyenmuc"), "Ma_Chuyenmuc_Cha"); cbo_chuyenmuc.SelectedIndex = CommonLib.GetIndexControl(cbo_chuyenmuc, _obj.Ma_Chuyenmuc.ToString()); } else { cbo_chuyenmuc.DataSource = null; cbo_chuyenmuc.DataBind(); } checkbaoonline.Checked = _obj.VietNamNews; checkbizbub.Checked = _obj.Bizhub; LoadDataImage(); }
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 {; } } } }
public string getListCategoryNameAds(int AdsLogoID) { //DataSet _ds = null; string strListCategorys = ""; //UltilFunc _untilDAL = new UltilFunc(); //DataTable _dt = null; T_Customer_Ads _objAds = null; ChuyenmucDAL _CateDAL = new ChuyenmucDAL(); string[] sArrProdID = null; char[] sep = { ',' }; try { strListCategorys = "<br>Trang đăng quảng cáo:"; _objAds = GetOneFromT_Customer_AdsByID(AdsLogoID); sArrProdID = _objAds.Cat_ID.ToString().Trim().Split(sep); for (int i = 0; i < sArrProdID.Length; i++) { if (sArrProdID[i].ToString() == "ALL") { strListCategorys = strListCategorys + "<br> -" + "ALL"; } if (sArrProdID[i].ToString() == "0") { strListCategorys = strListCategorys + "<br> -" + "TRANG CHỦ"; } if (IsNumeric(sArrProdID[i].ToString()) == true) { if (sArrProdID[i].ToString() != "0") { string _cateName = _CateDAL.GetCateNameByID(Convert.ToInt32(sArrProdID[i].ToString())); if (_cateName != "") { strListCategorys = strListCategorys + "<br> -" + _CateDAL.GetCateNameByID(Convert.ToInt32(sArrProdID[i].ToString())); } } } } //_ds = HPCDataProvider.Instance().GetStoreDataSet("[CMS_getAllCategorysNameAdsByAdsID]", new string[] { "@AdsLogoID" }, new object[] { AdsLogoID }); //if (_ds != null) //{ // _dt = _ds.Tables[0]; // if (_dt.Rows.Count > 0) // { // strListCategorys = "<br>Trang đăng quảng cáo:"; // for (int i = 0; i < _dt.Rows.Count; i++) // { // strListCategorys = strListCategorys + "<br> -" + _dt.Rows[i]["Category_Name"].ToString(); // } // } //} } catch (Exception ex) { throw ex; } finally { //_ds = null; //_dt = null; } return(strListCategorys); }
public void Danhsach_ChuyenMuc() { string where = " Ma_Chuyenmuc_Cha=0"; if (cbo_Anpham.SelectedIndex > 0) { where += " and Ma_AnPham=" + cbo_Anpham.SelectedValue.ToString(); } if (!String.IsNullOrEmpty(this.txtSearch_ChuyenMuc.Text.Trim())) { where += " and " + string.Format(" Ten_ChuyenMuc like N'%{0}%'", UltilFunc.SqlFormatText(this.txtSearch_ChuyenMuc.Text.Trim())) + " or Ma_ChuyenMuc in( select Ma_Chuyenmuc_Cha from T_ChuyenMuc where Ma_ChuyenMuc in (select Ma_ChuyenMuc from T_ChuyenMuc where " + string.Format(" Ten_ChuyenMuc like N'%{0}%'", UltilFunc.SqlFormatText(this.txtSearch_ChuyenMuc.Text.Trim())) + "))"; } if (chk_Hoatdong.Checked) { where += " and Hoatdong=1"; } if (!chk_Hoatdong.Checked) { where += " and Hoatdong=0"; } if (CheckBoxBaoDT.Checked) { where += " and HienThi_BDT=1"; } if (CheckBoxBaoIn.Checked) { where += " and HienThi_BaoIn=1"; } pages.PageSize = Global.MembersPerPage; ChuyenmucDAL _chuyenmucDAL = new ChuyenmucDAL(); DataSet _ds; if (Session["where_chuyenmuc"] != null) { _ds = _chuyenmucDAL.BindGridT_Cagegorys(pages.PageIndex, pages.PageSize, Session["where_chuyenmuc"].ToString()); } else { _ds = _chuyenmucDAL.BindGridT_Cagegorys(pages.PageIndex, pages.PageSize, where); } int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString()); int TotalRecord = Convert.ToInt32(_ds.Tables[0].Rows.Count); if (TotalRecord == 0) { if (Session["where_chuyenmuc"] != null) { _ds = _chuyenmucDAL.BindGridT_Cagegorys(pages.PageIndex - 1, pages.PageSize, Session["where_chuyenmuc"].ToString()); } else { _ds = _chuyenmucDAL.BindGridT_Cagegorys(pages.PageIndex - 1, pages.PageSize, where); } } DataTable dt = _chuyenmucDAL.BindGridCategory(_ds.Tables[0]); grdListCate.DataSource = dt; grdListCate.DataBind(); _ds.Clear(); pages.TotalRecords = curentPages.TotalRecords = TotalRecords; curentPages.TotalPages = pages.CalculateTotalPages(); curentPages.PageIndex = pages.PageIndex; Session["PageIndex"] = pages.PageIndex; }