//-----------------------------------------------------------------------
//
// Company copyright tag.
//
// stubbfel
// 03.05.2013
//----------------------------------------------------------------------
namespace CampusAppWP8ScheduledTaskAgent.Model.Mensa
{
using CampusAppWP8ScheduledTaskAgent.Utility;
using System;
using System.Collections.ObjectModel;
using System.Xml.Serialization;
///
/// Model for menus in one week
///
[XmlRoot("root")]
public class MenuWeekModel
{
#region Members
///
/// Time when the model was created
///
private readonly DateTime createTime;
#endregion
#region Constructor
///
/// Initializes a new instance of the class.
///
public MenuWeekModel()
{
this.createTime = DateTime.Now;
}
#endregion
#region Proberty
///
/// Gets or sets the menus for the week
///
[XmlArray("Mealplan")]
[XmlArrayItem("Menu")]
public ObservableCollection Menus { get; set; }
///
/// Gets the creation time of the model
///
public DateTime CreateTime
{
get
{
return this.createTime;
}
}
#endregion
#region Methods
///
/// Method calculate this day of the week, which its gets new menus
///
/// Date of NewMenuWeekDay
public static DateTime CalcFirstWeekDay()
{
DateTime now = DateTime.Now;
while (now.DayOfWeek != DayOfWeek.Monday)
{
now = now.Subtract(new TimeSpan(1, 0, 0, 0));
}
DateTime monday = new DateTime(now.Year, now.Month, now.Day);
return monday;
}
#endregion
}
}