本文整理汇总了C#中Data.RetrieveRecommendedEvents方法的典型用法代码示例。如果您正苦于以下问题:C# Data.RetrieveRecommendedEvents方法的具体用法?C# Data.RetrieveRecommendedEvents怎么用?C# Data.RetrieveRecommendedEvents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data.RetrieveRecommendedEvents方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
if (cookie == null)
{
cookie = new HttpCookie("BrowserDate");
cookie.Value = DateTime.Now.ToString();
cookie.Expires = DateTime.Now.AddDays(22);
Response.Cookies.Add(cookie);
}
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
DataSet dsAll = dat.RetrieveRecommendedEvents(100, true);
FillEvents(dsAll);
}
示例2: FillRecommendedEvents
protected void FillRecommendedEvents()
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
//only show top 10
int topCount = 10;
//Put the sets together
DataSet dsAll = dat.RetrieveRecommendedEvents(topCount, true);
bool noneMessage = false;
if (dsAll.Tables.Count > 0)
if (dsAll.Tables[0].Rows.Count > 0)
{
//insert link to all recommended events
Session["RecomDS"] = dsAll;
Literal link = new Literal();
link.Text = "<h4 style=\"margin-bottom: 5px;\">Top 10 Recommended Events</h4><div><a class=\"NavyLink12\" onclick=\"OpenRadRecom();\">See All</a></div>";
RecommendedEvents.Controls.Add(link);
Hashtable hash = new Hashtable();
ASP.controls_pager_ascx pagerPanel = new ASP.controls_pager_ascx();
pagerPanel.PANEL_NAME = "ctl00_ContentPlaceHolder1_ctl13_Panel";
pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 3;
pagerPanel.PANEL_CSSCLASS = "FavoritesPanel";
pagerPanel.WIDTH = 260;
ArrayList a = new ArrayList(topCount);
for (int i = 0; i < topCount; i++)
{
dat.InsertOneEvent(dsAll, i, ref a, false);
}
RecommendedEvents.Controls.Add(pagerPanel);
pagerPanel.DATA = a;
pagerPanel.DataBind2();
}
else
{
noneMessage = true;
}
else
noneMessage = true;
if (noneMessage)
{
Label lab = new Label();
lab.Text = "There are no recommended events here this month. There are a few reasons for this. "+
"There simply is no events that fit your recommendation criteria, or you have selected not to "+
"recommend any events. To modify your preferences please visit the 'My Preferences' tab on this page.";
RecommendedEvents.Controls.Add(lab);
}
}
示例3: ChangeDS
//.........这里部分代码省略.........
#endregion
break;
case "4":
#region Next Week
string endDay = "";
string startDay = "";
switch(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).DayOfWeek)
{
case DayOfWeek.Sunday:
startDay = "7";
endDay = "13";
break;
case DayOfWeek.Monday:
startDay = "6";
endDay = "12";
break;
case DayOfWeek.Tuesday:
startDay = "5";
endDay = "11";
break;
case DayOfWeek.Wednesday:
startDay = "4";
endDay = "10";
break;
case DayOfWeek.Thursday:
startDay = "3";
endDay = "9";
break;
case DayOfWeek.Friday:
startDay = "2";
endDay = "8";
break;
case DayOfWeek.Saturday:
startDay = "1";
endDay = "7";
break;
default: break;
}
dat.TIME_FRAME = " AND EO.DateTimeStart > GETDATE() AND EO.DateTimeStart <= "+
"CONVERT(DATETIME,'"+DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).AddDays(double.Parse(endDay))+"') "+
"AND EO.DateTimeStart >= CONVERT(DATETIME,'"+DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).AddDays(double.Parse(startDay))+"')";
#endregion
break;
case "5":
#region Next Two Weeks
string endDay2 = "";
string startDay2 = "";
switch(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).DayOfWeek)
{
case DayOfWeek.Sunday:
startDay2 = "14";
endDay2 = "19";
break;
case DayOfWeek.Monday:
startDay2 = "13";
endDay2 = "18";
break;
case DayOfWeek.Tuesday:
startDay2 = "12";
endDay2 = "17";
break;
case DayOfWeek.Wednesday:
startDay2 = "11";
endDay2 = "16";
break;
case DayOfWeek.Thursday:
startDay2 = "10";
endDay2 = "15";
break;
case DayOfWeek.Friday:
startDay2 = "9";
endDay2 = "14";
break;
case DayOfWeek.Saturday:
startDay2 = "8";
endDay2 = "13";
break;
default: break;
}
dat.TIME_FRAME = " AND EO.DateTimeStart > GETDATE() AND EO.DateTimeStart <= "+
"CONVERT(DATETIME,'"+DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).AddDays(double.Parse(endDay2))+"') "+
"AND EO.DateTimeStart >= CONVERT(DATETIME,'"+DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).AddDays(double.Parse(startDay2))+"')";
#endregion
break;
case "7":
dat.TIME_FRAME = " AND EO.DateTimeStart > GETDATE() AND MONTH(EO.DateTimeStart) = " +
DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).Month + " AND YEAR(EO.DateTimeStart) = "+DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).Year;
break;
case "8":
dat.TIME_FRAME = " AND EO.DateTimeStart > GETDATE() AND ((MONTH(EO.DateTimeStart) = " +
DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).Month + " AND YEAR(EO.DateTimeStart) = "+DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).Year +") OR ("+
"MONTH(EO.DateTimeStart) = "+DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).AddMonths(1).Month + " AND YEAR(EO.DateTimeStart) = "+
DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).AddMonths(1).Year + "))";
break;
default: break;
}
dsAll = dat.RetrieveRecommendedEvents(100, true);
FillEvents(dsAll);
}