Merge branch 'feature/#204' into develop

This commit is contained in:
Christian Fiedler
2013-11-14 18:19:32 +01:00
16 changed files with 835 additions and 14 deletions

View File

@@ -102,6 +102,7 @@
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Feed\Mensa\PriceFeed.cs" />
<Compile Include="File\Departments\DepartmentFavoriteFile.cs" />
<Compile Include="Const.cs" />
<Compile Include="Feed\Exams\ExamFeed.cs" />
@@ -248,6 +249,9 @@
<DependentUpon>WeekViewPivotHeader.xaml</DependentUpon>
</Compile>
<Compile Include="Utility\Lui\ListBoxFixed.cs" />
<Compile Include="Utility\Lui\MultiValueTextBlock.xaml.cs">
<DependentUpon>MultiValueTextBlock.xaml</DependentUpon>
</Compile>
<Compile Include="Utility\Lui\Templates\WeekView.xaml.cs">
<DependentUpon>WeekView.xaml</DependentUpon>
</Compile>
@@ -255,6 +259,7 @@
<DependentUpon>WeekViewDay.xaml</DependentUpon>
</Compile>
<Compile Include="Utility\Lui\Tiles\TileCreator.cs" />
<Compile Include="Utility\MealIdToPriceConverter.cs" />
<Compile Include="Utility\NDEF\BTUTagMessage.cs" />
<Compile Include="Pages\Dev\NFC.xaml.cs">
<DependentUpon>NFC.xaml</DependentUpon>
@@ -530,6 +535,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Utility\Lui\MultiValueTextBlock.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Utility\Lui\Templates\WeekView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

View File

@@ -0,0 +1,82 @@
//-----------------------------------------------------------------------
// <copyright file="PriceFeed.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Fiedler</author>
// <date>13.11.2013</date>
// <summary>Implements the price feed class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Feed.Mensa
{
using System;
using System.IO;
using CampusAppWP8.Model;
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Model.Mensa;
using CampusAppWPortalLib8.Model;
/// <summary> A price feed. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <seealso cref="T:CampusAppWP8.Model.XmlModel{CampusAppWPortalLib8.Model.Mensa.PriceModel}"/>
public class PriceFeed : XmlModel<PriceModel>
{
/// <summary> Initializes a new instance of the PriceFeed class. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
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);
}
/// <summary> Check is model up to date. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <param name="model"> The model. </param>
/// <returns> true if it succeeds, false if it fails. </returns>
private bool CheckIsModelUpToDate(PriceModel model)
{
bool retValue = true;
if (model == null)
{
retValue = false;
}
return retValue;
}
/// <summary> Check is file up to date. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <param name="model"> The model. </param>
/// <param name="fileInfo"> Information describing the file. </param>
/// <returns> true if it succeeds, false if it fails. </returns>
private bool CheckIsFileUpToDate(PriceModel model, FileInfo fileInfo)
{
if (fileInfo == null || !fileInfo.Exists || fileInfo.Length < 1)
{
return false;
}
return this.CheckIsUpToDate(fileInfo.LastWriteTime);
}
/// <summary> Check is up to date. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <param name="lastModified"> The last modified Date/Time. </param>
/// <returns> true if it succeeds, false if it fails. </returns>
private bool CheckIsUpToDate(DateTime lastModified)
{
bool retValue = false;
TimeSpan diff = DateTime.Now.Subtract(lastModified);
if (diff.TotalDays < 7)
{
retValue = true;
}
return retValue;
}
}
}

View File

