Hi,
I've created an custom recurrencedialog. When I want to add day to the DaysOfWeekMask it takes always "none". When I create a new recurrence order I can save it in the Database as string.
how can I add the days to the DaysOfWeeksMask?? The result of DaysOfWeekMask with the code above = "none"..
I've created an custom recurrencedialog. When I want to add day to the DaysOfWeekMask it takes always "none". When I create a new recurrence order I can save it in the Database as string.
private
void
LoadOrders()
{
OrderAppointments =
new
ObservableCollection<OrderAppointment>();
Context.Load(Context.GetOrdersQuery(),
lo =>
{
if
(lo.HasError)
{
throw
lo.Error;
}
Orders =
new
ObservableCollection<Order>(lo.Entities);
foreach
(Order order
in
Orders)
{
var newOrderAppointment =
new
OrderAppointment(order, Context);
var pattern =
new
RecurrencePattern();
pattern.Frequency = RecurrenceFrequency.Daily;
var recurrenceRule =
new
RecurrenceRule(pattern);
////Test
//pattern.DaysOfWeekMask = RecurrenceDays.Monday;
//var days = new RecurrenceDays();
//try
//{
// days.AddDay(RecurrenceDays.Monday);
//}
//catch (Exception)
//{
// throw;
//}
newOrderAppointment.RecurrenceRule = recurrenceRule;
if
(order.Start_Date !=
null
)
{
newOrderAppointment.Start = (DateTime) order.Start_Date;
}
if
(order.End_Date !=
null
)
{
newOrderAppointment.End = (DateTime) order.End_Date;
}
if
(order.DayOfMonth !=
null
)
{
newOrderAppointment.RecurrenceRule.Pattern.DayOfMonth = order.DayOfMonth;
}
if
(order.DayOrdinal !=
null
)
{
newOrderAppointment.RecurrenceRule.Pattern.DayOrdinal = order.DayOrdinal;
}
if
(order.DaysOfWeekMask !=
null
)
{
if
(order.DaysOfWeekMask.Contains(
"Monday"
))
{
newOrderAppointment.RecurrenceRule.Pattern.DaysOfWeekMask.AddDay(
RecurrenceDays.Monday);
}
if
(order.DaysOfWeekMask.Contains(
"Tuesday"
))
{
newOrderAppointment.RecurrenceRule.Pattern.DaysOfWeekMask.AddDay(
RecurrenceDays.Tuesday);
}
if
(order.DaysOfWeekMask.Contains(
"Wednesday"
))
{
newOrderAppointment.RecurrenceRule.Pattern.DaysOfWeekMask.AddDay(
RecurrenceDays.Wednesday);
}
if
(order.DaysOfWeekMask.Contains(
"Thursday"
))
{
newOrderAppointment.RecurrenceRule.Pattern.DaysOfWeekMask.AddDay(
RecurrenceDays.Thursday);
}
if
(order.DaysOfWeekMask.Contains(
"Friday"
))
{
newOrderAppointment.RecurrenceRule.Pattern.DaysOfWeekMask.AddDay(
RecurrenceDays.Friday);
}
}
how can I add the days to the DaysOfWeeksMask?? The result of DaysOfWeekMask with the code above = "none"..