end of day commit
This commit is contained in:
@@ -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" />
|
||||
@@ -255,6 +256,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>
|
||||
|
||||
82
CampusAppWP8/CampusAppWP8/Feed/Mensa/PriceFeed.cs
Normal file
82
CampusAppWP8/CampusAppWP8/Feed/Mensa/PriceFeed.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,12 +10,19 @@
|
||||
xmlns:header="clr-namespace:CampusAppWP8.Utility.Lui.Header"
|
||||
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 +51,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>
|
||||
|
||||
<TextBlock Text="{Binding MealId, Converter={StaticResource MealConverter}, ConverterParameter={Binding LocationID, ElementName=root}}" />
|
||||
</Grid>
|
||||
<toolkit:ContextMenuService.ContextMenu>
|
||||
<toolkit:ContextMenu>
|
||||
|
||||
@@ -48,6 +48,8 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
/// <summary> Flag for forcing webLoad. </summary>
|
||||
private bool forceLoad = false;
|
||||
|
||||
public int LocationID { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
@@ -56,6 +58,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;
|
||||
@@ -341,6 +345,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 +356,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 +367,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);
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
46
CampusAppWP8/CampusAppWP8/Utility/MealIdToPriceConverter.cs
Normal file
46
CampusAppWP8/CampusAppWP8/Utility/MealIdToPriceConverter.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
using System;
|
||||
using System.Windows.Data;
|
||||
using CampusAppWP8.Feed.Mensa;
|
||||
using CampusAppWPortalLib8.Model.GeoDb;
|
||||
|
||||
public sealed class MealIdToPriceConverter : IValueConverter
|
||||
{
|
||||
private PriceFeed priceFeed = null;
|
||||
|
||||
public MealIdToPriceConverter()
|
||||
{
|
||||
this.priceFeed = new PriceFeed();
|
||||
this.priceFeed.OnLoaded += this.PriceFeedIsReady;
|
||||
this.priceFeed.OnFailedLoad += this.PriceFeedIsFailed;
|
||||
this.priceFeed.LoadData();
|
||||
}
|
||||
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
if ((parameter is int) && (value is int))
|
||||
{
|
||||
retValue = this.priceFeed.Model.GetCanteen((int)value).GetPriceMealModel((int)parameter).PriceString();
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
private void PriceFeedIsReady()
|
||||
{
|
||||
}
|
||||
|
||||
private void PriceFeedIsFailed()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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" />
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
172
CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceMealModel.cs
Normal file
172
CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceMealModel.cs
Normal file
@@ -0,0 +1,172 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <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 string.Format("{0:0.00}", 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 string.Format("{0:00.0}", 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 string.Format("{0:00.0}", 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> Gets the price string. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
/// <returns> A string. </returns>
|
||||
public string PriceString()
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue = "S: " + this.PriceGuestStr + " A: " + this.PriceEmployeeStr + " G: " + this.PriceGuestStr;
|
||||
|
||||
return retValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
64
CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceModel.cs
Normal file
64
CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceModel.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <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("Canteens")]
|
||||
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>
|
||||
[XmlElement("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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user