@@ -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">
<page:PortraitLandscapePage.Resources>
<utility:MealIdToPriceConverter x:Key="MealConverter"/>
</page:PortraitLandscapePage.Resources>
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
@@ -44,18 +52,27 @@
<DataTemplate>
<Border Background="{x:Null}" BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel HorizontalAlignment="Left">
<StackPanel Orientation="Horizontal" Grid.Column="0" Margin="0,0,0,12" MinWidth="100">
<TextBlock Text="{Binding MealName}" FontWeight="Bold"/>
<TextBlock Text=" : "/>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel HorizontalAlignment="Left" Grid.Column="0">
<StackPanel Orientation="Horizontal" Margin="0,0,0,12" MinWidth="100">
<TextBlock Text="{Binding MealName}" FontWeight="Bold"/>
<TextBlock Text=" : "/>
</StackPanel>
<Image HorizontalAlignment="Left" Source="{Binding IconUrl}" Width="100" Margin="-12,-25,0,-21"></Image>
</StackPanel>
<Image HorizontalAlignment="Left" Source="{Binding IconUrl}" Width="100" Margin="-12,-25,0,-21"></Image>
</StackPanel>
<TextBlock Text="{Binding MealDesc}" TextWrapping="Wrap" Grid.Column="1"/>
<TextBlock Text="{Binding MealDesc}" TextWrapping="Wrap" Grid.Column="1"/>
</Grid>
<lu:MultiValueTextBlock Value1="{Binding MealId}" Value2="{Binding LocationID, ElementName=root, Mode=OneWay}" Converter="{StaticResource MealConverter}" Grid.Row="1" FontSize="14" HorizontalAlignment="Center" Margin="0,10,0,0"/>
</Grid>
<toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu>

View File

@@ -48,6 +48,9 @@ namespace CampusAppWP8.Pages.Mensa
/// <summary> Flag for forcing webLoad. </summary>
private bool forceLoad = false;
/// <summary> Identifier for the location. </summary>
public int locationID = -1;
#endregion
#region Constructor
@@ -56,6 +59,8 @@ namespace CampusAppWP8.Pages.Mensa
/// <remarks> Stubbfel, 15.10.2013. </remarks>
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
/// <summary> Gets or sets the identifier of the location. </summary>
/// <value> The identifier of the location. </value>
public int LocationID
{
get
{
return this.locationID;
}
set
{
this.locationID = value;
}
}
#region Method
#region protected
@@ -341,6 +361,7 @@ namespace CampusAppWP8.Pages.Mensa
/// <param name="e"> Event information. </param>
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
/// <param name="e"> Event information. </param>
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
/// <param name="e"> Event information. </param>
private void ApplicationBarMenuItem3_Click(object sender, EventArgs e)
{
this.LocationID = 2;
this.DefHeader.ProgressVisibility = Visibility.Visible;
this.InitializeFeed(CampusAppWPortalLib8.Model.Settings.Campus.SFB_MAIN);
}

View File

