本文整理汇总了C#中DayOfWeek.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# DayOfWeek.ToString方法的具体用法?C# DayOfWeek.ToString怎么用?C# DayOfWeek.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DayOfWeek
的用法示例。
在下文中一共展示了DayOfWeek.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public void Init()
{
_mockFactory = new MockRepository(MockBehavior.Strict);
_cacherFactory = _mockFactory.Create<ICacherFactory>();
_cacher = _mockFactory.Create<ICacher<FieldInfo>>();
_e = DayOfWeek.Friday;
_eName = _e.ToString();
_f = typeof (DayOfWeek).GetField(_eName);
}
示例2: DayElement
internal DayElement(GanttView view, DayOfWeek dayOfWeek, bool isHoliday)
: base(view, ElementName)
{
_dayOfWeek = dayOfWeek;
_isHoliday = isHoliday;
AddAttribute(DayOfWeekName, dayOfWeek.ToString());
AddAttribute(HolidayName, isHoliday.ToString(CultureInfo.InvariantCulture));
}
示例3: HasFutureBookings
public bool HasFutureBookings(Staff staff, System.Web.UI.HtmlControls.HtmlInputCheckBox chkBox, DayOfWeek dayOfWeek)
{
if (chkBox.Checked)
return false;
Booking[] bookings = BookingDB.GetFutureBookings(staff, null, dayOfWeek.ToString(), new TimeSpan(0, 0, 0), new TimeSpan(23, 59, 59));
if (bookings.Length == 0)
return false;
string space = " ";
string bookingDates = string.Empty;
for (int i = 0; i < bookings.Length; i++)
bookingDates += "<br />" + space + bookings[i].DateStart.ToString(@"ddd MMM d, yyy HH:mm");
lblErrorMessage.Text = "Can not select " + dayOfWeek.ToString() + " as not working until the bookings on the following days have been moved or deleted:" + "<br />" + bookingDates + "<br />";
lblErrorMessage.Visible = true;
return true;
}
示例4: DiaIngParaPort
public static string DiaIngParaPort(DayOfWeek dayOfWeek)
{
var dia = "Segunda";
switch (dayOfWeek.ToString())
{
case "Monday": dia = "Segunda"; break;
case "Tuesday": dia = "Terça"; break;
case "Wednesday": dia = "Quarta"; break;
case "Thursday": dia = "Quinta"; break;
case "Friday": dia = "Sexta"; break;
}
return dia;
}
示例5: getWeekCHA
public static int getWeekCHA(DayOfWeek dw)
{
string key = dw.ToString();
if (key != null)
{
int num2;
if (f__switch_map5A == null)
{
Dictionary<string, int> dictionary = new Dictionary<string, int>(7);
dictionary.Add("Monday", 0);
dictionary.Add("Tuesday", 1);
dictionary.Add("Wednesday", 2);
dictionary.Add("Thursday", 3);
dictionary.Add("Friday", 4);
dictionary.Add("Saturday", 5);
dictionary.Add("Sunday", 6);
f__switch_map5A = dictionary;
}
if (f__switch_map5A.TryGetValue(key, out num2))
{
switch (num2)
{
case 0:
return 1;
case 1:
return 2;
case 2:
return 3;
case 3:
return 4;
case 4:
return 5;
case 5:
return 6;
case 6:
return 7;
}
}
}
return 1;
}
示例6: AvailableForTranscoding
public bool AvailableForTranscoding(string serverKey, DayOfWeek dayOfWeek, int hour)
{
using (var db = new MediaManagerDataContext())
{
var server = db.Servers.FirstOrDefault(a => a.Key == new Guid(serverKey) && a.IsActive);
if (server != null)
{
// override hold on transcoding, or currently executing remote job
if (server.HoldTranscoding || server.CurrentlyTranscoding) return false;
return server.TranscodingSchedules.Any(a => a.DayOfWeek == dayOfWeek.ToString() && a.Start <= hour && a.End > hour);
}
}
return false;
}
示例7: SetScheduleForDayOfWeek
public static XDocument SetScheduleForDayOfWeek(DayOfWeek dayOfWeek)
{
XDocument dayScheduleRequest = GetEntireScheduling(true);
XElement weekDayPowerScheduleList = null;
XElement weekDayPowerSchedule = null;
switch (dayOfWeek)
{
case DayOfWeek.Sunday:
weekDayPowerScheduleList = new XElement("Device.System.Power.Schedule.0.List");
weekDayPowerSchedule = new XElement("Device.System.Power.Schedule.0");
break;
case DayOfWeek.Monday:
weekDayPowerScheduleList = new XElement("Device.System.Power.Schedule.1.List");
weekDayPowerSchedule = new XElement("Device.System.Power.Schedule.1");
break;
case DayOfWeek.Tuesday:
weekDayPowerScheduleList = new XElement("Device.System.Power.Schedule.2.List");
weekDayPowerSchedule = new XElement("Device.System.Power.Schedule.2");
break;
case DayOfWeek.Wednesday:
weekDayPowerScheduleList = new XElement("Device.System.Power.Schedule.3.List");
weekDayPowerSchedule = new XElement("Device.System.Power.Schedule.3");
break;
case DayOfWeek.Thursday:
weekDayPowerScheduleList = new XElement("Device.System.Power.Schedule.4.List");
weekDayPowerSchedule = new XElement("Device.System.Power.Schedule.4");
break;
case DayOfWeek.Friday:
weekDayPowerScheduleList = new XElement("Device.System.Power.Schedule.5.List");
weekDayPowerSchedule = new XElement("Device.System.Power.Schedule.5");
break;
case DayOfWeek.Saturday:
weekDayPowerScheduleList = new XElement("Device.System.Power.Schedule.6.List");
weekDayPowerSchedule = new XElement("Device.System.Power.Schedule.6");
break;
default:
throw new Exception(string.Format(@"Not supported parameter value: ""{0}"" forSetScheduleForDayOfWeek(DayOfWeek dayOfWeek)",
dayOfWeek.ToString()));
}
dayScheduleRequest.Descendants("SCHEDULE").First().Add(weekDayPowerSchedule);
dayScheduleRequest.Descendants("SCHEDULE").First().AddFirst(weekDayPowerScheduleList);
return dayScheduleRequest;
}
示例8: GetDayValue
/// <summary>
/// Gets the day value.
/// </summary>
/// <param name="day"></param>
/// <returns></returns>
public int GetDayValue(DayOfWeek day)
{
var abbr = day.ToString().Substring(0,2).ToLower();
return _dayValues[abbr];
}
示例9: DayOfWeekMatches
private static bool DayOfWeekMatches(DayOfWeek dayOfWeek, string weekRelativeDay)
{
if (dayOfWeek.ToString().Equals(weekRelativeDay, StringComparison.InvariantCultureIgnoreCase))
{
return true;
}
switch (dayOfWeek)
{
case DayOfWeek.Monday:
case DayOfWeek.Tuesday:
case DayOfWeek.Wednesday:
case DayOfWeek.Thursday:
case DayOfWeek.Friday:
if (weekRelativeDay.Equals("weekday", StringComparison.InvariantCultureIgnoreCase))
{
return true;
}
break;
case DayOfWeek.Saturday:
case DayOfWeek.Sunday:
if (weekRelativeDay.Equals("weekend", StringComparison.InvariantCultureIgnoreCase))
{
return true;
}
break;
}
return false;
}
示例10: ConvertToScheduleDays
private static ScheduleDays ConvertToScheduleDays(DayOfWeek day)
{
return (ScheduleDays)Enum.Parse(typeof(ScheduleDays), day.ToString());
}
示例11: TestEnum
public string TestEnum(DayOfWeek week)
{
return week.ToString();
}
示例12: GetDayName
/// <summary>
/// Obtiene el nombre del día
/// </summary>
/// <param name="dayOfWeek">El día de la semana</param>
/// <returns>El nombre del día</returns>
private string GetDayName(DayOfWeek dayOfWeek)
{
string dayName = string.Empty;
switch (dayOfWeek.ToString())
{
case "Sunday":
dayName = "Domingo";
break;
case "Monday":
dayName = "Lunes";
break;
case "Tuesday":
dayName = "Martes";
break;
case "Wednesday":
dayName = "Miércoles";
break;
case "Thrusday":
dayName = "Jueves";
break;
case "Friday":
dayName = "Viernes";
break;
case "Saturday":
dayName = "Sábado";
break;
}
return dayName;
}
示例13: ParseDay
/// <summary>
/// Converts a comma separated list of times
/// </summary>
/// <param name="day"></param>
/// <returns></returns>
protected virtual IEnumerable<TimeSpan> ParseDay(DayOfWeek day)
{
return ParseDay(day.ToString());
}
示例14: dayToInt
private int dayToInt(DayOfWeek day)
{
switch (day.ToString())
{
case "Monday":
return 0;
case "Tuesday":
return 1;
case "Wednesday":
return 2;
case "Thursday":
return 3;
case "Friday":
return 4;
case "Saturday":
return 5;
case "Sunday":
return 6;
default:
return 0;
}
}
示例15: WeekString
private string WeekString(DayOfWeek week)
{
if (Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToLower() == "zh")
{
string result = "星期一";
switch (week)
{
case DayOfWeek.Monday:
result = "星期一";
break;
case DayOfWeek.Tuesday:
result = "星期二";
break;
case DayOfWeek.Wednesday:
result = "星期三";
break;
case DayOfWeek.Thursday:
result = "星期四";
break;
case DayOfWeek.Friday:
result = "星期五";
break;
case DayOfWeek.Saturday:
result = "星期六";
break;
case DayOfWeek.Sunday:
result = "星期天";
break;
}
return result;
}
return week.ToString();
}