【发布时间】:2017-12-25 17:16:19
【问题描述】:
目前我有以下
if ((int)dpRepeatType.SelectedValue == (int)Constants.RepeatType.Weekly)
{
wrule = new WeeklyRecurrenceRule(Convert.ToDateTime(dtDateStart.Value),WeekDays.Monday, 1);
_newAppointment.RecurrenceRule = wrule.ToString();
}
在屏幕上,我有 7 个复选框代表一周中的几天。周日到周六我的问题是 WeekDay 是 Telerik rad 调度程序的内部枚举,基于以下内容。
我的问题不是在单个复选框上使用 if 语句来查看用户选择的哪一天或哪一天可以多于一个,我目前如何使用 linq 执行此操作我正在使用 if 语句执行此操作但我相信有更好的方法。
[Flags]
public enum WeekDays
{
//
// Summary:
// Specifies none of the days
None = 0,
//
// Summary:
// Specifies the first day of the week
Sunday = 1,
//
// Summary:
// Specifies the second day of the week
Monday = 2,
//
// Summary:
// Specifies the third day of the week
Tuesday = 4,
//
// Summary:
// Specifies the fourth day of the week
Wednesday = 8,
//
// Summary:
// Specifies the fifth of the week
Thursday = 16,
//
// Summary:
// Specifies the sixth of the week
Friday = 32,
//
// Summary:
// Specifies the work days of the week
WorkDays = 62,
//
// Summary:
// Specifies the seventh of the week
Saturday = 64,
//
// Summary:
// Specifies the weekend days of the week
WeekendDays = 65,
//
// Summary:
// Specifies every day of the week
EveryDay = 127
}
}
这就是我想要实现的用户界面。
【问题讨论】:
标签: c# .net linq checkbox enums