本文整理汇总了C#中Data.GetMonth方法的典型用法代码示例。如果您正苦于以下问题:C# Data.GetMonth方法的具体用法?C# Data.GetMonth怎么用?C# Data.GetMonth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data.GetMonth方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AdvanceMonth
protected void AdvanceMonth(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", ":")));
RadScheduler1.SelectedDate = RadScheduler1.SelectedDate.AddMonths(1);
MonthLabel.Text = dat.GetMonth(RadScheduler1.SelectedDate.Month.ToString()) + " " + RadScheduler1.SelectedDate.Year.ToString();
}
示例2: DoCalendar
protected void DoCalendar(DataView dv)
{
//Fix calendar timezone
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);
}
DateTime dateNow = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"));
Data dat = new Data(dateNow);
RadScheduler1.TimeZoneOffset = -(DateTime.UtcNow.Subtract(dateNow));
//dv.RowFilter = "CalendarNum <> ''";
RadScheduler1.DataSource = dv;
RadScheduler1.DataBind();
RadScheduler1.SelectedDate = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"));
//RadScheduler1.SelectedDate = DateTime.Parse("8/9/2010 23:13:00");
MonthLabel.Text = dat.GetMonth(RadScheduler1.SelectedDate.Month.ToString());
}
示例3: Page_Load
//.........这里部分代码省略.........
{
if (cityID != "")
{
LocationLabel.Text += cityID;
if (state != "")
LocationLabel.Text += ", " + stateID;
}
else
{
if (state != "")
LocationLabel.Text += stateID;
}
}
if (RadCalendar1.SelectedDate.ToShortDateString() != "1/1/0001")
LocationLabel.Text += " on " + RadCalendar1.SelectedDate.ToShortDateString();
}
ds = (DataSet)Session["HomeEvents"];
if (ds != null)
{
if (ds.Tables.Count > 0)
if (ds.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
DateTime date = DateTime.Parse(ds.Tables[0].Rows[i]["DateTimeStart"].ToString());
ASP.controls_homeevent_ascx eventH = new ASP.controls_homeevent_ascx();
eventH.DAY = date.DayOfWeek.ToString().Substring(0, 3);
eventH.DAY_NUMBER = date.Day.ToString();
eventH.MONTH = dat.GetMonth(date.Month.ToString()).Substring(0, 3);
eventH.EVENT_NAME = ds.Tables[0].Rows[i]["Header"].ToString();
if (ds.Tables[0].Rows[i]["Content"].ToString().Length > 150)
eventH.SUMMARY = dat.BreakUpString(ds.Tables[0].Rows[i]["Content"].ToString().Substring(0, 150), 67) + "...";
else
eventH.SUMMARY = dat.BreakUpString(ds.Tables[0].Rows[i]["Content"].ToString(), 67) + "...";
eventH.EVENT_ID = int.Parse(ds.Tables[0].Rows[i]["EventID"].ToString());
EventPanel.Controls.Add(eventH);
}
}
else
{
Label label = new Label();
label.CssClass = "EventBody";
label.Text = "No events are listed for this date. Sorry. But perhaps you could enter one... <a class=\"AddLink\" href=\"BlogEvent.aspx\">Enter Events</a>.";
EventPanel.Controls.Add(label);
}
else
{
Label label = new Label();
label.CssClass = "EventBody";
label.Text = "No events are listed for this date. Sorry. But perhaps you could enter one... <a class=\"AddLink\" href=\"BlogEvent.aspx\">Enter Events</a>.";
EventPanel.Controls.Add(label);
}
}
else
{
Label label = new Label();
label.CssClass = "EventBody";
示例4: GoToSearch
//.........这里部分代码省略.........
}
}
else
{
DataSet ds1 = dat.GetData("SELECT * FROM SearchIPs WHERE IP='" + dat.GetIP() + "'");
if(ds1.Tables.Count > 0)
if (ds1.Tables[0].Rows.Count > 0)
{
country = ds1.Tables[0].Rows[0]["Country"].ToString();
state = ds1.Tables[0].Rows[0]["State"].ToString();
city = ds1.Tables[0].Rows[0]["City"].ToString();
}
}
if (country != "")
country = " AND E.Country = " + country;
int c = 0;
if (state != "")
{
c++;
}
if (city != "")
{
c++;
}
SqlDbType[] types = new SqlDbType[c];
object[] data = new object[c];
if (state != "")
{
types[0] = SqlDbType.NVarChar;
data[0] = state;
state = " AND [email protected] ";
if (city != "")
{
types[1] = SqlDbType.NVarChar;
data[1] = city;
city = " AND [email protected] ";
}
}
else
{
if (city != "")
{
types[0] = SqlDbType.NVarChar;
data[0] = city;
city = " AND [email protected] ";
}
}
DataSet ds = dat.GetDataWithParemeters("SELECT DISTINCT TOP 10 EO.DateTimeStart, E.Header, E.Content, EO.EventID FROM Events E, Event_Occurance EO WHERE E.ID=EO.EventID " + country + state + city + " AND CONVERT(NVARCHAR, MONTH(EO.DateTimeStart)) + '/' + CONVERT(NVARCHAR, DAY(EO.DateTimeStart)) + '/' + CONVERT(NVARCHAR, YEAR(EO.DateTimeStart)) = '" + RadCalendar1.SelectedDate.ToShortDateString() + "'", types, data);
EventPanel.Controls.Clear();
if (ds.Tables.Count > 0)
if (ds.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
DateTime date = DateTime.Parse(ds.Tables[0].Rows[i]["DateTimeStart"].ToString());
ASP.controls_homeevent_ascx eventH = new ASP.controls_homeevent_ascx();
eventH.DAY = date.DayOfWeek.ToString().Substring(0, 3);
eventH.DAY_NUMBER = date.Day.ToString();
eventH.MONTH = dat.GetMonth(date.Month.ToString()).Substring(0, 3);
eventH.EVENT_NAME = ds.Tables[0].Rows[i]["Header"].ToString();
if (ds.Tables[0].Rows[i]["Content"].ToString().Length > 150)
eventH.SUMMARY = dat.BreakUpString(ds.Tables[0].Rows[i]["Content"].ToString().Substring(0, 150), 67) + "...";
else
eventH.SUMMARY = dat.BreakUpString(ds.Tables[0].Rows[i]["Content"].ToString(), 67) + "...";
eventH.EVENT_ID = int.Parse(ds.Tables[0].Rows[i]["EventID"].ToString());
EventPanel.Controls.Add(eventH);
}
}
else
{
Label label = new Label();
label.CssClass = "EventBody";
label.Text = "No events are listed for this date. Sorry. But perhaps you could enter one... <a class=\"AddLink\" href=\"EnterEvent.aspx\">Enter Events</a>.";
EventPanel.Controls.Add(label);
}
else
{
Label label = new Label();
label.CssClass = "EventBody";
label.Text = "No events are listed for this date. Sorry. But perhaps you could enter one... <a class=\"AddLink\" href=\"EnterEvent.aspx\">Enter Events</a>.";
EventPanel.Controls.Add(label);
}
Session["HomeEvents"] = ds;
}
示例5: Page_Load
//.........这里部分代码省略.........
RadScheduler1.DataSource = dat.GetData("SELECT CONVERT(NVARCHAR,MONTH(GEO.DateTimeStart)) + '/' + " +
"CONVERT(NVARCHAR,DAY(GEO.DateTimeStart)) + '/' + " +
"CONVERT(NVARCHAR,YEAR(GEO.DateTimeStart)) + ' 12:00:00' AS DateStart, " +
"CONVERT(NVARCHAR,COUNT(CONVERT(NVARCHAR,MONTH(GEO.DateTimeStart)) + '/' + " +
"CONVERT(NVARCHAR,DAY(GEO.DateTimeStart)) + '/' +" +
"CONVERT(NVARCHAR,YEAR(GEO.DateTimeStart)))) + CASE WHEN COUNT(CONVERT(NVARCHAR,MONTH(GEO.DateTimeStart)) + '/' + " +
"CONVERT(NVARCHAR,DAY(GEO.DateTimeStart)) + '/' +" +
"CONVERT(NVARCHAR,YEAR(GEO.DateTimeStart))) > 1 THEN ' events' ELSE ' event' END AS Name FROM " +
"GroupEvent_Occurance GEO, GroupEvents GE WHERE GE.LIVE='True' AND GEO.GroupEventID=GE.ID " +
"AND GE.GroupID=" + Request.QueryString["ID"].ToString() +
" GROUP BY CONVERT(NVARCHAR,MONTH(GEO.DateTimeStart)) + '/' + " +
"CONVERT(NVARCHAR,DAY(GEO.DateTimeStart)) + '/' +" +
"CONVERT(NVARCHAR,YEAR(GEO.DateTimeStart))");
}
else
{
RadScheduler1.DataSource = dat.GetData("SELECT CONVERT(NVARCHAR,MONTH(GEO.DateTimeStart)) + '/' + " +
"CONVERT(NVARCHAR,DAY(GEO.DateTimeStart)) + '/' + " +
"CONVERT(NVARCHAR,YEAR(GEO.DateTimeStart)) + ' 12:00:00' AS DateStart, " +
"CONVERT(NVARCHAR,COUNT(CONVERT(NVARCHAR,MONTH(GEO.DateTimeStart)) + '/' + " +
"CONVERT(NVARCHAR,DAY(GEO.DateTimeStart)) + '/' +" +
"CONVERT(NVARCHAR,YEAR(GEO.DateTimeStart)))) + CASE WHEN COUNT(CONVERT(NVARCHAR,MONTH(GEO.DateTimeStart)) + '/' + " +
"CONVERT(NVARCHAR,DAY(GEO.DateTimeStart)) + '/' +" +
"CONVERT(NVARCHAR,YEAR(GEO.DateTimeStart))) > 1 THEN ' events' ELSE ' event' END AS Name FROM " +
"GroupEvent_Occurance GEO, GroupEvents GE WHERE GE.LIVE='True' AND GE.EventType=1 AND GEO.GroupEventID=GE.ID " +
"AND GE.GroupID=" + Request.QueryString["ID"].ToString() +
" GROUP BY CONVERT(NVARCHAR,MONTH(GEO.DateTimeStart)) + '/' + " +
"CONVERT(NVARCHAR,DAY(GEO.DateTimeStart)) + '/' +" +
"CONVERT(NVARCHAR,YEAR(GEO.DateTimeStart))");
}
RadScheduler1.DataBind();
RadScheduler1.SelectedDate = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"));
//RadScheduler1.SelectedDate = DateTime.Parse("8/9/2010 23:13:00");
MonthLabel.Text = dat.GetMonth(RadScheduler1.SelectedDate.Month.ToString());
//MonthLabel.Text += " "+RadScheduler1.SelectedDate.ToString();
}
#endregion
//Do this before unread threads are marked as read
if (Session["User"] != null)
{
DataView ThreadsRead = dat.GetDataDV("SELECT * FROM ThreadRead TH, GroupThreads GT WHERE TH.UserID=" +
Session["User"].ToString() + " AND TH.[Read] = 'False' AND GT.GroupID=" + Request.QueryString["ID"].ToString() +
" AND GT.ID=TH.ThreadID ");
if (ThreadsRead.Count > 0)
RadTabStrip1.Tabs[1].Text = "<div id=\"BiggerNewDiv\" style=\"float: left;display: block;font-weight: bold;color: #ff6b09;font-size: 12px;" +
"\"><div style=\"float: left;\">(</div><div style=\"float: left\" id=\"NewThreadDiv\">" +
ThreadsRead.Count.ToString() +
"</div> unread)</div> <span onclick='HideSocial()'>Stuff We Talk About</span>";
}
#region Take care of threads
SortDropDown.Items[1].Attributes.Add("onclick", "ShowLoading();");
SortDropDown.Items[2].Attributes.Add("onclick", "ShowLoading();");
SortDropDown.Items[3].Attributes.Add("onclick", "ShowLoading();");
SortThreads(SortDropDown, new EventArgs());
#endregion
//other details
//TagCloud.THE_ID = int.Parse(Request.QueryString["ID"].ToString());
GroupDescriptionLabel.Text = dvGroup[0]["Content"].ToString();
//Fix calendar timezone
RadScheduler1.TimeZoneOffset = -(DateTime.UtcNow.Subtract(dateNow));
示例6: fillEvent
protected void fillEvent(string ID, bool isedit)
{
try
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
DateTime isn = DateTime.Now;
if (!DateTime.TryParse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"), out isn))
isn = DateTime.Now;
DateTime isNow = isn;
Data dat = new Data(isn); DataView dvEvent = dat.GetDataDV("SELECT * FROM Trips T WHERE T.ID=" + ID);
EventNameTextBox.Text = dvEvent[0]["Header"].ToString();
HowDressTextBox.Text = dvEvent[0]["HowDress"].ToString();
WhatObtainTextBox.Text = dvEvent[0]["WhatObtain"].ToString();
if (isedit)
{
nameLabel.Text = "<h1>You are submitting changes for Adventure: " + dvEvent[0]["Header"].ToString() + "</h1>";
}
Session["EffectiveUserName"] = dvEvent[0]["UserName"].ToString();
DataView dvDirections = dat.GetDataDV("SELECT * FROM TripDirections WHERE TripID=" + ID);
ListItem item;
string walking = "";
foreach (DataRowView row in dvDirections)
{
walking = "1";
if (row["Walking"].ToString() == "False")
walking = "0";
item = new ListItem("Destination " + (DirectionsListBox.Items.Count + 1).ToString(),
row["Country"].ToString() + ";" + row["State"].ToString() + ";" +
row["City"].ToString() + ";" +
row["Zip"].ToString() + ";" + walking + ";" + row["Directions"].ToString() +
"-" + row["Address"].ToString());
DirectionsListBox.Items.Add(item);
}
dvDirections = dat.GetDataDV("SELECT * FROM TripMonths WHERE TripID=" + ID);
foreach (DataRowView row in dvDirections)
{
item = new ListItem(dat.GetMonth(row["MonthStart"].ToString()) + ", " + row["DayStart"].ToString() +
" - " + dat.GetMonth(row["MonthEnd"].ToString()) + "," + row["DayEnd"].ToString(),
row["MonthStart"].ToString() + ", " + row["DayStart"].ToString() +
" - " + row["MonthEnd"].ToString() + "," + row["DayEnd"].ToString());
MonthsListBox.Items.Add(item);
}
dvDirections = dat.GetDataDV("SELECT * FROM TripDays WHERE TripID=" + ID);
string days = "";
foreach (DataRowView row in dvDirections)
{
item = new ListItem(dat.GetHours(row["Days"].ToString()).Replace("<br/>", "") +
" - " + row["StartTime"].ToString() +
" - " + row["EndTime"].ToString(), row["Days"].ToString() +
" - " + row["StartTime"].ToString() +
" - " + row["EndTime"].ToString());
TimeListBox.Items.Add(item);
}
dvDirections = dat.GetDataDV("SELECT * FROM Trips_WhatToBring WHERE TripID=" + ID);
foreach (DataRowView row in dvDirections)
{
item = new ListItem((BringListBox.Items.Count + 1).ToString() + ". " +
row["WhatToBring"].ToString(), row["WhatToBring"].ToString());
BringListBox.Items.Add(item);
}
foreach (ListItem itemz in MeansCheckList.Items)
{
if (dvEvent[0]["Means"].ToString().Contains(itemz.Value))
itemz.Selected = true;
}
char[] delimer = { '-' };
char[] delmer = { ':' };
string[] toksTimes = dvEvent[0]["Duration"].ToString().Split(delimer);
string[] toksMin = toksTimes[0].Split(delmer);
string[] toksMax = toksTimes[1].Split(delmer);
MinHoursTextBox.Text = toksMin[0];
MinMinsTextBox.Text = toksMin[1];
MaxHoursTextBox.Text = toksMax[0];
MaxMinsTextBox.Text = toksMax[1];
if (dvEvent[0]["MinPrice"] != null)
{
if (dvEvent[0]["MinPrice"].ToString() != "")
{
MinTextBox.Text = dvEvent[0]["MinPrice"].ToString();
}
}
if (dvEvent[0]["MaxPrice"] != null)
{
if (dvEvent[0]["MaxPrice"].ToString() != "")
{
//.........这里部分代码省略.........
示例7: Page_Load
//.........这里部分代码省略.........
DataView dvTopGroupActivity = GetTheActivity(thePlace);
//Find the top 5 most recent
if (dvTopGroupActivity.Count > 0)
{
dvTopGroupActivity.Sort = "TheDate DESC";
}
int countIndex = 5;
if (dvTopGroupActivity.Count < 5)
countIndex = dvTopGroupActivity.Count;
string theType = "";
Literal theLit = new Literal();
GroupsPanel.Controls.Clear();
string userID = "";
string content = "";
DataView dvUser = new DataView();
DataView dv = new DataView();
DataView dvGroup = new DataView();
DataView dvG = new DataView();
if (dvTopGroupActivity.Count > 0)
{
for (int i = 0; i < countIndex; i++)
{
theType = dvTopGroupActivity[i]["Type"].ToString();
//<div style=\"width: 388px;background-repeat: repeat-y; background-image: url(images/ActCommentMiddle.png);\" class=\"topDiv\">
theLit.Text += "<div " +
"class=\"topDiv\" style=\"width: 378px;height: 143px;padding-left: 10px;padding-top: 10px; background-image: "+
"url(images/ActCommentTopPurple10.png); background-repeat: no-repeat; \"><div style=\"float: left;\"><img src=\"images/QuoteTop.png\" /></div><div style=\"float: left; width: 350px; padding-bottom: 5px;\">";
DateTime theDate = DateTime.Parse(dvTopGroupActivity[i]["TheDate"].ToString());
string postedText = "<div style=\"clear: both;\"><div style=\"float: left;\"><span " +
"style=\"font-size: 12px; font-style: italic; font-family: arial; color: #a5c13a;\">Posted " +
dat.GetMonth(theDate.Month.ToString()) + " " +
theDate.Day.ToString() + ", " + theDate.Year.ToString() + "</span><br/>";
switch (theType)
{
case "GEP":
dv = dat.GetDataDV("SELECT *, GEO.ID AS GEOID FROM GroupEvents GE, " +
"GroupEvent_Occurance GEO WHERE GE.ID=GEO.GroupEventID AND GE.ID=" +
dvTopGroupActivity[i]["TheID"].ToString());
userID = dv[0]["UserID"].ToString();
dvGroup = dat.GetDataDV("SELECT * FROM Groups WHERE ID=" + dv[0]["GroupID"].ToString());
dvUser = dat.GetDataDV("SELECT * FROM UserPreferences UP, Users U " +
"WHERE UP.UserID=U.User_ID AND UP.UserID=" + userID);
theLit.Text += "<div style=\"float: left; padding-right: 10px; padding-left: " +
"10px; padding-bottom: 5px; padding-top: 5px;\">" + getUserProfile(userID) + "</div>";
content = dat.stripHTML(dv[0]["Content"].ToString());
if (content.Length > 170)
content = content.Substring(0, 170) + "...";
theLit.Text += "<div style=\"padding-top: 5px;font-family: Arial; font-size: 12px; color: " +
"#cccccc; font-style: italic;\">" + content + " <a style=\"text-decoration: none;\" href=\"" +
dat.MakeNiceName(dv[0]["Name"].ToString()) + "_" +
dv[0]["GEOID"].ToString() + "_" + dvTopGroupActivity[i]["TheID"].ToString() +
"_GroupEvent\"><span class=\"AddPurpleLink\">Read More</span></a></div>";
theLit.Text += postedText;
theLit.Text += "<span style=\"font-size: 12px; font-family: arial; color: #cccccc;\">posted by <a href=\"" + dvUser[0]["UserName"].ToString() +
"_Friend\" class=\"AddLink\">" + dvUser[0]["UserName"].ToString() +
"</a></span> <br/>";
theLit.Text += "<a href=\"" + dat.MakeNiceName(dvGroup[0]["Header"].ToString()) +
"_" + dvGroup[0]["ID"].ToString() + "_Group\" class=\"AddPurpleLink\">" +
dvGroup[0]["Header"].ToString() + " Group</a></div><div style=\"float: right;\"><img src=\"images/QuoteBottom.png\" /></div></div>";
break;
示例8: ProgressCalendar
protected void ProgressCalendar(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);
}
string parameter = Request.Params["__EVENTARGUMENT"];
char[] delim = { ';' };
string[] parmtrs = parameter.Split(delim);
Session["SelectToolTip"] = parmtrs[1];
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
RadScheduler1.SelectedDate = DateTime.Parse(parmtrs[0]);
MonthLabel.Text = dat.GetMonth(RadScheduler1.SelectedDate.Month.ToString()) + " " + RadScheduler1.SelectedDate.Year.ToString();
}