protected void Page_Load(object sender, EventArgs e) { string strPageNo = Request["PageNo"]; Int32.TryParse(strPageNo, out PageNo); if (PageNo == 0) { PageNo = 1; } if (!Page.IsPostBack) { BOLNews NewsBOL = new BOLNews(); rptItems.DataSource = NewsBOL.GetLatestNewsList(null, new int[] {}, PageSize, PageNo, null, "", 5); rptItems.DataBind(); int ResultCount = NewsBOL.GetLatestNewsListCount(null, new int[] { }, PageSize, PageNo, null, "", 5); int PageCount = (int)ResultCount / PageSize; if (ResultCount % PageSize > 0) { PageCount++; } ConcatUrl += ""; pgrToolbar.PageNo = PageNo; pgrToolbar.PageCount = PageCount; pgrToolbar.ConcatUrl = ConcatUrl; pgrToolbar.PageBind(); } }
protected void Page_Load(object sender, EventArgs e) { Response.ContentType = "text/xml"; BOLNews NewsBOL = new BOLNews(); rptNews.DataSource = NewsBOL.GetLatestNewsList(null, new int[] {}, 10, 1, null, null, null); rptNews.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { msgBox.Text = ""; if (!Page.IsPostBack) { BOLNews NewsBOL = new BOLNews(); rptLatestNews.DataSource = NewsBOL.GetLatestNewsList(null, new int[] {}, 20, 1, null, null, null); rptLatestNews.DataBind(); } }
protected void btnRemoveFromSelected_Click(object sender, EventArgs e) { if (ViewState["SelectedCode"] != null) { int NewsToRemoveCode = Convert.ToInt32(ViewState["SelectedCode"]); BOLNews NewsBOL = new BOLNews(); int NewPririty = 0; NewsBOL.SetNewPriority(NewsToRemoveCode, NewPririty); rptLatestNews.DataSource = NewsBOL.GetLatestNewsList(null, new int[] { }, 20, 1, null, null, null); rptLatestNews.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { BOLHardCode HardCodeBOL = new BOLHardCode(); HardCodeBOL.TableOrViewName = "HCNewsCats"; ltrHeader.Text = HardCodeBOL.GetNameByCode(_hCNewsCatCode); hplArchive.NavigateUrl = "~/?CatCode=" + _hCNewsCatCode + "&Archive=1"; BOLNews NewsBOL = new BOLNews(); rptNews.DataSource = NewsBOL.GetLatestNewsList(_hCNewsCatCode, null, _newsCount, 1, null, "", null); rptNews.DataBind(); }
protected void btnMoveToSelected_Click(object sender, EventArgs e) { if (ViewState["SelectedDragCode"] != null) { int NewstoDragCode = Convert.ToInt32(ViewState["SelectedDragCode"]); BOLNews NewsBOL = new BOLNews(); int NewPririty = NewsBOL.GetLatestPriority(0) + 100; NewsBOL.SetNewPriority(NewstoDragCode, NewPririty); int SelectedDragIndex = Convert.ToInt32(ViewState["SelectedDragIndex"]); rptLatestNews.DataSource = NewsBOL.GetLatestNewsList(null, new int[] { }, 20, 1, null, null, null); rptLatestNews.DataBind(); //rptSelectedNews.Items } else { msgBox.MessageTextMode = AKP.Web.Controls.Common.MessageMode.Error; msgBox.Text = "بروز خطا"; } }
private void ManageUpDown(VerDirections MoveDirection) { try { if (ViewState["SelectedCode"] == null) { msgBox.MessageTextMode = AKP.Web.Controls.Common.MessageMode.Error; msgBox.Text = "لطفا یک خبر را انتخاب کنید"; return; } int NewsCode = Convert.ToInt32(ViewState["SelectedCode"]); int? NewsToBeReplaceCode = null; bool Flag = false; int SelectedIndex; if (MoveDirection == VerDirections.Down) { SelectedIndex = 0; for (int i = 0; i < rptLatestNews.Items.Count; i++) { Panel CurPanel = (Panel)rptLatestNews.Items[i].FindControl("pnlTitle"); LinkButton btnNews = (LinkButton)rptLatestNews.Items[i].FindControl("btnNews"); int CurNewsCode = Convert.ToInt32(btnNews.Attributes["NewsCode"]); if (Flag) { NewsToBeReplaceCode = CurNewsCode; break; } if (CurNewsCode == NewsCode) { Flag = true; } } } else { SelectedIndex = rptLatestNews.Items.Count - 1; for (int i = rptLatestNews.Items.Count - 1; i >= 0; i--) { Panel CurPanel = (Panel)rptLatestNews.Items[i].FindControl("pnlTitle"); LinkButton btnNews = (LinkButton)rptLatestNews.Items[i].FindControl("btnNews"); int CurNewsCode = Convert.ToInt32(btnNews.Attributes["NewsCode"]); if (Flag) { NewsToBeReplaceCode = CurNewsCode; break; } if (CurNewsCode == NewsCode) { Flag = true; } } } if (NewsToBeReplaceCode != null) { BOLNews NewsBOL = new BOLNews(); bool Result = NewsBOL.ChangePririties(NewsCode, (int)NewsToBeReplaceCode); if (Result) { if (ViewState["ItemFiltered"] != null) { FilterItems(); } else { //int[] BulkArray = rptLatestNews.DataSource = NewsBOL.GetLatestNewsList(null, new int[] { }, 20, 1, null, null, null); rptLatestNews.DataBind(); } for (int i = 0; i < rptLatestNews.Items.Count; i++) { Panel CurPanel = (Panel)rptLatestNews.Items[i].FindControl("pnlTitle"); LinkButton btnCurNews = (LinkButton)rptLatestNews.Items[i].FindControl("btnNews"); int CurNewsCode = Convert.ToInt32(btnCurNews.Attributes["NewsCode"]); CurPanel.CssClass = "UnSelected"; if (CurNewsCode == NewsCode) { CurPanel.CssClass = "SelectedPanel"; SelectedIndex = i; break; } } } } ShowHideButtons(SelectedIndex, rptLatestNews.Items.Count); } catch (Exception err) { msgBox.MessageTextMode = AKP.Web.Controls.Common.MessageMode.Error; msgBox.Text = "بروز خطا : " + err.Message; } }
public int[] ShowLatestNews(int?HCNewsCatCode, int PageSize, int[] ExcludeCodeArray, int?HCContentTypeCode, int?paramPageNo, bool ShowPager, string strDate, int HCNewsTypeCode) { if (!_showHeader) { pnlHeader.Visible = false; } //if(ExcludeCodeArray.Length > 0) // ShowTime = true; _pageSize = PageSize; strPageNo = Request["PageNo"]; try { PageNo = Convert.ToInt32(strPageNo); } catch { } if (PageNo == 0) { PageNo = 1; } if (paramPageNo != null) { PageNo = (int)paramPageNo; } BOLNews NewsBOL = new BOLNews(); IQueryable <vLatestNews> ItemList = NewsBOL.GetLatestNewsList(HCNewsCatCode, ExcludeCodeArray, _pageSize, PageNo, HCContentTypeCode, strDate, HCNewsTypeCode); rptNewsList.DataSource = ItemList; rptNewsList.DataBind(); int[] NewCodeArray = new int[50]; if (ExcludeCodeArray != null) { if (ExcludeCodeArray.Length > 0) { NewCodeArray[0] = ExcludeCodeArray[0]; } } int Counter = 1; foreach (var item in ItemList) { NewCodeArray[Counter] = item.Code; Counter++; } string MainHeader = ""; if (HCNewsTypeCode != 0) { switch (HCNewsTypeCode) { case 1: ltrHeader.Text = "آخرین اخبار"; break; case 2: ltrHeader.Text = "یادداشت"; break; case 3: ltrHeader.Text = "گزارش"; break; case 4: ltrHeader.Text = "گفتگو"; break; default: break; } } if (HCNewsCatCode != null) { BOLHardCode HardCodeBOL = new BOLHardCode(); HardCodeBOL.TableOrViewName = "HCNewsCats"; ltrHeader.Text = HardCodeBOL.GetNameByCode((int)HCNewsCatCode); switch (HCNewsCatCode) { case 0: CaptionClass = "Latest"; break; case 1: CaptionClass = "Politics"; break; case 2: CaptionClass = "Socity"; break; case 3: CaptionClass = "Sport"; break; case 4: CaptionClass = "Event"; break; case 5: CaptionClass = "Tech"; break; case 6: CaptionClass = "Culture"; break; case 7: CaptionClass = "Reading"; break; default: CaptionClass = "Latest"; break; } } if (!string.IsNullOrEmpty(strDate)) { ltrHeader.Text = "اخبار تاریخ " + Tools.ChageEnc(strDate); ConcatUrl += "&d=" + Request["d"]; } if (ShowPager) { string CatCode = Request["CatCode"]; if (!string.IsNullOrEmpty(CatCode)) { ConcatUrl += "&CatCode=" + CatCode; } int ResultCount = NewsBOL.GetLatestNewsListCount(HCNewsCatCode, ExcludeCodeArray, _pageSize, PageNo, HCContentTypeCode, strDate, HCNewsTypeCode); int PageCount = ResultCount / _pageSize; if (ResultCount % _pageSize > 0) { PageCount++; } pgrToolbar.PageNo = PageNo; pgrToolbar.PageCount = PageCount; pgrToolbar.ConcatUrl = ConcatUrl; pgrToolbar.PageBind(); } else { pgrToolbar.Visible = false; } return(NewCodeArray); }