add personmodel

This commit is contained in:
stubbfel
2013-09-04 15:04:21 +02:00
parent 8534b1e4c8
commit 0e66d01395
5 changed files with 151 additions and 0 deletions

View File

@@ -118,6 +118,8 @@
<Compile Include="Model\GeoDb\PlaceService.cs" />
<Compile Include="Model\GeoDb\SpsModel.cs" />
<Compile Include="Model\Mensa\MealModel.cs" />
<Compile Include="Model\Person\PersonFunctionModel.cs" />
<Compile Include="Model\Person\PersonModel.cs" />
<Compile Include="Model\Setting\AppSettings.cs" />
<Compile Include="Model\Setting\UserProfilModel.cs" />
<Compile Include="Model\Utility\CourseListPickerItemListModel.cs" />

View File

@@ -0,0 +1,97 @@
using CampusAppWP8.Resources;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
namespace CampusAppWP8.Model.Person
{
public class PersonFunctionModel
{
private string tel1;
private string tel2;
private string fax;
[XmlAttribute("telefon")]
public string Tel1
{
get
{
return this.tel1;
}
set
{
if (value != null && value != this.tel1)
{
this.tel1 = this.CreateUniTelefonNumber(value);
}
}
}
[XmlAttribute("telefon2")]
public string Tel2
{
get
{
return this.tel2;
}
set
{
if (value != null && value != this.tel2)
{
this.tel2 = this.CreateUniTelefonNumber(value);
}
}
}
[XmlAttribute("fax")]
public string Fax
{
get
{
return this.fax;
}
set
{
if (value != null && value != this.fax)
{
this.fax = this.CreateUniTelefonNumber(value);
}
}
}
[XmlAttribute("funktion")]
public string Function { get; set; }
[XmlAttribute("einrichtung")]
public string Appointment { get; set; }
[XmlAttribute("gebaeude")]
public string Building { get; set; }
[XmlAttribute("mail")]
public string Mail { get; set; }
private string CreateUniTelefonNumber (string input)
{
string result = null;
if (input.Length < 5)
{
result = Constants.UniCBTelPrefix + input.TrimStart('0');
}
else
{
result = input;
}
Regex regexObj = new Regex(@"[^\d]");
result = regexObj.Replace(this.tel1.TrimStart('0'), "");
result = Constants.DeTelPrefix + result;
return result;
}
}
}

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace CampusAppWP8.Model.Person
{
public class PersonModel
{
[XmlAttribute("id")]
public string ID {get; set;}
[XmlAttribute("akadgrad")]
public string Akadgrad { get; set; }
[XmlAttribute("nachname")]
public string SureName { get; set; }
[XmlAttribute("vorname")]
public string FirstName { get; set; }
[XmlElement("funktion")]
public ObservableCollection<PersonFunctionModel> Function { get; set; }
}
}

View File

@@ -132,6 +132,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die +49 ähnelt.
/// </summary>
public static string DeTelPrefix {
get {
return ResourceManager.GetString("DeTelPrefix", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die ExamsPage.LastPivotIndex ähnelt.
/// </summary>
@@ -843,6 +852,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die 035569 ähnelt.
/// </summary>
public static string UniCBTelPrefix {
get {
return ResourceManager.GetString("UniCBTelPrefix", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/professorships.xml ähnelt.
/// </summary>

View File

@@ -453,4 +453,10 @@
<data name="PathPerson_Person" xml:space="preserve">
<value>/Pages/Person/PersonPage.xaml</value>
</data>
<data name="DeTelPrefix" xml:space="preserve">
<value>+49</value>
</data>
<data name="UniCBTelPrefix" xml:space="preserve">
<value>035569</value>
</data>
</root>