private void LoadData_Baibixoa() { string sOrder = " Order by News_DateEdit DESC "; pageBaixoa.PageSize = Global.MembersPerPage; HPCBusinessLogic.DAL.T_NewsDAL _T_newsDAL = new HPCBusinessLogic.DAL.T_NewsDAL(); DataSet _ds; _ds = _T_newsDAL.BindGridT_NewsEditor(pageBaixoa.PageIndex, pageBaixoa.PageSize, BuildSQL(ConstNews.NewsDelete, sOrder)); int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString()); int TotalRecord = Convert.ToInt32(_ds.Tables[0].Rows.Count); if (TotalRecord == 0) { for (int i = 1; i <= TotalRecords; i++) { _ds = _T_newsDAL.BindGridT_NewsEditor(pageBaixoa.PageIndex - i, pageBaixoa.PageSize, BuildSQL(ConstNews.NewsDelete, sOrder)); if (_ds.Tables[0].Rows.Count > 0) { break; } } } dgr_BaiXoa.DataSource = _ds; dgr_BaiXoa.DataBind(); _ds.Clear(); pageBaixoa.TotalRecords = CurrentPageBaixoa.TotalRecords = TotalRecords; CurrentPageBaixoa.TotalPages = pageBaixoa.CalculateTotalPages(); CurrentPageBaixoa.PageIndex = pageBaixoa.PageIndex; GetTotal(); }
public void Search1() { string Str_Search = GetSQLSearch(); if (!string.IsNullOrEmpty(Str_Search)) { pages.PageSize = Global.MembersPerPage; HPCBusinessLogic.DAL.T_NewsDAL _T_newsDAL = new HPCBusinessLogic.DAL.T_NewsDAL(); DataSet _ds; _ds = _T_newsDAL.Search_All_News(pages.PageIndex, pages.PageSize, Str_Search); int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString()); int TotalRecord = Convert.ToInt32(_ds.Tables[0].Rows.Count); if (TotalRecord == 0) { _ds = _T_newsDAL.Search_All_News(pages.PageIndex - 1, pages.PageSize, Str_Search); } dgr_tintuc.DataSource = _ds; dgr_tintuc.DataBind(); pages.TotalRecords = CurrentPage2.TotalRecords = TotalRecords; CurrentPage2.TotalPages = pages.CalculateTotalPages(); CurrentPage2.PageIndex = pages.PageIndex; } else { System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('Trường ngày tháng phải nhập đúng theo định dang dd/MM/yyyy!');", true); } }
private void LoadData_DangXuly() { string sOrder = GetOrderString() == "" ? "" : " ORDER BY " + GetOrderString(); pages.PageSize = 15; HPCBusinessLogic.DAL.T_NewsDAL _T_newsDAL = new HPCBusinessLogic.DAL.T_NewsDAL(); string tieude = txt_tieude.Text.Trim(); Session["searchvalueroot"] = null; if (tieude != "") { Session["searchvalueroot"] = UltilFunc.SplitString(tieude); } DataSet _ds; _ds = _T_newsDAL.BindGridT_NewsDynamic(pages.PageIndex, pages.PageSize, BuildSQL(6, sOrder), UltilFunc.ReplaceAll(UltilFunc.SplitString(tieude), "'", "’")); int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString()); int TotalRecord = Convert.ToInt32(_ds.Tables[0].Rows.Count); if (TotalRecord == 0) { _ds = _T_newsDAL.BindGridT_NewsDynamic(pages.PageIndex, pages.PageSize, BuildSQL(6, sOrder), UltilFunc.ReplaceAll(UltilFunc.SplitString(tieude), "'", "’")); } dgr_tintuc1.DataSource = _ds; dgr_tintuc1.DataBind(); pages.TotalRecords = CurrentPage2.TotalRecords = TotalRecords; CurrentPage2.TotalPages = pages.CalculateTotalPages(); CurrentPage2.PageIndex = pages.PageIndex; }
private void LoadData() { string _where = " 1 = 1 AND News_Status <> 55 AND T_News.News_Lock =1 "; //if (ddlLang.SelectedIndex > 0) // _where += " AND " + string.Format(" T_News.Lang_ID = {0}", ddlLang.SelectedValue); if (ddlCategorysAll.SelectedIndex > 0) { _where += " AND " + string.Format(" T_News.CAT_ID = {0}", ddlCategorysAll.SelectedValue); } if (txt_tieude.Text.Length > 0) { _where += "AND " + string.Format(" News_Tittle like N'%{0}%'", UltilFunc.SqlFormatText(this.txt_tieude.Text.Trim())); } _where += "Order by T_News.News_DateEdit DESC "; pages.PageSize = Global.MembersPerPage; HPCBusinessLogic.DAL.T_NewsDAL _untilDAL = new HPCBusinessLogic.DAL.T_NewsDAL(); DataSet _ds; _ds = _untilDAL.BindGridT_NewsEditor(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) { _ds = _untilDAL.BindGridT_NewsEditor(pages.PageIndex - 1, pages.PageSize, _where); } grdList.DataSource = _ds.Tables[0]; grdList.DataBind(); pages.TotalRecords = curentPages.TotalRecords = TotalRecords; System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "javascript", "javascript: SetInnerBaiDangxyLy(" + TotalRecords + ");", true); curentPages.TotalPages = pages.CalculateTotalPages(); curentPages.PageIndex = pages.PageIndex; }
protected void cmd_chamall_Click(object sender, EventArgs e) { HPCBusinessLogic.DAL.T_ButdanhDAL obj_BD_DAL = new HPCBusinessLogic.DAL.T_ButdanhDAL(); HPCBusinessLogic.ImageFilesDAL obj = new HPCBusinessLogic.ImageFilesDAL(); int type = 1; try { type = int.Parse(Request["TypeID"].ToString()); } catch {; } if (checkCham.Checked) { int tien = 0; if (!string.IsNullOrEmpty(txt_tienNB.Text.Trim())) { try { tien = int.Parse(txt_tienNB.Text.Trim().Replace(",", "")); } catch { System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alrt('Tiền phải nhập kiểu số nguyên');", true); return; } foreach (DataGridItem item in dgr_anh.Items) { int newid = int.Parse(lbl_News_ID.Text); Label lbl_Image_ID = (Label)item.FindControl("lbl_Image_ID"); int ImageID = int.Parse(lbl_Image_ID.Text); HPCBusinessLogic.DAL.T_NewsDAL _Obj = new HPCBusinessLogic.DAL.T_NewsDAL(); _Obj.Update_TiennhanbutAnh(type, newid, int.Parse(lbl_Image_ID.Text), tien, _user.UserID); WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, " ", Request["Menu_ID"].ToString(), "Duyệt ảnh ", int.Parse(lbl_Image_ID.Text), ConstAction.BaoDT); } } } else { foreach (DataGridItem item in dgr_anh.Items) { TextBox txt_tiennhanbut = (TextBox)item.FindControl("txt_tiennhanbut"); if (!string.IsNullOrEmpty(txt_tiennhanbut.Text)) { try { int.Parse(txt_tiennhanbut.Text.Replace(",", "")); } catch { System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alrt('Tiền phải nhập kiểu số nguyên');", true); return; } } } foreach (DataGridItem item in dgr_anh.Items) { TextBox txt_tiennhanbut = (TextBox)item.FindControl("txt_tiennhanbut"); int newid = int.Parse(lbl_News_ID.Text); Label lbl_Image_ID = (Label)item.FindControl("lbl_Image_ID"); int ImageID = int.Parse(lbl_Image_ID.Text); int tien = 0; if (!string.IsNullOrEmpty(txt_tiennhanbut.Text)) { tien = int.Parse(txt_tiennhanbut.Text.Replace(",", "")); } HPCBusinessLogic.DAL.T_NewsDAL _Obj = new HPCBusinessLogic.DAL.T_NewsDAL(); _Obj.Update_TiennhanbutAnh(type, newid, ImageID, tien, _user.UserID); WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, " ", Request["Menu_ID"].ToString(), "Duyệt ảnh ", int.Parse(lbl_Image_ID.Text), ConstAction.BaoDT); } } LoadImage(); }
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(); }
//VietnamNews Online status public static string GetStatusT_NewsFrom_T_version(Object ID) { string str = ""; int status = 0; HPCBusinessLogic.DAL.T_NewsDAL Dal = new HPCBusinessLogic.DAL.T_NewsDAL(); if (Dal.load_T_news(Convert.ToInt32(ID)) == null) { status = 0; } else { status = (int)Dal.load_T_news(Convert.ToInt32(ID)).News_Status; } switch (status) { case 1: str = CommonLib.ReadXML("lblNhaptinbai"); break; case 7: str = CommonLib.ReadXML("lblTrinhbay"); break; case 8: str = CommonLib.ReadXML("lblBientap"); break; case 9: str = CommonLib.ReadXML("lblDuyettinbai"); break; case 12: str = CommonLib.ReadXML("lblTinmoi"); break; case 13: str = CommonLib.ReadXML("lblTralainguoinhaptin"); break; case 72: str = CommonLib.ReadXML("lblChotrinhbay"); break; case 73: str = CommonLib.ReadXML("lblTralaitrinhbay"); break; case 82: str = CommonLib.ReadXML("lblChobientap"); break; case 83: str = CommonLib.ReadXML("lblTralaibientap"); break; case 92: str = CommonLib.ReadXML("lblBaichoduyet"); break; case 4: str = CommonLib.ReadXML("lblTinngungdang"); break; case 6: str = CommonLib.ReadXML("lblTinxuatban"); break; case 55: str = CommonLib.ReadXML("lblTindaxoa"); break; default: str = ""; break; } return(str); }
protected void cmd_Chamnhanbut_Click(object sender, EventArgs e) { bool checkall = true; foreach (DataGridItem item in dgr_tintuc.Items) { bool check = true; TextBox txt_tien = (TextBox)item.FindControl("txt_tien"); Label lbl_NewsID = (Label)item.FindControl("lbl_ID"); Label lbl_loaiID = (Label)item.FindControl("lbl_loaiID"); Label lbl_title = (Label)item.FindControl("lbl_title"); //LinkButton linkTittle = (LinkButton)item.FindControl("linkTittle"); int tien = 0; try { if (!string.IsNullOrEmpty(txt_tien.Text)) { check = true; tien = int.Parse(txt_tien.Text.Replace(",", "")); txt_tien.ForeColor = System.Drawing.Color.Black; } } catch { check = false; txt_tien.ForeColor = System.Drawing.Color.Red; checkall = false; } if (check) { HPCBusinessLogic.DAL.T_NewsDAL _Obj = new HPCBusinessLogic.DAL.T_NewsDAL(); if (tien > 0) { _Obj.Update_TiennhanbutTin(int.Parse(lbl_loaiID.Text), int.Parse(lbl_NewsID.Text), 0, tien, _user.UserID); } else { _Obj.Update_TiennhanbutTin(int.Parse(lbl_loaiID.Text), int.Parse(lbl_NewsID.Text), 0, 0, 0); } WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, lbl_title.Text, Request["Menu_ID"].ToString(), "Chấm nhận bút tin ", int.Parse(lbl_NewsID.Text), type); } } if (checkall) { System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", " alert('Chấm nhận bút thành công') ;", true); } else { System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", " alert('Hệ số nhận bút và tiền phải là kiểu số') ;", true); } }
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); } }
public void LoadImage() { int NewsID = int.Parse(lbl_News_ID.Text); int type = 0; try { type = int.Parse(Request["TypeID"].ToString()); } catch {; } HPCBusinessLogic.ImageFilesDAL image = new HPCBusinessLogic.ImageFilesDAL(); DataSet ds = new DataSet(); string loaitinbaiID = "", loaianhID = "", loaivideoID = ""; loaitinbaiID = ConfigurationManager.AppSettings["NewsType"].ToString(); loaianhID = ConfigurationManager.AppSettings["ImageType"].ToString(); loaivideoID = ConfigurationManager.AppSettings["VideoType"].ToString(); if (type.ToString() == loaitinbaiID) { HPCBusinessLogic.DAL.T_NewsDAL objnews = new HPCBusinessLogic.DAL.T_NewsDAL(); lbl_tieude.Text = objnews.GetOneFromT_NewsByID(NewsID).News_Tittle; } else if (type.ToString() == loaianhID) { HPCBusinessLogic.DAL.T_Album_CategoriesDAL objnews = new HPCBusinessLogic.DAL.T_Album_CategoriesDAL(); lbl_tieude.Text = objnews.load_T_Album_Categories(NewsID).Cat_Album_Name; } ds = image.ListAllImagesInNews(NewsID, type); if (ds != null && ds.Tables.Count > 0) { DataTable dt = ds.Tables[0]; dgr_anh.DataSource = dt.DefaultView; dgr_anh.DataBind(); foreach (DataGridItem item in dgr_anh.Items) { item.Attributes.Add("onmouseover", "currColor=this.style.backgroundColor;this.style.backgroundColor='" + CommonLib.HPCOnmouseoverGrid() + "'"); item.Attributes.Add("onmouseout", "this.style.backgroundColor=currColor"); TextBox txt_tien = (TextBox)item.FindControl("txt_tien"); //txt_tien.Text = string.Format("{0:#,#}", txt_tien.Text).Replace(".", ","); double _money = 0; try { _money = double.Parse(txt_tien.Text); } catch { _money = 0; } txt_tien.Text = string.Format("{0:#,#}", _money).Replace(".", ","); } } }
public void grdList_EditCommand(object source, DataGridCommandEventArgs e) { if (e.CommandArgument.ToString().ToLower() == "isunlock") { double _ID = Convert.ToInt32(this.grdList.DataKeys[e.Item.ItemIndex].ToString()); HPCBusinessLogic.DAL.T_NewsDAL _untilDAL = new HPCBusinessLogic.DAL.T_NewsDAL(); bool check = _untilDAL.GetOneFromT_NewsByID(_ID).News_Lock; if (check) { _untilDAL.UpdateFromT_NewsDynamic(" News_Lock = 0 Where News_ID = " + _ID); string strLog = "[Update News_Lock T_News 0]-->[T_News :ID: " + _ID + " Tittle: " + _untilDAL.GetOneFromT_NewsByID(_ID).News_Tittle + "]"; WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Un Lock]", Request["Menu_ID"].ToString(), strLog, _ID, ConstAction.BaoDT); this.LoadData(); } } if (e.CommandArgument.ToString().ToLower() == "downloadalias") { int _ID = Convert.ToInt32(this.grdList.DataKeys[e.Item.ItemIndex].ToString()); LoadFileDoc(_ID); } }
protected void dgData_EditCommand1(object source, DataGridCommandEventArgs e) { if (e.CommandArgument.ToString().ToLower() == "edit") { int tab = 0; if (TabContainer1.ActiveTabIndex == 1) { tab = 1; } HPCBusinessLogic.DAL.T_NewsDAL Dal = new HPCBusinessLogic.DAL.T_NewsDAL(); string _ID = dgr_tintuc2.DataKeys[e.Item.ItemIndex].ToString(); Dal.IsLock(double.Parse(_ID), 1); Response.Redirect("ArticleEdit.aspx?Menu_ID=" + Request["Menu_ID"].ToString() + "&ID=" + _ID.ToString() + "&Tab=" + tab); } else if (e.CommandArgument.ToString().ToLower() == "downloadalias") { int _ID = Convert.ToInt32(this.dgr_tintuc2.DataKeys[e.Item.ItemIndex].ToString()); ToasoanTTXVN.BaoDienTu.FilesDoc _file = new ToasoanTTXVN.BaoDienTu.FilesDoc(); _file.LoadFileDoc(_user.UserName, _ID); } }
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"]); }
private void LoadData_DangXuly() { string sOrder = " Order by News_DateCreated DESC "; pages.PageSize = Global.MembersPerPage; HPCBusinessLogic.DAL.T_NewsDAL _T_newsDAL = new HPCBusinessLogic.DAL.T_NewsDAL(); DataSet _ds; _ds = _T_newsDAL.BindGridT_NewsEditor(pages.PageIndex, pages.PageSize, BuildSQL(ConstNews.AddNew, sOrder)); int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString()); int TotalRecord = Convert.ToInt32(_ds.Tables[0].Rows.Count); if (TotalRecord == 0) { _ds = _T_newsDAL.BindGridT_NewsEditor(pages.PageIndex - 1, pages.PageSize, BuildSQL(ConstNews.AddNew, sOrder)); } this.dgr_tintuc1.DataSource = _ds; this.dgr_tintuc1.DataBind(); _ds.Clear(); pages.TotalRecords = CurrentPage2.TotalRecords = TotalRecords; CurrentPage2.TotalPages = pages.CalculateTotalPages(); CurrentPage2.PageIndex = pages.PageIndex; GetTotal(); }
private void LoadData_Baidaxuly() { string sOrder = GetOrderString() == "" ? "" : " ORDER BY " + GetOrderString(); Pager3.PageSize = Global.MembersPerPage; HPCBusinessLogic.DAL.T_NewsDAL _T_newsDAL = new HPCBusinessLogic.DAL.T_NewsDAL(); DataSet _ds; _ds = _T_newsDAL.Bin_T_NewsVersionDynamic(Pager3.PageIndex, Pager3.PageSize, BuildSQL(ConstNews.NewsAppro, sOrder)); int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString()); int TotalRecord = Convert.ToInt32(_ds.Tables[0].Rows.Count); if (TotalRecord == 0) { _ds = _T_newsDAL.Bin_T_NewsVersionDynamic(Pager3.PageIndex - 1, Pager3.PageSize, BuildSQL(ConstNews.NewsAppro, sOrder)); } Dgr_Baidaxuly.DataSource = _ds; Dgr_Baidaxuly.DataBind(); _ds.Clear(); Pager3.TotalRecords = CurrentPage3.TotalRecords = TotalRecords; CurrentPage3.TotalPages = Pager3.CalculateTotalPages(); CurrentPage3.PageIndex = Pager3.PageIndex; GetTotal(); }
private void DelRecordsCheckedBox() { HPCBusinessLogic.DAL.T_NewsDAL tt = new HPCBusinessLogic.DAL.T_NewsDAL(); T_News _obj_T_News = new T_News(); 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) { LinkButton linkname = (LinkButton)m_Item.FindControl("linkTittle"); double News_ID = double.Parse(dgr_tintuc1.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, linkname.Text, Request["Menu_ID"].ToString(), "[Nhập tin bài] [Bài đang chờ xử lý] [Xóa bài viết]", News_ID, ConstAction.BaoDT); } } } else 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) { LinkButton linkname = (LinkButton)m_Item.FindControl("linkTittle"); double News_ID = double.Parse(dgr_tintuc2.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, linkname.Text, Request["Menu_ID"].ToString(), "[Nhập tin bài] [Bài bị trả lại] [Xóa bài viết]", News_ID, ConstAction.BaoDT); } } } else if (TabContainer1.ActiveTabIndex == 3) { foreach (DataGridItem m_Item in dgr_BaiXoa.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_tintuc2.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, linkname.Text, Request["Menu_ID"].ToString(), "[Nhập tin bài] [Bài bị xóa] [Xóa bài viết]", News_ID, ConstAction.BaoDT); } } } if (TabContainer1.ActiveTabIndex == 0) { LoadData_DangXuly(); } else if (TabContainer1.ActiveTabIndex == 1) { LoadData_Bitralai(); } else if (TabContainer1.ActiveTabIndex == 3) { LoadData_Baibixoa(); } }
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() == "edittt") //{ // Label lbl_CL = (Label)e.Item.FindControl("lblchatluong"); // Label lbl_TL = (Label)e.Item.FindControl("lbltheloai"); // Label lbl_CLID = (Label)e.Item.FindControl("lblchatluongID"); // Label lbl_TLID = (Label)e.Item.FindControl("lbltheloaiID"); // DropDownList Drop_CL = (DropDownList)e.Item.FindControl("ddlnews_chatluong"); // DropDownList Drop_TL = (DropDownList)e.Item.FindControl("ddlNews_Theloai"); // ImageButton Image_Edit = (ImageButton)e.Item.FindControl("btnEdit"); // ImageButton Image_Update = (ImageButton)e.Item.FindControl("btnUpdate"); // ImageButton Image_Cancel = (ImageButton)e.Item.FindControl("btnCancel"); // if (lbl_CLID.Text.ToLower() != "null" && !string.IsNullOrEmpty(lbl_CLID.Text)) // Drop_CL.SelectedIndex = int.Parse(lbl_CLID.Text.Trim()); // if (lbl_TLID.Text.ToLower() != "null" && !string.IsNullOrEmpty(lbl_TLID.Text)) // { // if (lbl_TLID.Text.ToLower() != "3" && lbl_TLID.Text.ToLower() != "4") // { // Drop_TL.SelectedIndex = int.Parse(lbl_TLID.Text.Trim()); // Drop_TL.Visible = true; // lbl_TL.Visible = false; // } // } // else // { // Drop_TL.SelectedIndex = 0; // Drop_TL.Visible = true; // lbl_TL.Visible = false; // } // Image_Edit.Visible = false; // Image_Update.Visible = true; // Image_Cancel.Visible = true; // lbl_CL.Visible = false; // Drop_CL.Visible = true; //} //else if (e.CommandArgument.ToString().ToLower() == "update") //{ // Label lbl_CL = (Label)e.Item.FindControl("lblchatluong"); // Label lbl_TL = (Label)e.Item.FindControl("lbltheloai"); // Label lbl_CLID = (Label)e.Item.FindControl("lblchatluongID"); // Label lbl_TLID = (Label)e.Item.FindControl("lbltheloaiID"); // DropDownList Drop_CL = (DropDownList)e.Item.FindControl("ddlnews_chatluong"); // DropDownList Drop_TL = (DropDownList)e.Item.FindControl("ddlNews_Theloai"); // ImageButton Image_Edit = (ImageButton)e.Item.FindControl("btnEdit"); // ImageButton Image_Update = (ImageButton)e.Item.FindControl("btnUpdate"); // ImageButton Image_Cancel = (ImageButton)e.Item.FindControl("btnCancel"); // DropDownList drop_heso = (DropDownList)e.Item.FindControl("Drop_heso"); // int NewsID = int.Parse(dgr_tintuc.DataKeys[e.Item.ItemIndex].ToString()); // lbl_CL.Text = Drop_CL.SelectedItem.Text; // lbl_TL.Text = Drop_TL.SelectedItem.Text; // lbl_CLID.Text = Drop_CL.SelectedIndex.ToString(); // lbl_TLID.Text = Drop_TL.SelectedIndex.ToString(); // Image_Edit.Visible = true; // Image_Update.Visible = false; // Image_Cancel.Visible = false; // lbl_CL.Visible = true; // lbl_TL.Visible = true; // Drop_CL.Visible = false; // Drop_TL.Visible = false; // if (!string.IsNullOrEmpty(lbl_TLID.Text.Trim())) // { // drop_heso.Items.Clear(); // int chatluong = 0; try { chatluong = int.Parse(lbl_CLID.Text.Trim()); } // catch { ;} // int theloai = 0; try { theloai = int.Parse(lbl_TLID.Text.Trim()); } // catch { ;} // string where = " where 1=1 "; // if (chatluong != 0 || theloai != 0) // { // if (theloai == 3 || theloai == 4) // { // if (theloai == 4) // { // where = where + " and LoaiTT_TLID = " + theloai.ToString() + " and LoaiTT_CLID=" + chatluong.ToString(); // } // else // { // where = " where 1=1 LoaiTT_TLID=5 "; // } // } // else // { // where = where + " and LoaiTT_TLID = 1 and LoaiTT_CLID=" + chatluong.ToString() + " and LoaiTT_LoaiTinBai = " + theloai.ToString(); // } // UltilFunc.BindCombox(drop_heso, "HesoID", "Heso", "T_HesoTT", // " 1 = 1 and Heso>= (select LoaiTT_Tuheso from T_LoaihinhTT " + where + " )" + // " and Heso <= (select LoaiTT_Denheso from T_LoaihinhTT " + where + " ) order by Heso", "0"); // } // else // { // UltilFunc.BindCombox(drop_heso, "HesoID", "Heso", "T_HesoTT", // " 1 = 1 and Heso>= 0 and Heso <= 1 order by Heso", "0"); // } // //if (lbl_CLID.Text.Trim() == "1") // //{ // // UltilFunc.BindCombox(drop_heso, "HesoID", "Heso", "T_HesoTT", " 1 = 1 and Heso>= (select LoaiTT_Tuheso from T_LoaihinhTT where LoaiTTID=" + lbl_TLID.Text.Trim() + " and LoaiTT_Type=1 )" + // // " and Heso <= (select LoaiTT_Denheso from T_LoaihinhTT where LoaiTTID=" + lbl_TLID.Text.Trim() + " and LoaiTT_Type=1 ) order by Heso", "0"); // //} // //else // //{ // // drop_heso.DataSource = null; // // drop_heso.DataBind(); // //} // } // HPCBusinessLogic.DAL.T_NewsDAL obj = new HPCBusinessLogic.DAL.T_NewsDAL(); // obj.Update_Theloai_News(NewsID, Drop_TL.SelectedIndex, Drop_CL.SelectedIndex); //} //else if (e.CommandArgument.ToString().ToLower() == "back") //{ // Label lbl_CL = (Label)e.Item.FindControl("lblchatluong"); // Label lbl_TL = (Label)e.Item.FindControl("lbltheloai"); // DropDownList Drop_CL = (DropDownList)e.Item.FindControl("ddlnews_chatluong"); // DropDownList Drop_TL = (DropDownList)e.Item.FindControl("ddlNews_Theloai"); // ImageButton Image_Edit = (ImageButton)e.Item.FindControl("btnEdit"); // ImageButton Image_Update = (ImageButton)e.Item.FindControl("btnUpdate"); // ImageButton Image_Cancel = (ImageButton)e.Item.FindControl("btnCancel"); // Image_Edit.Visible = true; // Image_Update.Visible = false; // Image_Cancel.Visible = false; // lbl_CL.Visible = true; // lbl_TL.Visible = true; // Drop_CL.Visible = false; // Drop_TL.Visible = false; //} //else if (e.CommandArgument.ToString().ToLower() == "view") //{ // Label lbl_TL = (Label)e.Item.FindControl("lbltheloaiID"); // Label lbl_ID = (Label)e.Item.FindControl("lbl_ID"); // if (!String.IsNullOrEmpty(lbl_TL.Text)) // { // string js = ""; // if (lbl_TL.Text.Trim() == "3") // { // js = "alert('Trường ngày tháng phải nhập đúng theo định dang dd/MM/yyyy!');"; // } // else if (lbl_TL.Text.Trim() == "4") // { // js = "alert('Trường ngày tháng phải nhập đúng theo định dang dd/MM/yyyy!');"; // } // else // { // js = "Javascript:open_window_Scroll('" + Global.ApplicationPath // + "/Article/ViewAndPrint.aspx?Menu_ID=" // + Page.Request.QueryString["Menu_ID"].ToString() + // "&ID=" + lbl_ID.Text.Trim()+"',50,500,100,800);"; // } // System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), " ", js, true); // } //} //Search(); }
public void LoadImage() { int NewsID = int.Parse(lbl_News_ID.Text); int type = 1; try { if (Request["TypeID"] != null) { type = int.Parse(Request["TypeID"].ToString()); } } catch {; } string loaitinbaiID = string.Empty, loaianhID = string.Empty, loaivideoID = string.Empty; loaitinbaiID = ConfigurationManager.AppSettings["NewsType"].ToString(); loaianhID = ConfigurationManager.AppSettings["ImageType"].ToString(); loaivideoID = ConfigurationManager.AppSettings["VideoType"].ToString(); if (type.ToString() == loaitinbaiID) { HPCBusinessLogic.DAL.T_NewsDAL objnews = new HPCBusinessLogic.DAL.T_NewsDAL(); lbl_tieude.Text = objnews.GetOneFromT_NewsByID(NewsID).News_Tittle; } else if (type.ToString() == loaianhID) { HPCBusinessLogic.DAL.T_Album_CategoriesDAL objnews = new HPCBusinessLogic.DAL.T_Album_CategoriesDAL(); lbl_tieude.Text = objnews.load_T_Album_Categories(NewsID).Cat_Album_Name; } HPCBusinessLogic.ImageFilesDAL image = new HPCBusinessLogic.ImageFilesDAL(); DataSet ds = new DataSet(); ds = image.ListAllImagesInNews(NewsID, type); DataTable dt = ds.Tables[0]; dgr_anh.DataSource = dt.DefaultView; dgr_anh.DataBind(); //string _str_ID = "'"; //string _strtextID = "'"; //int i = 0; foreach (DataGridItem item in dgr_anh.Items) { item.Attributes.Add("onmouseover", "currColor=this.style.backgroundColor;this.style.backgroundColor='" + CommonLib.HPCOnmouseoverGrid() + "'"); item.Attributes.Add("onmouseout", "this.style.backgroundColor=currColor"); TextBox txt_tienNB = (TextBox)item.FindControl("txt_tiennhanbut"); //TextBox txt_tacgia = (TextBox)item.FindControl("txt_nguonanh"); //TextBox txt_tacgiaID = (TextBox)item.FindControl("txt_tacgiaID"); //if (i == 0) //{ // _str_ID = _str_ID + txt_tacgiaID.ClientID; // _strtextID = _strtextID + txt_tacgia.ClientID; //} //else //{ // _str_ID = _str_ID + "," + txt_tacgiaID.ClientID; // _strtextID = _strtextID + "," + txt_tacgia.ClientID; //} //i++; if (!string.IsNullOrEmpty(txt_tienNB.Text)) { txt_tienNB.Text = string.Format("{0:#,#}", double.Parse(txt_tienNB.Text.Replace(",", ""))).Replace(".", ","); } } //_str_ID = _str_ID + "'"; //_strtextID = _strtextID + "'"; //System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", " AutoCompleteSearch_Author(" + _strtextID + "," + _str_ID + ");", true); }
private void Send_TKTS() { HPCBusinessLogic.DAL.T_NewsDAL tt = new HPCBusinessLogic.DAL.T_NewsDAL(); 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) { LinkButton linkname = (LinkButton)m_Item.FindControl("linkTittle"); //dung them vao de Unlock truoc khi send //HPCBusinessLogic.DAL.T_NewsDAL tt = new HPCBusinessLogic.DAL.T_NewsDAL(); tt.IsLock(double.Parse(dgr_tintuc1.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString()), 0); //ar.Add(double.Parse(dgr_tintuc1.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString())); double News_ID = double.Parse(dgr_tintuc1.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString()); tt.Update_Status_tintuc(News_ID, ConstNews.NewsApproving_tk, _user.UserID, DateTime.Now); tt.Insert_Version_From_T_News_WithUserModify(News_ID, ConstNews.NewsAppro, ConstNews.NewsApproving_tk, _user.UserID); WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, linkname.Text, Request["Menu_ID"].ToString(), "[Nhập tin bài] [Bài đang chờ xử lý] [Gửi Trình bày tin bài]", News_ID, ConstAction.BaoDT); } } } else 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) { //dung them vao de Unlock truoc khi send LinkButton linkname = (LinkButton)m_Item.FindControl("linkTittle"); tt.IsLock(double.Parse(dgr_tintuc2.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString()), 0); double News_ID = double.Parse(dgr_tintuc2.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString()); tt.Update_Status_tintuc(News_ID, ConstNews.NewsApproving_tk, _user.UserID, DateTime.Now); tt.Insert_Version_From_T_News_WithUserModify(News_ID, ConstNews.NewsAppro, ConstNews.NewsApproving_tk, _user.UserID); WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, linkname.Text, Request["Menu_ID"].ToString(), "[Nhập tin bài] [Bài bị trả lại] [Gửi Trình bày tin bài]", News_ID, ConstAction.BaoDT); } } } else if (TabContainer1.ActiveTabIndex == 3) { foreach (DataGridItem m_Item in dgr_BaiXoa.Items) { CheckBox chk_Select = (CheckBox)m_Item.FindControl("optSelect"); if (chk_Select != null && chk_Select.Checked) { //dung them vao de Unlock truoc khi send LinkButton linkname = (LinkButton)m_Item.FindControl("linkTittle"); tt.IsLock(double.Parse(dgr_BaiXoa.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString()), 0); double News_ID = double.Parse(dgr_BaiXoa.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString()); tt.Update_Status_tintuc(News_ID, ConstNews.NewsApproving_tk, _user.UserID, DateTime.Now); tt.Insert_Version_From_T_News_WithUserModify(News_ID, ConstNews.NewsAppro, ConstNews.NewsApproving_tk, _user.UserID); WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, linkname.Text, Request["Menu_ID"].ToString(), "[Nhập tin bài] [Bài bị xóa] [Gửi Trình bày tin bài]", News_ID, ConstAction.BaoDT); } } } if (TabContainer1.ActiveTabIndex == 0) { LoadData_DangXuly(); } else if (TabContainer1.ActiveTabIndex == 1) { LoadData_Bitralai(); } else if (TabContainer1.ActiveTabIndex == 3) { LoadData_Baibixoa(); } }
private void GuiTinBai(string MaDoiTuong) { string Thaotac = ""; ArrayList ar = new ArrayList(); if (TabContainer1.ActiveTabIndex == 0) { foreach (DataGridItem m_Item in DataGrid_Dangxuly.Items) { CheckBox chk_Select = (CheckBox)m_Item.FindControl("optSelect"); if (chk_Select != null && chk_Select.Checked) { ar.Add(double.Parse(DataGrid_Dangxuly.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString())); } } } else if (TabContainer1.ActiveTabIndex == 1) { foreach (DataGridItem m_Item in DataGrid_TinTraLai.Items) { CheckBox chk_Select = (CheckBox)m_Item.FindControl("optSelect"); if (chk_Select != null && chk_Select.Checked) { ar.Add(double.Parse(DataGrid_TinTraLai.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString())); } } } if (!_isRefresh) { for (int i = 0; i < ar.Count; i++) { double News_ID = double.Parse(ar[i].ToString()); string _trace = _daltinbai.GetTrace(News_ID) + Request["MaDoiTuong"].ToString() + "_" + _user.UserID + ";"; _daltinbai.Update_Status_tintuc(News_ID, 1, _user.UserID, DateTime.Now, MaDoiTuong, _trace); _daltinbai.Insert_Phienban_From_T_Tinbai(News_ID, _user.UserID, DateTime.Now, Request["MaDoiTuong"].ToString()); _daltinbai.Insert_Tulieu_From_T_Tinbai(News_ID); Thaotac = "Thao tác gửi tin bài từ :" + CommonLib.GetTenDoiTuong(Request["MaDoiTuong"].ToString()) + "-->Gửi đến " + CommonLib.GetTenDoiTuong(MaDoiTuong) + "TinTuc:" + _daltinbai.load_T_news(int.Parse(News_ID.ToString())).Tieude; _daltinbai.IsLock(News_ID, 0); UltilFunc.Log_Thaotactinbai(_user.UserID, _user.UserFullName, DateTime.Now, Thaotac, News_ID); UltilFunc.Log_Action(_user.UserID, _user.UserFullName, DateTime.Now, int.Parse(Request["Menu_ID"]), Thaotac); int _statusvnonline = UltilFunc.GetColumnValuesOne("T_News", "News_Status", "RefID=" + News_ID); bool _vnnewsonline = _daltinbai.load_T_news(int.Parse(News_ID.ToString())).VietNamNews; if (_vnnewsonline && MaDoiTuong.ToUpper() == Global.MaXuatBan) { // Insert sang bao dien tu if (_statusvnonline == int.Parse(CommonLib.ReadXML("Status_BDT")) || _statusvnonline == 0) { HPCBusinessLogic.DAL.T_NewsDAL _T_NewsDAL = new HPCBusinessLogic.DAL.T_NewsDAL(); T_News _objT_News = SetItemBaoDienTu(News_ID); int _id_dt = _T_NewsDAL.InsertT_news(_objT_News); _T_NewsDAL.Update_Status_tintuc(_id_dt, int.Parse(CommonLib.ReadXML("Status_BDT")), _user.UserID, DateTime.Now); UltilFunc.Insert_News_Image(_objT_News.News_Body.Trim(), Convert.ToDouble(_id_dt.ToString())); } //end } this.TabContainer1_ActiveTabChanged(null, null); } } }
public void Search() { string Str_Search = ""; string Str_SearchPic = "", Str_SearchVideo = "", Str_SearchAnhTS = ""; int SearchPic = 0, SearchVideo = 0, SearchTinbai = 0, SearchAnhTS = 0; type = int.Parse(cbo_types.SelectedValue); if (type == 1) { SearchTinbai = 1; Str_Search = GetSQLSearch(); } if (type == 2) { SearchPic = 1; Str_SearchPic = GetSQLSearchPic(); } if (type == 3) { SearchVideo = 1; Str_SearchVideo = GetSQLSearchVideo(); } if (type == 4) { SearchAnhTS = 1; Str_SearchAnhTS = GetSQLSearchAnhTS(); } pages.PageSize = Global.MembersPerPage; HPCBusinessLogic.DAL.T_NewsDAL _T_newsDAL = new HPCBusinessLogic.DAL.T_NewsDAL(); DataSet _ds; _ds = _T_newsDAL.Search_All_News_Nhanbut(pages.PageIndex, pages.PageSize, SearchTinbai, SearchPic, SearchVideo, SearchAnhTS, Str_Search, Str_SearchPic, Str_SearchVideo, Str_SearchAnhTS); if (_ds != null) { try { int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString()); int TotalRecord = Convert.ToInt32(_ds.Tables[0].Rows.Count); if (TotalRecord == 0) { _ds = _T_newsDAL.Search_All_News_Nhanbut(pages.PageIndex - 1, pages.PageSize, SearchTinbai, SearchPic, SearchVideo, SearchAnhTS, Str_Search, Str_SearchPic, Str_SearchVideo, Str_SearchAnhTS); } if (TotalRecord > 0) { dgr_tintuc.DataSource = _ds.Tables[0]; dgr_tintuc.DataBind(); pages.TotalRecords = CurrentPage2.TotalRecords = TotalRecords; CurrentPage2.TotalPages = pages.CalculateTotalPages(); CurrentPage2.PageIndex = pages.PageIndex; dgr_tintuc.Columns[8].Visible = true; cmd_Chamnhanbut.Visible = true; foreach (DataGridItem item in dgr_tintuc.Items) { item.Attributes.Add("onmouseover", "currColor=this.style.backgroundColor;this.style.backgroundColor='" + CommonLib.HPCOnmouseoverGrid() + "'"); item.Attributes.Add("onmouseout", "this.style.backgroundColor=currColor"); TextBox txt_tien = (TextBox)item.FindControl("txt_tien"); double _money = 0; try { _money = double.Parse(txt_tien.Text); } catch { _money = 0; } txt_tien.Text = string.Format("{0:#,#}", _money).Replace(".", ","); } Panel_DS_Ketqua.Visible = true; } else { dgr_tintuc.DataSource = null; dgr_tintuc.DataBind(); pages.TotalRecords = CurrentPage2.TotalRecords = 0; CurrentPage2.TotalPages = 1; CurrentPage2.PageIndex = 1; cmd_Chamnhanbut.Visible = false; Panel_DS_Ketqua.Visible = false; } } catch { dgr_tintuc.DataSource = null; dgr_tintuc.DataBind(); pages.TotalRecords = CurrentPage2.TotalRecords = 0; CurrentPage2.TotalPages = 1; CurrentPage2.PageIndex = 1; cmd_Chamnhanbut.Visible = false; Panel_DS_Ketqua.Visible = false; } } else { dgr_tintuc.DataSource = null; dgr_tintuc.DataBind(); pages.TotalRecords = CurrentPage2.TotalRecords = 0; CurrentPage2.TotalPages = 1; CurrentPage2.PageIndex = 1; cmd_Chamnhanbut.Visible = false; Panel_DS_Ketqua.Visible = false; } }
public void Search() { string Str_Search = GetSQLSearch(); if (!string.IsNullOrEmpty(Str_Search)) { pages.PageSize = Global.MembersPerPage; HPCBusinessLogic.DAL.T_NewsDAL _T_newsDAL = new HPCBusinessLogic.DAL.T_NewsDAL(); DataSet _ds; _ds = _T_newsDAL.BindGridT_NewsSearchEditor(pages.PageIndex, pages.PageSize, Str_Search); if (_ds != null) { try { int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString()); int TotalRecord = Convert.ToInt32(_ds.Tables[0].Rows.Count); if (TotalRecord == 0) { _ds = _T_newsDAL.BindGridT_NewsSearchEditor(pages.PageIndex - 1, pages.PageSize, Str_Search); } if (TotalRecord > 0) { dgr_tintuc.DataSource = _ds; dgr_tintuc.DataBind(); pages.TotalRecords = CurrentPage2.TotalRecords = TotalRecords; CurrentPage2.TotalPages = pages.CalculateTotalPages(); CurrentPage2.PageIndex = pages.PageIndex; Panel_DS_Ketqua.Visible = true; } else { dgr_tintuc.DataSource = null; dgr_tintuc.DataBind(); pages.TotalRecords = CurrentPage2.TotalRecords = 0; CurrentPage2.TotalPages = 1; CurrentPage2.PageIndex = 1; Panel_DS_Ketqua.Visible = false; } } catch { dgr_tintuc.DataSource = null; dgr_tintuc.DataBind(); pages.TotalRecords = CurrentPage2.TotalRecords = 0; CurrentPage2.TotalPages = 1; CurrentPage2.PageIndex = 1; } } else { dgr_tintuc.DataSource = null; dgr_tintuc.DataBind(); pages.TotalRecords = CurrentPage2.TotalRecords = 0; CurrentPage2.TotalPages = 1; CurrentPage2.PageIndex = 1; Panel_DS_Ketqua.Visible = false; } } else { System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + CommonLib.ReadXML("msgXacnhanngaythang") + "');", true); } }