-
Notifications
You must be signed in to change notification settings - Fork 1
/
findallarticlebyauthor.aspx.cs
123 lines (99 loc) · 4.26 KB
/
findallarticlebyauthor.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#region XD World Recipe V 3
// FileName: findallarticlebyauthor.cs
// Author: Dexter Zafra
// Date Created: 5/25/2008
// Website: www.ex-designz.net
#endregion
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using XDRecipe.UI;
using XDRecipe.BL;
using XDRecipe.BL.Providers.Article;
using XDRecipe.Common;
using XDRecipe.Model;
using XDRecipe.Security;
using XDRecipe.BL.Providers.User;
using XDRecipe.Common.Utilities;
public partial class findallarticlebyauthor : BasePage
{
private Utility Util
{
get { return new Utility(); }
}
private string strAuthor;
private int OrderBy;
private int SortBy;
protected void Page_Load(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.Request.QueryString["ob"]) || !string.IsNullOrEmpty(this.Request.QueryString["sb"]))
{
OrderBy = (int)Util.Val(Request.QueryString["ob"]);
int SortBy = (int)Util.Val(Request.QueryString["sb"]);
lblsortname.Text = Util.GetSortOptionName(OrderBy) + Util.GetSortOptionOrderBy(SortBy);
}
else
{
lblsortname.Text = Util.GetSortOptionName(OrderBy);
}
strAuthor = Request.QueryString["author"].ToString();
GetMetaTitleTagKeywords(strAuthor);
BindList();
}
private void BindList()
{
strAuthor = Request.QueryString["author"].ToString();
OrderBy = (int)Util.Val(Request.QueryString["ob"]);
SortBy = (int)Util.Val(Request.QueryString["sb"]);
string ParamURL = Request.CurrentExecutionFilePath + "?author=" + strAuthor;
int GetPage = (int)Util.Val(Request.QueryString["page"]);
int iPage = 1;
if (!string.IsNullOrEmpty(this.Request.QueryString["page"]))
iPage = (int)Util.Val(Request.QueryString["page"]);
int PageSize = PagerLinks.DefaultPageSize;
int PageIndex = iPage;
ProviderGetAllArticlebyAuthor GetArticle = ProviderGetAllArticlebyAuthor.GetInstance();
GetArticle.Param(strAuthor, OrderBy, SortBy, PageIndex, PageSize);
PagerLinks Pager = PagerLinks.GetInstance();
Pager.PagerLinksParam(PageIndex, PageSize, GetArticle.RecordCount);
lbcount.Text = "(" + GetArticle.RecordCount.ToString() + ") article published by (<b>" + strAuthor + "</b>)";
lbPagerLink.Text = Pager.DisplayNumericPagerLink(ParamURL, OrderBy, SortBy, GetPage);
lblRecpagetop.Text = Pager.GetTopRightPagerCounterCustomPaging;
lblRecpage.Text = Pager.GetBottomPagerCounterCustomPaging;
ArticleCat.DataSource = GetArticle.GetArticle();
ArticleCat.DataBind();
}
private void GetMetaTitleTagKeywords(string AuthorName)
{
Page.Header.Title = "Article published by " + AuthorName;
HtmlMeta metaTag = new HtmlMeta();
metaTag.Name = "Keywords";
metaTag.Content = "article, cooking article";
this.Header.Controls.Add(metaTag);
}
public void ArticleCat_ItemDataBound(Object s, RepeaterItemEventArgs e)
{
Utility.GetIdentifyItemNewPopular(Convert.ToDateTime(DataBinder.Eval(e.Item.DataItem, "Date")), e,
(int)DataBinder.Eval(e.Item.DataItem, "Hits"));
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
HyperLink editlink = (HyperLink)(e.Item.FindControl("editlink"));
int UserID = (int)DataBinder.Eval(e.Item.DataItem, "UID");
if (Authentication.IsUserAuthenticated && UserID == UserIdentity.UserID)
{
editlink.Visible = true;
editlink.Text = "<img src='images/icon_pencil.gif' alt='Edit' border='0'> Edit";
editlink.NavigateUrl = "editarticle.aspx?aid=" + (int)DataBinder.Eval(e.Item.DataItem, "ID");
editlink.Attributes.Add("onmouseover", "Tip('Edit <b>" + DataBinder.Eval(e.Item.DataItem, "Title") + "</b> article.', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
editlink.Attributes.Add("onmouseout", "UnTip()");
}
}
}
}