diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
index c4b29600..698e02d7 100644
--- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
+++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
@@ -102,6 +102,7 @@
App.xaml
+
@@ -248,6 +249,9 @@
WeekViewPivotHeader.xaml
+
+ MultiValueTextBlock.xaml
+
WeekView.xaml
@@ -255,6 +259,7 @@
WeekViewDay.xaml
+
NFC.xaml
@@ -530,6 +535,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/CampusAppWP8/CampusAppWP8/Feed/Mensa/PriceFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Mensa/PriceFeed.cs
new file mode 100644
index 00000000..a5380621
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Feed/Mensa/PriceFeed.cs
@@ -0,0 +1,82 @@
+//-----------------------------------------------------------------------
+//
+// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
+//
+// Fiedler
+// 13.11.2013
+// Implements the price feed class
+//-----------------------------------------------------------------------
+namespace CampusAppWP8.Feed.Mensa
+{
+ using System;
+ using System.IO;
+ using CampusAppWP8.Model;
+ using CampusAppWP8.Resources;
+ using CampusAppWPortalLib8.Model.Mensa;
+ using CampusAppWPortalLib8.Model;
+
+ /// A price feed.
+ /// Fiedler, 13.11.2013.
+ ///
+ public class PriceFeed : XmlModel
+ {
+ /// Initializes a new instance of the PriceFeed class.
+ /// Fiedler, 13.11.2013.
+ public PriceFeed()
+ : base(ModelType.FileAndFeed, Constants.FileMensaPrice, Constants.UrlMensaPrice)
+ {
+ this.IsFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate);
+ this.IsModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
+ this.IsFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate);
+ }
+
+ /// Check is model up to date.
+ /// Fiedler, 13.11.2013.
+ /// The model.
+ /// true if it succeeds, false if it fails.
+ private bool CheckIsModelUpToDate(PriceModel model)
+ {
+ bool retValue = true;
+
+ if (model == null)
+ {
+ retValue = false;
+ }
+
+ return retValue;
+ }
+
+ /// Check is file up to date.
+ /// Fiedler, 13.11.2013.
+ /// The model.
+ /// Information describing the file.
+ /// true if it succeeds, false if it fails.
+ private bool CheckIsFileUpToDate(PriceModel model, FileInfo fileInfo)
+ {
+ if (fileInfo == null || !fileInfo.Exists || fileInfo.Length < 1)
+ {
+ return false;
+ }
+
+ return this.CheckIsUpToDate(fileInfo.LastWriteTime);
+ }
+
+ /// Check is up to date.
+ /// Fiedler, 13.11.2013.
+ /// The last modified Date/Time.
+ /// true if it succeeds, false if it fails.
+ private bool CheckIsUpToDate(DateTime lastModified)
+ {
+ bool retValue = false;
+ TimeSpan diff = DateTime.Now.Subtract(lastModified);
+
+
+ if (diff.TotalDays < 7)
+ {
+ retValue = true;
+ }
+
+ return retValue;
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml
index 6377d8db..3b83b591 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml
+++ b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml
@@ -8,14 +8,22 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button"
xmlns:header="clr-namespace:CampusAppWP8.Utility.Lui.Header"
+ xmlns:lu="clr-namespace:CampusAppWP8.Utility.Lui"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
xmlns:page="clr-namespace:CampusAppWP8.Utility.Lui.Page"
+ xmlns:utility="clr-namespace:CampusAppWP8.Utility"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
- shell:SystemTray.IsVisible="True">
+ shell:SystemTray.IsVisible="True"
+ x:Name="root">
+
+
+
+
+
@@ -44,18 +52,27 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs
index 376a77a4..8952c549 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs
@@ -48,6 +48,9 @@ namespace CampusAppWP8.Pages.Mensa
/// Flag for forcing webLoad.
private bool forceLoad = false;
+ /// Identifier for the location.
+ public int locationID = -1;
+
#endregion
#region Constructor
@@ -56,6 +59,8 @@ namespace CampusAppWP8.Pages.Mensa
/// Stubbfel, 15.10.2013.
public MensaPage()
{
+ this.locationID = 0;
+
this.InitializeComponent();
ApplicationBarMenuItem menuItem1 = ApplicationBar.MenuItems[0] as ApplicationBarMenuItem;
ApplicationBarMenuItem menuItem2 = ApplicationBar.MenuItems[1] as ApplicationBarMenuItem;
@@ -81,6 +86,21 @@ namespace CampusAppWP8.Pages.Mensa
#endregion
+ /// Gets or sets the identifier of the location.
+ /// The identifier of the location.
+ public int LocationID
+ {
+ get
+ {
+ return this.locationID;
+ }
+
+ set
+ {
+ this.locationID = value;
+ }
+ }
+
#region Method
#region protected
@@ -341,6 +361,7 @@ namespace CampusAppWP8.Pages.Mensa
/// Event information.
private void ApplicationBarMenuItem_Click(object sender, EventArgs e)
{
+ this.LocationID = 0;
this.DefHeader.ProgressVisibility = Visibility.Visible;
this.InitializeFeed(CampusAppWPortalLib8.Model.Settings.Campus.CB_MAIN);
}
@@ -351,6 +372,7 @@ namespace CampusAppWP8.Pages.Mensa
/// Event information.
private void ApplicationBarMenuItem2_Click(object sender, EventArgs e)
{
+ this.LocationID = 1;
this.DefHeader.ProgressVisibility = Visibility.Visible;
this.InitializeFeed(CampusAppWPortalLib8.Model.Settings.Campus.CB_SOUTH);
}
@@ -361,6 +383,7 @@ namespace CampusAppWP8.Pages.Mensa
/// Event information.
private void ApplicationBarMenuItem3_Click(object sender, EventArgs e)
{
+ this.LocationID = 2;
this.DefHeader.ProgressVisibility = Visibility.Visible;
this.InitializeFeed(CampusAppWPortalLib8.Model.Settings.Campus.SFB_MAIN);
}
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
index dffe834c..5ab45237 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
@@ -375,6 +375,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Angestellte ähnelt.
+ ///
+ public static string Employees {
+ get {
+ return ResourceManager.GetString("Employees", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Events ähnelt.
///
@@ -420,6 +429,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Gäste ähnelt.
+ ///
+ public static string Guests {
+ get {
+ return ResourceManager.GetString("Guests", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Hinweis ähnelt.
///
@@ -1266,6 +1284,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Studenten ähnelt.
+ ///
+ public static string Students {
+ get {
+ return ResourceManager.GetString("Students", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die vorlesen ähnelt.
///
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
index 90588cd5..9297b6cd 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
@@ -596,4 +596,13 @@
Mi
+
+ Angestellte
+
+
+ Gäste
+
+
+ Studenten
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
index 74dd8ca7..4470f195 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
@@ -594,4 +594,10 @@
CurrentPositionPoint
+
+ mensaprice.xml
+
+
+ http://www.tu-cottbus.de/campusapp-data/canteens.php?v=1
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs
index f290ade3..372a03ba 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs
@@ -375,6 +375,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die mensaprice.xml ähnelt.
+ ///
+ public static string FileMensaPrice {
+ get {
+ return ResourceManager.GetString("FileMensaPrice", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die NewsFeed.xml ähnelt.
///
@@ -1356,6 +1365,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/canteens.php?v=1 ähnelt.
+ ///
+ public static string UrlMensaPrice {
+ get {
+ return ResourceManager.GetString("UrlMensaPrice", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/openinghours.php?v=2 ähnelt.
///
diff --git a/CampusAppWP8/CampusAppWP8/Utility/IdToPlaceConverter.cs b/CampusAppWP8/CampusAppWP8/Utility/IdToPlaceConverter.cs
index 4c57f4e7..07a8dd99 100644
--- a/CampusAppWP8/CampusAppWP8/Utility/IdToPlaceConverter.cs
+++ b/CampusAppWP8/CampusAppWP8/Utility/IdToPlaceConverter.cs
@@ -26,8 +26,8 @@ namespace CampusAppWP8.Utility
public IdToPlaceConverter()
{
this.placeFile = new PlacesFile();
- this.placeFile.OnLoaded += new PlacesFile.OnIO(this.PlaceFileIsReady);
- this.placeFile.OnFailedLoad += new PlacesFile.OnFailed(this.PlaceFileIsFailed);
+ this.placeFile.OnLoaded += this.PlaceFileIsReady;
+ this.placeFile.OnFailedLoad += this.PlaceFileIsFailed;
this.placeFile.LoadData();
}
diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml b/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml
new file mode 100644
index 00000000..747b8420
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml
@@ -0,0 +1,18 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml.cs
new file mode 100644
index 00000000..4d050d77
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml.cs
@@ -0,0 +1,94 @@
+//-----------------------------------------------------------------------
+//
+// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
+//
+// Fiedler
+// 14.11.2013
+// Implements the multi value text block.xaml class
+//-----------------------------------------------------------------------
+namespace CampusAppWP8.Utility.Lui
+{
+ using System.Windows;
+ using System.Windows.Controls;
+ using System.Windows.Data;
+
+ /// A multi value text block.
+ /// Fiedler, 14.11.2013.
+ ///
+ public partial class MultiValueTextBlock : UserControl
+ {
+ /// The value 1 property.
+ public static readonly DependencyProperty Value_1_Property = DependencyProperty.Register("Value1", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null, MultiValueTextBlock.OnLoaded));
+ /// The value 2 property.
+ public static readonly DependencyProperty Value_2_Property = DependencyProperty.Register("Value2", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null, MultiValueTextBlock.OnLoaded));
+
+ /// The converter property.
+ public static readonly DependencyProperty ConverterProperty = DependencyProperty.Register("Converter", typeof(IValueConverter), typeof(MultiValueTextBlock), new PropertyMetadata(null, MultiValueTextBlock.OnLoaded));
+
+ /// Initializes a new instance of the MultiValueTextBlock class.
+ /// Fiedler, 14.11.2013.
+ public MultiValueTextBlock() : base()
+ {
+ this.InitializeComponent();
+ }
+
+ /// Gets or sets the converter.
+ /// The converter.
+ public IValueConverter Converter
+ {
+ get
+ {
+ return (IValueConverter)this.GetValue(ConverterProperty);
+ }
+
+ set
+ {
+ this.SetValue(ConverterProperty, value);
+ }
+ }
+
+ /// Gets or sets the value 1.
+ /// The value 1.
+ public object Value1
+ {
+ get
+ {
+ return this.GetValue(Value_1_Property);
+ }
+
+ set
+ {
+ this.SetValue(Value_1_Property, value);
+ }
+ }
+
+ /// Gets or sets the value 2.
+ /// The value 2.
+ public object Value2
+ {
+ get
+ {
+ return this.GetValue(Value_2_Property);
+ }
+
+ set
+ {
+ this.SetValue(Value_2_Property, value);
+ }
+ }
+
+ /// Raises the dependency property changed event.
+ /// Fiedler, 14.11.2013.
+ /// The DependencyObject to process.
+ /// Event information to send to registered event handlers.
+ private static void OnLoaded(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ MultiValueTextBlock obj = d as MultiValueTextBlock;
+
+ if ((obj.Value1 != null) && (obj.Value2 != null) && (obj.Converter != null))
+ {
+ obj.TheText.Text = (string)obj.Converter.Convert(obj.Value1, typeof(string), obj.Value2, System.Globalization.CultureInfo.CurrentCulture);
+ }
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/Utility/MealIdToPriceConverter.cs b/CampusAppWP8/CampusAppWP8/Utility/MealIdToPriceConverter.cs
new file mode 100644
index 00000000..dad09bf1
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Utility/MealIdToPriceConverter.cs
@@ -0,0 +1,96 @@
+//-----------------------------------------------------------------------
+//
+// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
+//
+// Fiedler
+// 14.11.2013
+// Implements the meal identifier to price converter class
+//-----------------------------------------------------------------------
+namespace CampusAppWP8.Utility
+{
+ using System;
+ using System.Windows.Data;
+ using CampusAppWP8.Feed.Mensa;
+ using CampusAppWP8.Resources;
+ using CampusAppWPortalLib8.Model.Mensa;
+
+ /// A meal identifier to price converter.
+ /// Fiedler, 14.11.2013.
+ ///
+ public sealed class MealIdToPriceConverter : IValueConverter
+ {
+ /// The price feed.
+ private PriceFeed priceFeed = null;
+
+ /// Initializes a new instance of the MealIdToPriceConverter class.
+ /// Fiedler, 14.11.2013.
+ public MealIdToPriceConverter()
+ {
+ this.priceFeed = new PriceFeed();
+ this.priceFeed.OnLoaded += this.PriceFeedIsReady;
+ this.priceFeed.OnFailedLoad += this.PriceFeedIsFailed;
+ this.priceFeed.LoadData();
+ }
+
+ ///
+ /// Ändert die Quelldaten vor der Übergabe an das Ziel zur Anzeige in der Benutzeroberfläche.
+ ///
+ /// Fiedler, 14.11.2013.
+ ///
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
+ {
+ string retValue = string.Empty;
+ int intVal = -1;
+ int intParam = -1;
+
+ if (value is int)
+ {
+ intVal = (int)value;
+ }
+ else if(value is string)
+ {
+ intVal = int.Parse((string)value);
+ }
+
+ if (parameter is int)
+ {
+ intParam = (int)parameter;
+ }
+ else if (parameter is string)
+ {
+ intParam = int.Parse((string)parameter);
+ }
+
+ if ((intVal >= 0) && (intParam >= 0))
+ {
+ PriceMealModel model = this.priceFeed.Model.GetCanteen(intParam).GetPriceMealModel(intVal);
+ retValue = AppResources.Students + ": " + model.PriceStudentStr + " € " + AppResources.Employees + ": " + model.PriceEmployeeStr + " € " + AppResources.Guests + ": " + model.PriceGuestStr + " €";
+ }
+
+ return retValue;
+ }
+
+ ///
+ /// Ändert die Zieldaten vor der Übergabe an das Quellobjekt. Diese Methode wird nur in
+ /// -Bindungen aufgerufen.
+ ///
+ /// Fiedler, 14.11.2013.
+ ///
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
+ {
+ return null;
+ }
+
+ /// Price feed is ready.
+ /// Fiedler, 14.11.2013.
+ private void PriceFeedIsReady()
+ {
+ }
+
+ /// Price feed is failed.
+ /// Fiedler, 14.11.2013.
+ private void PriceFeedIsFailed()
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj b/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj
index 4826570b..addae01f 100644
--- a/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj
+++ b/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj
@@ -62,6 +62,9 @@
+
+
+
diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceCanteenModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceCanteenModel.cs
new file mode 100644
index 00000000..26d6c5c3
--- /dev/null
+++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceCanteenModel.cs
@@ -0,0 +1,185 @@
+//-----------------------------------------------------------------------
+//
+// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
+//
+// Fiedler
+// 13.11.2013
+// Implements the price canteen model class
+//-----------------------------------------------------------------------
+namespace CampusAppWPortalLib8.Model.Mensa
+{
+ using System.Collections.ObjectModel;
+ using System.Xml.Serialization;
+ using CampusAppWPortalLib8.Model.Utility;
+
+ /// A data Model for the price canteen.
+ /// Fiedler, 13.11.2013.
+ public class PriceCanteenModel
+ {
+ /// The identifier.
+ private int id = -1;
+ /// The name de.
+ private string name_de = string.Empty;
+ /// URL of the name.
+ private string name_url = string.Empty;
+ /// The position.
+ private MapPoint pos = null;
+ /// List of prices.
+ private ObservableCollection priceList = null;
+
+ /// Initializes a new instance of the PriceCanteenModel class.
+ /// Fiedler, 13.11.2013.
+ public PriceCanteenModel()
+ {
+ this.pos = new MapPoint(-1, -1);
+ this.priceList = new ObservableCollection();
+ }
+
+ /// Gets or sets the identifier.
+ /// The identifier.
+ [XmlAttribute("id")]
+ public string IdStr
+ {
+ get
+ {
+ return string.Empty + this.id;
+ }
+
+ set
+ {
+ this.id = int.Parse(value);
+ }
+ }
+
+ /// Gets or sets the identifier.
+ /// The identifier.
+ [XmlIgnore]
+ public int Id
+ {
+ get
+ {
+ return this.id;
+ }
+
+ set
+ {
+ this.id = value;
+ }
+ }
+
+ /// Gets or sets the name.
+ /// The name.
+ [XmlAttribute("name_de")]
+ public string Name
+ {
+ get
+ {
+ return this.name_de;
+ }
+
+ set
+ {
+ this.name_de = value;
+ }
+ }
+
+ /// Gets or sets URL of the document.
+ /// The URL.
+ [XmlAttribute("name_url")]
+ public string Url
+ {
+ get
+ {
+ return this.name_url;
+ }
+
+ set
+ {
+ this.name_url = value;
+ }
+ }
+
+ /// Gets or sets the x coordinate.
+ /// The x coordinate.
+ [XmlAttribute("x")]
+ public string X
+ {
+ get
+ {
+ return string.Empty + this.pos.X;
+ }
+
+ set
+ {
+ this.pos.X = double.Parse(value);
+ }
+ }
+
+ /// Gets or sets the y coordinate.
+ /// The y coordinate.
+ [XmlAttribute("y")]
+ public string Y
+ {
+ get
+ {
+ return string.Empty + this.pos.Y;
+ }
+
+ set
+ {
+ this.pos.Y = double.Parse(value);
+ }
+ }
+
+ /// Gets or sets the position.
+ /// The position.
+ [XmlIgnore]
+ public MapPoint Position
+ {
+ get
+ {
+ return this.pos;
+ }
+
+ set
+ {
+ this.pos = value;
+ }
+ }
+
+ /// Gets or sets the prices.
+ /// The prices.
+ [XmlElement("price")]
+ public ObservableCollection Prices
+ {
+ get
+ {
+ return this.priceList;
+ }
+
+ set
+ {
+ this.priceList = value;
+ }
+ }
+
+ /// Gets price meal model.
+ /// Fiedler, 13.11.2013.
+ /// Identifier for the meal.
+ /// The price meal model.
+ public PriceMealModel GetPriceMealModel(int meal_id)
+ {
+ PriceMealModel retValue = null;
+
+ for (int i = 0; i < this.priceList.Count; i++)
+ {
+ if (this.priceList[i].MealID.Equals(meal_id))
+ {
+ retValue = this.priceList[i];
+ }
+ }
+
+ return retValue;
+ }
+ }
+}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceMealModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceMealModel.cs
new file mode 100644
index 00000000..460322f6
--- /dev/null
+++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceMealModel.cs
@@ -0,0 +1,169 @@
+//-----------------------------------------------------------------------
+//
+// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
+//
+// Fiedler
+// 13.11.2013
+// Implements the price meal model class
+//-----------------------------------------------------------------------
+namespace CampusAppWPortalLib8.Model.Mensa
+{
+ using System.Xml.Serialization;
+
+ /// A data Model for the price meal.
+ /// Fiedler, 13.11.2013.
+ public class PriceMealModel
+ {
+ /// Identifier for the meal.
+ private int meal_id = -1;
+ /// The price student.
+ private double priceStudent = 0;
+ /// The price employee.
+ private double priceEmployee = 0;
+ /// The price guest.
+ private double priceGuest = 0;
+
+ /// Initializes a new instance of the PriceMealModel class.
+ /// Fiedler, 13.11.2013.
+ public PriceMealModel()
+ {
+ }
+
+ /// Gets or sets the identifier of the meal.
+ /// The identifier of the meal.
+ [XmlAttribute("meal_id")]
+ public string MealIDStr
+ {
+ get
+ {
+ return string.Empty + this.meal_id;
+ }
+
+ set
+ {
+ this.meal_id = int.Parse(value);
+ }
+ }
+
+ /// Gets or sets the identifier of the meal.
+ /// The identifier of the meal.
+ [XmlIgnore]
+ public int MealID
+ {
+ get
+ {
+ return this.meal_id;
+ }
+
+ set
+ {
+ this.meal_id = value;
+ }
+ }
+
+ /// Gets or sets the price student.
+ /// The price student.
+ [XmlAttribute("s")]
+ public string PriceStudentStr
+ {
+ get
+ {
+ return this.CurrencyString(this.priceStudent);
+ }
+
+ set
+ {
+ this.priceStudent = double.Parse(value);
+ }
+ }
+
+ /// Gets or sets the price student.
+ /// The price student.
+ [XmlIgnore]
+ public double PriceStudent
+ {
+ get
+ {
+ return this.priceStudent;
+ }
+
+ set
+ {
+ this.priceStudent = value;
+ }
+ }
+
+ /// Gets or sets the price employee.
+ /// The price employee.
+ [XmlAttribute("e")]
+ public string PriceEmployeeStr
+ {
+ get
+ {
+ return this.CurrencyString(this.priceEmployee);
+ }
+
+ set
+ {
+ this.priceEmployee = double.Parse(value);
+ }
+ }
+
+ /// Gets or sets the price employee.
+ /// The price employee.
+ [XmlIgnore]
+ public double PriceEmployee
+ {
+ get
+ {
+ return this.priceEmployee;
+ }
+
+ set
+ {
+ this.priceEmployee = value;
+ }
+ }
+
+ /// Gets or sets the price guest.
+ /// The price guest.
+ [XmlAttribute("g")]
+ public string PriceGuestStr
+ {
+ get
+ {
+ return this.CurrencyString(this.priceGuest);
+ }
+
+ set
+ {
+ this.priceGuest = double.Parse(value);
+ }
+ }
+
+ /// Gets or sets the price guest.
+ /// The price guest.
+ [XmlIgnore]
+ public double PriceGuest
+ {
+ get
+ {
+ return this.priceGuest;
+ }
+
+ set
+ {
+ this.priceGuest = value;
+ }
+ }
+
+ /// Currency string.
+ /// Fiedler, 14.11.2013.
+ /// The value.
+ /// A string.
+ private string CurrencyString(double val)
+ {
+ return string.Format("{0:0.00}", val);
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceModel.cs
new file mode 100644
index 00000000..3a62b506
--- /dev/null
+++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceModel.cs
@@ -0,0 +1,65 @@
+//-----------------------------------------------------------------------
+//
+// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
+//
+// Fiedler
+// 13.11.2013
+// Implements the price model class
+//-----------------------------------------------------------------------
+namespace CampusAppWPortalLib8.Model.Mensa
+{
+ using System.Collections.ObjectModel;
+ using System.Xml.Serialization;
+
+ /// A data Model for the price.
+ /// Fiedler, 13.11.2013.
+ [XmlRoot("root")]
+ public class PriceModel
+ {
+ /// The canteens.
+ private ObservableCollection canteens = null;
+
+ /// Initializes a new instance of the PriceModel class.
+ /// Fiedler, 13.11.2013.
+ public PriceModel()
+ {
+ this.canteens = new ObservableCollection();
+ }
+
+ /// Gets or sets the canteens.
+ /// The canteens.
+ [XmlArray("Canteens")]
+ [XmlArrayItem("Canteen")]
+ public ObservableCollection Canteens
+ {
+ get
+ {
+ return this.canteens;
+ }
+
+ set
+ {
+ this.canteens = value;
+ }
+ }
+
+ /// Gets a canteen.
+ /// Fiedler, 13.11.2013.
+ /// The identifier.
+ /// The canteen.
+ public PriceCanteenModel GetCanteen(int id)
+ {
+ PriceCanteenModel retValue = null;
+
+ for (int i = 0; i < this.canteens.Count; i++)
+ {
+ if (this.canteens[i].Id.Equals(id))
+ {
+ retValue = this.canteens[i];
+ }
+ }
+
+ return retValue;
+ }
+ }
+}
\ No newline at end of file