@@ -375,6 +375,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Angestellte ähnelt.
/// </summary>
public static string Employees {
get {
return ResourceManager.GetString("Employees", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Events ähnelt.
/// </summary>
@@ -420,6 +429,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Gäste ähnelt.
/// </summary>
public static string Guests {
get {
return ResourceManager.GetString("Guests", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Hinweis ähnelt.
/// </summary>
@@ -1266,6 +1284,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Studenten ähnelt.
/// </summary>
public static string Students {
get {
return ResourceManager.GetString("Students", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die vorlesen ähnelt.
/// </summary>

View File

@@ -596,4 +596,13 @@
<data name="Time_Day_Wednesday_Short" xml:space="preserve">
<value>Mi</value>
</data>
<data name="Employees" xml:space="preserve">
<value>Angestellte</value>
</data>
<data name="Guests" xml:space="preserve">
<value>Gäste</value>
</data>
<data name="Students" xml:space="preserve">
<value>Studenten</value>
</data>
</root>

View File

@@ -594,4 +594,10 @@
<data name="GeoWatch_CurrentPositionPoint" xml:space="preserve">
<value>CurrentPositionPoint</value>
</data>
<data name="FileMensaPrice" xml:space="preserve">
<value>mensaprice.xml</value>
</data>
<data name="UrlMensaPrice" xml:space="preserve">
<value>http://www.tu-cottbus.de/campusapp-data/canteens.php?v=1</value>
</data>
</root>

View File

@@ -375,6 +375,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die mensaprice.xml ähnelt.
/// </summary>
public static string FileMensaPrice {
get {
return ResourceManager.GetString("FileMensaPrice", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die NewsFeed.xml ähnelt.
/// </summary>
@@ -1356,6 +1365,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/canteens.php?v=1 ähnelt.
/// </summary>
public static string UrlMensaPrice {
get {
return ResourceManager.GetString("UrlMensaPrice", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/openinghours.php?v=2 ähnelt.
/// </summary>

View File

@@ -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();
}

View File

@@ -0,0 +1,18 @@
<UserControl x:Class="CampusAppWP8.Utility.Lui.MultiValueTextBlock"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
>
<!--
<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">
</Grid>
-->
<TextBlock x:Name="TheText"/>
</UserControl>

View File

@@ -0,0 +1,94 @@
//-----------------------------------------------------------------------
// <copyright file="MultiValueTextBlock.xaml.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Fiedler</author>
// <date>14.11.2013</date>
// <summary>Implements the multi value text block.xaml class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Utility.Lui
{
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
/// <summary> A multi value text block. </summary>
/// <remarks> Fiedler, 14.11.2013. </remarks>
/// <seealso cref="T:System.Windows.Controls.UserControl"/>
public partial class MultiValueTextBlock : UserControl
{
/// <summary> The value 1 property. </summary>
public static readonly DependencyProperty Value_1_Property = DependencyProperty.Register("Value1", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null, MultiValueTextBlock.OnLoaded));
/// <summary> The value 2 property. </summary>
public static readonly DependencyProperty Value_2_Property = DependencyProperty.Register("Value2", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null, MultiValueTextBlock.OnLoaded));
/// <summary> The converter property. </summary>
public static readonly DependencyProperty ConverterProperty = DependencyProperty.Register("Converter", typeof(IValueConverter), typeof(MultiValueTextBlock), new PropertyMetadata(null, MultiValueTextBlock.OnLoaded));
/// <summary> Initializes a new instance of the MultiValueTextBlock class. </summary>
/// <remarks> Fiedler, 14.11.2013. </remarks>
public MultiValueTextBlock() : base()
{
this.InitializeComponent();
}
/// <summary> Gets or sets the converter. </summary>
/// <value> The converter. </value>
public IValueConverter Converter
{
get
{
return (IValueConverter)this.GetValue(ConverterProperty);
}
set
{
this.SetValue(ConverterProperty, value);
}
}
/// <summary> Gets or sets the value 1. </summary>
/// <value> The value 1. </value>
public object Value1
{
get
{
return this.GetValue(Value_1_Property);
}
set
{
this.SetValue(Value_1_Property, value);
}
}
/// <summary> Gets or sets the value 2. </summary>
/// <value> The value 2. </value>
public object Value2
{
get
{
return this.GetValue(Value_2_Property);
}
set
{
this.SetValue(Value_2_Property, value);
}
}
/// <summary> Raises the dependency property changed event. </summary>
/// <remarks> Fiedler, 14.11.2013. </remarks>
/// <param name="d"> The DependencyObject to process. </param>
/// <param name="e"> Event information to send to registered event handlers. </param>
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);
}
}
}
}

View File

@@ -0,0 +1,96 @@
//-----------------------------------------------------------------------
// <copyright file="MealIdToPriceConverter.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Fiedler</author>
// <date>14.11.2013</date>
// <summary>Implements the meal identifier to price converter class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Utility
{
using System;
using System.Windows.Data;
using CampusAppWP8.Feed.Mensa;
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Model.Mensa;
/// <summary> A meal identifier to price converter. </summary>
/// <remarks> Fiedler, 14.11.2013. </remarks>
/// <seealso cref="T:System.Windows.Data.IValueConverter"/>
public sealed class MealIdToPriceConverter : IValueConverter
{
/// <summary> The price feed. </summary>
private PriceFeed priceFeed = null;
/// <summary> Initializes a new instance of the MealIdToPriceConverter class. </summary>
/// <remarks> Fiedler, 14.11.2013. </remarks>
public MealIdToPriceConverter()
{
this.priceFeed = new PriceFeed();
this.priceFeed.OnLoaded += this.PriceFeedIsReady;
this.priceFeed.OnFailedLoad += this.PriceFeedIsFailed;
this.priceFeed.LoadData();
}
/// <summary>
/// Ändert die Quelldaten vor der Übergabe an das Ziel zur Anzeige in der Benutzeroberfläche.
/// </summary>
/// <remarks> Fiedler, 14.11.2013. </remarks>
/// <seealso cref="M:System.Windows.Data.IValueConverter.Convert(object,Type,object,System.Globalization.CultureInfo)"/>
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;
}
/// <summary>
/// Ändert die Zieldaten vor der Übergabe an das Quellobjekt. Diese Methode wird nur in
/// <see cref="F:System.Windows.Data.BindingMode.TwoWay" />-Bindungen aufgerufen.
/// </summary>
/// <remarks> Fiedler, 14.11.2013. </remarks>
/// <seealso cref="M:System.Windows.Data.IValueConverter.ConvertBack(object,Type,object,System.Globalization.CultureInfo)"/>
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
{
return null;
}
/// <summary> Price feed is ready. </summary>
/// <remarks> Fiedler, 14.11.2013. </remarks>
private void PriceFeedIsReady()
{
}
/// <summary> Price feed is failed. </summary>
/// <remarks> Fiedler, 14.11.2013. </remarks>
private void PriceFeedIsFailed()
{
}
}
}

View File

@@ -62,6 +62,9 @@
<Compile Include="Model\Mensa\MealModel.cs" />
<Compile Include="Model\Mensa\MenuModel.cs" />
<Compile Include="Model\Mensa\MenuWeekModel.cs" />
<Compile Include="Model\Mensa\PriceCanteenModel.cs" />
<Compile Include="Model\Mensa\PriceMealModel.cs" />
<Compile Include="Model\Mensa\PriceModel.cs" />
<Compile Include="Model\ModelTypes.cs" />
<Compile Include="Model\Openinghours\OpenhoursDayModel.cs" />
<Compile Include="Model\Openinghours\OpeninghoursInstitutionModel.cs" />

View File

@@ -0,0 +1,185 @@
//-----------------------------------------------------------------------
// <copyright file="PriceCanteenModel.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Fiedler</author>
// <date>13.11.2013</date>
// <summary>Implements the price canteen model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Model.Mensa
{
using System.Collections.ObjectModel;
using System.Xml.Serialization;
using CampusAppWPortalLib8.Model.Utility;
/// <summary> A data Model for the price canteen. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
public class PriceCanteenModel
{
/// <summary> The identifier. </summary>
private int id = -1;
/// <summary> The name de. </summary>
private string name_de = string.Empty;
/// <summary> URL of the name. </summary>
private string name_url = string.Empty;
/// <summary> The position. </summary>
private MapPoint pos = null;
/// <summary> List of prices. </summary>
private ObservableCollection<PriceMealModel> priceList = null;
/// <summary> Initializes a new instance of the PriceCanteenModel class. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
public PriceCanteenModel()
{
this.pos = new MapPoint(-1, -1);
this.priceList = new ObservableCollection<PriceMealModel>();
}
/// <summary> Gets or sets the identifier. </summary>
/// <value> The identifier. </value>
[XmlAttribute("id")]
public string IdStr
{
get
{
return string.Empty + this.id;
}
set
{
this.id = int.Parse(value);
}
}
/// <summary> Gets or sets the identifier. </summary>
/// <value> The identifier. </value>
[XmlIgnore]
public int Id
{
get
{
return this.id;
}
set
{
this.id = value;
}
}
/// <summary> Gets or sets the name. </summary>
/// <value> The name. </value>
[XmlAttribute("name_de")]
public string Name
{
get
{
return this.name_de;
}
set
{
this.name_de = value;
}
}
/// <summary> Gets or sets URL of the document. </summary>
/// <value> The URL. </value>
[XmlAttribute("name_url")]
public string Url
{
get
{
return this.name_url;
}
set
{
this.name_url = value;
}
}
/// <summary> Gets or sets the x coordinate. </summary>
/// <value> The x coordinate. </value>
[XmlAttribute("x")]
public string X
{
get
{
return string.Empty + this.pos.X;
}
set
{
this.pos.X = double.Parse(value);
}
}
/// <summary> Gets or sets the y coordinate. </summary>
/// <value> The y coordinate. </value>
[XmlAttribute("y")]
public string Y
{
get
{
return string.Empty + this.pos.Y;
}
set
{
this.pos.Y = double.Parse(value);
}
}
/// <summary> Gets or sets the position. </summary>
/// <value> The position. </value>
[XmlIgnore]
public MapPoint Position
{
get
{
return this.pos;
}
set
{
this.pos = value;
}
}
/// <summary> Gets or sets the prices. </summary>
/// <value> The prices. </value>
[XmlElement("price")]
public ObservableCollection<PriceMealModel> Prices
{
get
{
return this.priceList;
}
set
{
this.priceList = value;
}
}
/// <summary> Gets price meal model. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <param name="meal_id"> Identifier for the meal. </param>
/// <returns> The price meal model. </returns>
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;
}
}
}

View File

@@ -0,0 +1,169 @@
//-----------------------------------------------------------------------
// <copyright file="PriceMealModel.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Fiedler</author>
// <date>13.11.2013</date>
// <summary>Implements the price meal model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Model.Mensa
{
using System.Xml.Serialization;
/// <summary> A data Model for the price meal. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
public class PriceMealModel
{
/// <summary> Identifier for the meal. </summary>
private int meal_id = -1;
/// <summary> The price student. </summary>
private double priceStudent = 0;
/// <summary> The price employee. </summary>
private double priceEmployee = 0;
/// <summary> The price guest. </summary>
private double priceGuest = 0;
/// <summary> Initializes a new instance of the PriceMealModel class. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
public PriceMealModel()
{
}
/// <summary> Gets or sets the identifier of the meal. </summary>
/// <value> The identifier of the meal. </value>
[XmlAttribute("meal_id")]
public string MealIDStr
{
get
{
return string.Empty + this.meal_id;
}
set
{
this.meal_id = int.Parse(value);
}
}
/// <summary> Gets or sets the identifier of the meal. </summary>
/// <value> The identifier of the meal. </value>
[XmlIgnore]
public int MealID
{
get
{
return this.meal_id;
}
set
{
this.meal_id = value;
}
}
/// <summary> Gets or sets the price student. </summary>
/// <value> The price student. </value>
[XmlAttribute("s")]
public string PriceStudentStr
{
get
{
return this.CurrencyString(this.priceStudent);
}
set
{
this.priceStudent = double.Parse(value);
}
}
/// <summary> Gets or sets the price student. </summary>
/// <value> The price student. </value>
[XmlIgnore]
public double PriceStudent
{
get
{
return this.priceStudent;
}
set
{
this.priceStudent = value;
}
}
/// <summary> Gets or sets the price employee. </summary>
/// <value> The price employee. </value>
[XmlAttribute("e")]
public string PriceEmployeeStr
{
get
{
return this.CurrencyString(this.priceEmployee);
}
set
{
this.priceEmployee = double.Parse(value);
}
}
/// <summary> Gets or sets the price employee. </summary>
/// <value> The price employee. </value>
[XmlIgnore]
public double PriceEmployee
{
get
{
return this.priceEmployee;
}
set
{
this.priceEmployee = value;
}
}
/// <summary> Gets or sets the price guest. </summary>
/// <value> The price guest. </value>
[XmlAttribute("g")]
public string PriceGuestStr
{
get
{
return this.CurrencyString(this.priceGuest);
}
set
{
this.priceGuest = double.Parse(value);
}
}
/// <summary> Gets or sets the price guest. </summary>
/// <value> The price guest. </value>
[XmlIgnore]
public double PriceGuest
{
get
{
return this.priceGuest;
}
set
{
this.priceGuest = value;
}
}
/// <summary> Currency string. </summary>
/// <remarks> Fiedler, 14.11.2013. </remarks>
/// <param name="val"> The value. </param>
/// <returns> A string. </returns>
private string CurrencyString(double val)
{
return string.Format("{0:0.00}", val);
}
}
}

View File

@@ -0,0 +1,65 @@
//-----------------------------------------------------------------------
// <copyright file="PriceModel.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Fiedler</author>
// <date>13.11.2013</date>
// <summary>Implements the price model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Model.Mensa
{
using System.Collections.ObjectModel;
using System.Xml.Serialization;
/// <summary> A data Model for the price. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
[XmlRoot("root")]
public class PriceModel
{
/// <summary> The canteens. </summary>
private ObservableCollection<PriceCanteenModel> canteens = null;
/// <summary> Initializes a new instance of the PriceModel class. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
public PriceModel()
{
this.canteens = new ObservableCollection<PriceCanteenModel>();
}
/// <summary> Gets or sets the canteens. </summary>
/// <value> The canteens. </value>
[XmlArray("Canteens")]
[XmlArrayItem("Canteen")]
public ObservableCollection<PriceCanteenModel> Canteens
{
get
{
return this.canteens;
}
set
{
this.canteens = value;
}
}
/// <summary> Gets a canteen. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <param name="id"> The identifier. </param>
/// <returns> The canteen. </returns>
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;
}
}
}