本文整理汇总了C#中Data.GetHours方法的典型用法代码示例。如果您正苦于以下问题:C# Data.GetHours方法的具体用法?C# Data.GetHours怎么用?C# Data.GetHours使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data.GetHours方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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() != "")
{
//.........这里部分代码省略.........
示例2: AddTime
protected void AddTime(object sender, EventArgs e)
{
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);
if (StartTimePicker.SelectedDate != null && EndTimePicker.SelectedDate != null)
{
//if (StartTimePicker.SelectedDate.Value < EndTimePicker.SelectedDate.Value)
//{
if (DaysOfWeekListBox.SelectedItem != null)
{
string days = "";
foreach (ListItem it in DaysOfWeekListBox.Items)
{
if (it.Selected)
days += it.Value + ";";
}
ListItem item = new ListItem(dat.GetHours(days).Replace("<br/>", "") + " - " + StartTimePicker.SelectedDate.Value.ToShortTimeString() +
" - " + EndTimePicker.SelectedDate.Value.ToShortTimeString(), days + " - " + StartTimePicker.SelectedDate.Value.ToShortTimeString() +
" - " + EndTimePicker.SelectedDate.Value.ToShortTimeString());
if (!TimeListBox.Items.Contains(item))
TimeListBox.Items.Add(item);
}
else
{
TimeErrorLabel.Text = "Please select all days of the week this time corresponds to.";
}
//}
//else
//{
// TimeErrorLabel.Text = "Start time must be less than the end time.";
//}
}
else
{
TimeErrorLabel.Text = "Please enter both the start time and the end time.";
}
}
示例3: DoHours
protected void DoHours(bool isEvent)
{
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", ":")));
DataView dv;
if (isEvent)
{
dv = dat.GetDataDV("SELECT * FROM VenueEvents WHERE VenueID=" + Request.QueryString["ID"]);
}
else
{
dv = dat.GetDataDV("SELECT * FROM VenueHours WHERE VenueID=" + Request.QueryString["ID"]);
HoursLabel.Text = "<h2>Hours</h2>";
}
char[] delim = { ';' };
string[] tokens;
int firstToken = 0;
int secondToken = 0;
int tokenCount = 0;
string hoursText = "";
string hoursTexts = "";
bool isDash = false;
bool allow = false;
if (dv.Count > 0)
{
foreach (DataRowView row in dv)
{
if (isEvent)
{
HoursLabel.Text += "<h2>" + row["EventName"].ToString() + "</h2>";
}
string starTime = TimeSpan.Parse(row["HourStart"].ToString()).Hours + ":" + TimeSpan.Parse(row["HourStart"].ToString()).Minutes.ToString();
if (starTime.Substring(starTime.Length - 2, 2) == ":0")
starTime = starTime.Replace(":0", ":00");
string endTime = TimeSpan.Parse(row["HourEnd"].ToString()).Hours + ":" + TimeSpan.Parse(row["HourEnd"].ToString()).Minutes.ToString();
if (endTime.Substring(endTime.Length - 2, 2) == ":0")
endTime = endTime.Replace(":0", ":00");
string ab = dat.GetHours(row["Days"].ToString());
if (isEvent)
{
HoursLabel.Text += ab.Substring(5, ab.Length - 5) + starTime +
" - " + endTime;
}
else
{
HoursLabel.Text += "<h2>" + ab.Substring(5, ab.Length - 5).Replace("<br/>",
"</h2>") + starTime + " - " + endTime;
}
}
}
}
示例4: AddEvent
protected void AddEvent(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", ":")));
string days = "";
bool gotSelected = false;
foreach (ListItem item2 in RegularDaysListBox.Items)
{
if (item2.Selected)
{
gotSelected = true;
days += item2.Value + ";";
}
}
RegularEventNameTextBox.Text = dat.stripHTML(RegularEventNameTextBox.Text.Trim());
if (gotSelected && RadTimePicker1.SelectedDate != null && RadTimePicker2.SelectedDate != null)
{
//if (RadTimePicker1.SelectedDate.Value < RadTimePicker2.SelectedDate.Value)
//{
string starTime = RadTimePicker1.SelectedDate.Value.TimeOfDay.Hours + ":" + RadTimePicker1.SelectedDate.Value.TimeOfDay.Minutes.ToString();
if (starTime.Substring(starTime.Length - 2, 2) == ":0")
starTime = starTime.Replace(":0", ":00");
string endTime = RadTimePicker2.SelectedDate.Value.TimeOfDay.Hours + ":" + RadTimePicker2.SelectedDate.Value.TimeOfDay.Minutes.ToString();
if (endTime.Substring(endTime.Length - 2, 2) == ":0")
endTime = endTime.Replace(":0", ":00");
ListItem item = new ListItem(RegularEventNameTextBox.Text + " -- " +
dat.GetHours(days).Replace("<br/>", "") + " -- " + starTime + " -- " + endTime,
RegularEventNameTextBox.Text + "---" + days + "---" + starTime + "---" + endTime);
if (!RegularEventsListbox.Items.Contains(item))
RegularEventsListbox.Items.Add(item);
//}
//else
//{
// EventsErrorLabel.Text = "The start time must be less than the end time.";
//}
}
else
{
EventsErrorLabel.Text = "Make sure you have chosen days, start time and end time.";
}
}
示例5: FillHoursAndEvents
protected void FillHoursAndEvents(string ID)
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
DataView dvHours = dat.GetDataDV("SELECT * FROM VenueHours WHERE VenueID=" + ID);
ListItem item;
foreach (DataRowView row in dvHours)
{
item = new ListItem(dat.GetHours(row["Days"].ToString()).Replace("<br/>", "") + " -- " + row["HourStart"].ToString() +
" -- " + row["HourEnd"].ToString(),
row["Days"].ToString() + "---" + row["HourStart"].ToString() +
"---" + row["HourEnd"].ToString());
HoursListBox.Items.Add(item);
}
DataView dvEvents = dat.GetDataDV("SELECT * FROM VenueEvents WHERE VenueID=" + ID);
foreach (DataRowView row in dvEvents)
{
item = new ListItem(row["EventName"].ToString() + " -- " + dat.GetHours(row["Days"].ToString()).Replace("<br/>", "") +
" -- " + row["HourStart"].ToString() + " -- " + row["HourEnd"].ToString(),
row["EventName"].ToString() + "---" + row["Days"].ToString() + "---" + row["HourStart"].ToString() +
"---" + row["HourEnd"].ToString());
RegularEventsListbox.Items.Add(item);
}
}
示例6: Page_Load
//.........这里部分代码省略.........
}
else
{
EditLink.Visible = false;
}
ASP.controls_contactad_ascx contact = new ASP.controls_contactad_ascx();
contact.THE_TEXT = "Contact Adventure Poster";
contact.RE_LABEL = "Re: " + dat.BreakUpString(dv[0]["Header"].ToString(), 14);
contact.TYPE = "ConnectTrip";
contact.ID = int.Parse(eventID);
ContactPanel.Controls.Add(contact);
PricePanel.Visible = false;
if (dv[0]["MaxPrice"] != null)
{
if (dv[0]["MaxPrice"].ToString() != "")
{
MinPrice.Text = dv[0]["MinPrice"].ToString().Replace(".00", "");
MaxPrice.Text = dv[0]["MaxPrice"].ToString().Replace(".00", "");
PricePanel.Visible = true;
}
}
DurationLabel.Text = "<b>Duration:</b> " + dat.GetDuration(dv[0]["Duration"].ToString());
char[] del = { ';' };
DataView daysToGo = dat.GetDataDV("SELECT * FROM TripDays WHERE TripID=" + eventID);
foreach (DataRowView row in daysToGo)
{
DaysLabel.Text += dat.GetHours(row["Days"].ToString()) + " " +
row["StartTime"].ToString() + " - " + row["EndTime"].ToString() + "<br/>";
}
DataView monthsToGo = dat.GetDataDV("SELECT * FROM TripMonths WHERE TripID=" + eventID);
foreach (DataRowView row in monthsToGo)
{
MonthsLabel.Text += dat.GetMonths(row["MonthStart"].ToString()) + ", " +
row["DayStart"].ToString() + " - " + dat.GetMonths(row["MonthEnd"].ToString()) +
", " + row["DayEnd"].ToString() + "<br/>";
}
ObtainLabel.Text = dv[0]["WhatObtain"].ToString();
DressLabel.Text = dv[0]["HowDress"].ToString();
foreach (ListItem item in MeansCheckList.Items)
{
if (dv[0]["Means"].ToString().Contains(item.Value))
{
item.Selected = true;
}
}
foreach (ListItem item in MeansCheckList2.Items)
{
if (dv[0]["Means"].ToString().Contains(item.Value))
{
item.Selected = true;
}
}