From 20b1f6f748de534dde11e7b2e698a32dcf580361 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Tue, 3 Sep 2013 15:06:08 +0200 Subject: [PATCH 1/5] add perosnicon --- .../Assets/Icons/DarkTheme/person_159.png | Bin 0 -> 1181 bytes .../Assets/Icons/LightTheme/person_159.png | Bin 0 -> 1105 bytes CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 2 ++ CampusAppWP8/CampusAppWP8/Resources/Icons.cs | 11 +++++++++++ CampusAppWP8/CampusAppWP8/Resources/Icons.resx | 3 +++ 5 files changed, 16 insertions(+) create mode 100644 CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/person_159.png create mode 100644 CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/person_159.png diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/person_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/person_159.png new file mode 100644 index 0000000000000000000000000000000000000000..c2163d6f8967287f3b054d42f2ca88f30df71517 GIT binary patch literal 1181 zcmeAS@N?(olHy`uVBq!ia0y~yV3-fW9Bd2>49}&xA22X5uqAoByDD8+EM^Yt(Hz5j9P6YoTIbZWBjK zhfG4@9{;mJ^x|kXjn|?4X2!0vKbu+H2 zVcV)+{tCGrOTGxO#s-48J^IGs4CT}3E#6?f>HF`zt*d(YcL-T*{vr^(;M#lnfcGD? zz4;e>%j(Uqe93qvZtcfRP6Ip9EaK3HBRU zcg(tH*tVV7y3zhruj$`E?6ubR46~IVIoyBF&-~l?bL4~E2fsS~!x+EUoSn;HrYm&M zUg=Tw1HK2lJAFe1A7|&~yVMwF1iJiTvaxHdT$NmNcCX!`TeSyr!ke$0`Z3Frv&QJn zqYewkJvZ-Klp5_zd#3bgyabty`yuuCb#l$wT$#eZrgMD)4IgLcUG8|D|1PDgOESLrd)l*A ziDGHbSP%5do)4CNoc%86!P7G`&zNTWKaAh~Ke6U*4%{IblnRLzIyz}t=ki4 zUZ3~u=iD9Fqo;h_YR-IT^9|vdm39TEU6!xx_}F`VWnaY1h2={&izU{)t!3D=>4vbN zA^V$oFHA%Y_g(zU@`mXhyIya{ZKX#yR*JbFIeeh%f#L(x2irS+A{oy=l(@J3i=NXy zb)|nYPg?~GIV@P-oI5l1fY}4VgcaX8r)zz$Ib12a!$v7i%5+bi;Kyng8|EB_d-A7C zrW)-#$j20Y+wHo(QXShnrf0`?-kl|JKjF91qZD!JzK+EQcE{%IW;hzh?nLA~F$lNfT z#;N@@TKDko#D|V)=a}M|?lbJaWWDf(MZuH!*XLQoF6<7zq?I7MH+s{$nRiZHKKow22WQ%mvv4FO#o!kEd2lg literal 0 HcmV?d00001 diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/person_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/person_159.png new file mode 100644 index 0000000000000000000000000000000000000000..c9bd664bc6526d32f45985cf6639cd9709ca11a8 GIT binary patch literal 1105 zcmeAS@N?(olHy`uVBq!ia0y~yV3-fW9Bd2>49}&xA22X5uqAoByDtyL;UMVZtr*B@*ztqwh`YkOs5!cacI+;HXIcEN{@l6m%+qz> z&D?FDR)6N)yE)Z-9+Ol&38PJO#bgth%ow&a^D|9nELML0pHYta9=jfkSi|Oa9*e~G zhVq8(i<-~u$~|!WK+y4zKR*4qo7|K8bjSV=JGsq&XJwsn4~+a9@g+Iz2r;*t){3$M=eXPEz~DPfqJy|qSq zG4qO;)lV;5CHxdQ_DQqnX|TlU#~dTtn1>HpO-!O%vpavxZl@y-sY8$wd40qJ`nd{v*|Gz);#7q z8I{0fo%nsM4`v%4`^#n%Xz4v!Cw`xKb&oBB%sSB}q0{uw??15I_Sk%ud+Vkwjhv=` zUhu*DdHp|ExJ{TAxzFafvE1joM}kexeR_IwXXDD3w`H<7)Ks2ZUO)5PTEQi$)AY}~ z1u_2KP@}99zwfT?@%UI(*TXvT`}W!%zaIi&RyXJ-_w8lau`p?xTI9Z(bVhySdrY&> zKZxJ`Kl$gWJFGTW4WDUUTD4Lt@#iU9?wHNTe*XQjYP-_u@I1a9)l-XaH_mSFz9e?q zTypi8x|Nq``nzH7fx`!+ z56Ew2UbU{H+MFo}cFWu(4?|Pk^cKZ4HyLs^w z|M`Ev-m?C;b^-g#+J`=yYVPt)Sa$Y$flS5vOIw%Ed-{6Y=1*Vs*Vp`Anfi0rU2dCz zhr6U3mN!Og#q8#sw*I!v2dS6OKD2unhj_hFcsu)>>C44CXFjbHd%QdEXTz7yW7`jW zKk$CZ_dNB6b}V6wIyob;R6R>2psea$mgBuxFyQYgWKfXCVfzP z-C3j0q(9Lt=-nohPg_g7*EBCRJ9hIx%B@(RTV1cB9-I+9r_XeL^0k|@+2=8D;}gw0 sB + @@ -437,6 +438,7 @@ + diff --git a/CampusAppWP8/CampusAppWP8/Resources/Icons.cs b/CampusAppWP8/CampusAppWP8/Resources/Icons.cs index d381d0e4..b52d7047 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Icons.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Icons.cs @@ -242,6 +242,17 @@ namespace CampusAppWP8.Resources } } + /// + /// Gets the uri string of the Person icon. + /// + public static string Person + { + get + { + return Themerize("person_159.png"); + } + } + /// /// Gets the uri string of the Phone icon. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/Icons.resx b/CampusAppWP8/CampusAppWP8/Resources/Icons.resx index 4a349994..1cdc52f7 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Icons.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Icons.resx @@ -177,6 +177,9 @@ openhours_159.png + + person_159.png + phone_159.png From 8534b1e4c87ec123a317fcc037d7a7117052673c Mon Sep 17 00:00:00 2001 From: stubbfel Date: Tue, 3 Sep 2013 15:36:24 +0200 Subject: [PATCH 2/5] add personpage --- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 7 ++ .../Pages/Campusmap/CampusMapPage.xaml | 2 +- .../CampusAppWP8/Pages/Exams/Exams.xaml | 2 +- .../CampusAppWP8/Pages/Person/PersonPage.xaml | 67 +++++++++++++++++++ .../Pages/Person/PersonPage.xaml.cs | 20 ++++++ .../CampusAppWP8/Pages/StartPage.xaml | 7 ++ .../Resources/AppResources.Designer.cs | 18 +++++ .../CampusAppWP8/Resources/AppResources.resx | 6 ++ .../Resources/Constants.Designer.cs | 9 +++ .../CampusAppWP8/Resources/Constants.resx | 3 + 10 files changed, 139 insertions(+), 2 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml create mode 100644 CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index fa45f967..d7e97cf6 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -127,6 +127,9 @@ Exams.xaml + + PersonPage.xaml + @@ -351,6 +354,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml index cf91d39f..bc93963e 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml @@ -51,7 +51,7 @@ --> - + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs new file mode 100644 index 00000000..42f82e7f --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Navigation; +using Microsoft.Phone.Controls; +using Microsoft.Phone.Shell; + +namespace CampusAppWP8.Pages.Person +{ + public partial class PersonPage : PhoneApplicationPage + { + public PersonPage() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml index 99e5cc03..4ec8dd6e 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml @@ -174,6 +174,13 @@ + + + + + + + diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs index 86a670dd..9cb9bff8 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs @@ -699,6 +699,24 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Personensuche ähnelt. + /// + public static string PersonApp_Header { + get { + return ResourceManager.GetString("PersonApp_Header", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Personen ähnelt. + /// + public static string PersonApp_Title { + get { + return ResourceManager.GetString("PersonApp_Title", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Die primäre Kamera steht nicht zur Verfügung. ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx index 43dcd186..72626477 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx @@ -425,4 +425,10 @@ Prüfungsordnungen + + Personensuche + + + Personen + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs index ca04fe9e..f6c8c704 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs @@ -735,6 +735,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Person/PersonPage.xaml ähnelt. + /// + public static string PathPerson_Person { + get { + return ResourceManager.GetString("PathPerson_Person", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Setting/AppSettingPage.xaml ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index 827f5f98..963649e2 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -450,4 +450,7 @@ ExamsPage.LastPivotIndex + + /Pages/Person/PersonPage.xaml + \ No newline at end of file From 0e66d013956fc18f1ac5aaeb9d2c83bf1166f486 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Wed, 4 Sep 2013 15:04:21 +0200 Subject: [PATCH 3/5] add personmodel --- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 2 + .../Model/Person/PersonFunctionModel.cs | 97 +++++++++++++++++++ .../CampusAppWP8/Model/Person/PersonModel.cs | 28 ++++++ .../Resources/Constants.Designer.cs | 18 ++++ .../CampusAppWP8/Resources/Constants.resx | 6 ++ 5 files changed, 151 insertions(+) create mode 100644 CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs create mode 100644 CampusAppWP8/CampusAppWP8/Model/Person/PersonModel.cs diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index d7e97cf6..d3a8f03c 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -118,6 +118,8 @@ + + diff --git a/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs b/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs new file mode 100644 index 00000000..79c19cb0 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs @@ -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; + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Person/PersonModel.cs b/CampusAppWP8/CampusAppWP8/Model/Person/PersonModel.cs new file mode 100644 index 00000000..e5cc4d8d --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Person/PersonModel.cs @@ -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 Function { get; set; } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs index f6c8c704..d4c18d60 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs @@ -132,6 +132,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die +49 ähnelt. + /// + public static string DeTelPrefix { + get { + return ResourceManager.GetString("DeTelPrefix", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die ExamsPage.LastPivotIndex ähnelt. /// @@ -843,6 +852,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die 035569 ähnelt. + /// + public static string UniCBTelPrefix { + get { + return ResourceManager.GetString("UniCBTelPrefix", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/professorships.xml ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index 963649e2..ef787291 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -453,4 +453,10 @@ /Pages/Person/PersonPage.xaml + + +49 + + + 035569 + \ No newline at end of file From 0505181710895e7c1af556d96082f0f74cecae65 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Wed, 4 Sep 2013 15:26:35 +0200 Subject: [PATCH 4/5] add vaild method to stringmanager --- .../Model/Person/PersonFunctionModel.cs | 32 +++++++------- .../CampusAppWP8/Utility/StringManager.cs | 44 +++++++++++++++++++ 2 files changed, 60 insertions(+), 16 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs b/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs index 79c19cb0..6e558548 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs @@ -1,4 +1,5 @@ using CampusAppWP8.Resources; +using CampusAppWP8.Utility; using System; using System.Collections.Generic; using System.Linq; @@ -16,6 +17,8 @@ namespace CampusAppWP8.Model.Person private string fax; + private string mail; + [XmlAttribute("telefon")] public string Tel1 { @@ -27,7 +30,7 @@ namespace CampusAppWP8.Model.Person { if (value != null && value != this.tel1) { - this.tel1 = this.CreateUniTelefonNumber(value); + this.tel1 = StringManager.CreateUniTelefonNumber(value); } } } @@ -43,7 +46,7 @@ namespace CampusAppWP8.Model.Person { if (value != null && value != this.tel2) { - this.tel2 = this.CreateUniTelefonNumber(value); + this.tel2 = StringManager.CreateUniTelefonNumber(value); } } } @@ -59,7 +62,7 @@ namespace CampusAppWP8.Model.Person { if (value != null && value != this.fax) { - this.fax = this.CreateUniTelefonNumber(value); + this.fax = StringManager.CreateUniTelefonNumber(value); } } } @@ -74,24 +77,21 @@ namespace CampusAppWP8.Model.Person public string Building { get; set; } [XmlAttribute("mail")] - public string Mail { get; set; } - - private string CreateUniTelefonNumber (string input) + public string Mail { - string result = null; - if (input.Length < 5) + get { - result = Constants.UniCBTelPrefix + input.TrimStart('0'); + return this.mail; } - else + set { - result = input; + if (value != null && value != this.mail && StringManager.IsValidEmail(value)) + { + this.mail = value; + } } - - Regex regexObj = new Regex(@"[^\d]"); - result = regexObj.Replace(this.tel1.TrimStart('0'), ""); - result = Constants.DeTelPrefix + result; - return result; } + + } } diff --git a/CampusAppWP8/CampusAppWP8/Utility/StringManager.cs b/CampusAppWP8/CampusAppWP8/Utility/StringManager.cs index 2181dd89..4c8b93d9 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/StringManager.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/StringManager.cs @@ -7,6 +7,8 @@ //---------------------------------------------------------------------- namespace CampusAppWP8.Utility { + using CampusAppWP8.Resources; + using System; using System.Text.RegularExpressions; /// @@ -55,6 +57,48 @@ namespace CampusAppWP8.Utility { return str.TrimEnd('\n'); } + + /// Query if 'strIn' is valid email. + /// Stubbfel, 04.09.2013. + /// The in. + /// true if valid email, false if not. + public static bool IsValidEmail(string strIn) + { + // Return true if strIn is in valid e-mail format. + try + { + return Regex.IsMatch(strIn, + @"^(?("")(""[^""]+?""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))" + + @"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9]{2,17}))$", + RegexOptions.IgnoreCase); + } + catch (Exception) + { + return false; + } + } + + /// Creates uni telefon number. + /// Stubbfel, 04.09.2013. + /// The input. + /// The new uni telefon number. + public static 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(result.TrimStart('0'), ""); + result = Constants.DeTelPrefix + result; + return result; + } #endregion } } From a2ea0a10ad719ff13e9141f308b2cf818f2ada90 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Thu, 5 Sep 2013 10:52:38 +0200 Subject: [PATCH 5/5] add dll project --- CampusAppWP8/CampusAppDLL/CampusAppDLL.csproj | 64 ++++++ .../Model/Campusmap/CBMainMapModel.cs | 45 +++++ .../CampusAppDLL/Model/Campusmap/MapModel.cs | 48 +++++ .../Model/GeoDb/PlaceInformation.cs | 26 +++ .../CampusAppDLL/Model/GeoDb/PlaceModel.cs | 47 +++++ .../CampusAppDLL/Model/GeoDb/PlaceService.cs | 32 +++ .../CampusAppDLL/Model/GeoDb/SpsModel.cs | 87 ++++++++ .../CampusAppDLL/Properties/AssemblyInfo.cs | 36 ++++ CampusAppWP8/CampusAppDLL/Utility/Logger.cs | 35 ++++ .../CampusAppDLL/Utility/NDEF/NDEFMessage.cs | 154 ++++++++++++++ .../CampusAppDLL/Utility/NDEF/NDEFRecord.cs | 188 ++++++++++++++++++ .../Utility/NDEF/NDEFShortRecord.cs | 63 ++++++ .../CampusAppDLL/Utility/StringManager.cs | 59 ++++++ .../CampusAppDLL/Utility/XmlManager.cs | 88 ++++++++ CampusAppWP8/CampusAppW8.sln | 56 ++++++ .../CampusAppWPortalLib8.csproj | 6 + .../Model/Campusmap/CBMainMapModel.cs | 45 +++++ .../Model/Campusmap/MapModel.cs | 48 +++++ .../Model/GeoDb/PlaceInformation.cs | 26 +++ .../Model/GeoDb/PlaceModel.cs | 47 +++++ .../Model/GeoDb/PlaceService.cs | 32 +++ .../Model/GeoDb/SpsModel.cs | 87 ++++++++ 22 files changed, 1319 insertions(+) create mode 100644 CampusAppWP8/CampusAppDLL/CampusAppDLL.csproj create mode 100644 CampusAppWP8/CampusAppDLL/Model/Campusmap/CBMainMapModel.cs create mode 100644 CampusAppWP8/CampusAppDLL/Model/Campusmap/MapModel.cs create mode 100644 CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceInformation.cs create mode 100644 CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceModel.cs create mode 100644 CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceService.cs create mode 100644 CampusAppWP8/CampusAppDLL/Model/GeoDb/SpsModel.cs create mode 100644 CampusAppWP8/CampusAppDLL/Properties/AssemblyInfo.cs create mode 100644 CampusAppWP8/CampusAppDLL/Utility/Logger.cs create mode 100644 CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFMessage.cs create mode 100644 CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFRecord.cs create mode 100644 CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFShortRecord.cs create mode 100644 CampusAppWP8/CampusAppDLL/Utility/StringManager.cs create mode 100644 CampusAppWP8/CampusAppDLL/Utility/XmlManager.cs create mode 100644 CampusAppWP8/CampusAppWPortalLib8/Model/Campusmap/CBMainMapModel.cs create mode 100644 CampusAppWP8/CampusAppWPortalLib8/Model/Campusmap/MapModel.cs create mode 100644 CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceInformation.cs create mode 100644 CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceModel.cs create mode 100644 CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceService.cs create mode 100644 CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/SpsModel.cs diff --git a/CampusAppWP8/CampusAppDLL/CampusAppDLL.csproj b/CampusAppWP8/CampusAppDLL/CampusAppDLL.csproj new file mode 100644 index 00000000..ac3271f3 --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/CampusAppDLL.csproj @@ -0,0 +1,64 @@ + + + + + Debug + AnyCPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303} + Library + Properties + CampusAppDLL + CampusAppDLL + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppDLL/Model/Campusmap/CBMainMapModel.cs b/CampusAppWP8/CampusAppDLL/Model/Campusmap/CBMainMapModel.cs new file mode 100644 index 00000000..9f6684a4 --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Model/Campusmap/CBMainMapModel.cs @@ -0,0 +1,45 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 13.08.2013 +//----------------------------------------------------------------------------- +using CampusAppDLL.Model.GeoDb; +using CampusAppDLL.Utility; + +namespace CampusAppDLL.Model.Campusmap +{ + + /// + /// Class for the MapModel of the mainCampus of cottbus + /// + public class CBMainMapModel : MapModel + { + /// Variable for the identify of the campus. + private static readonly string Campus = "1"; + + /// + /// Initializes a new instance of the class. + /// + public CBMainMapModel(string xmlFilePath) : base(xmlFilePath) + { + } + + /// Loads the spatial./. + /// Stubbfel, 19.08.2013. + protected override void LoadSpatials(string xmlFilePath) + { + SpsModel model = XmlManager.DeserializationFileToModel(xmlFilePath); + + this.Spatial = new SpsModel(); + foreach (PlaceModel place in model.Places) + { + if (Campus.Equals(place.ParentId) || Campus.Equals(place.PlaceId)) + { + this.Spatial.Places.Add(place); + } + } + } + } +} diff --git a/CampusAppWP8/CampusAppDLL/Model/Campusmap/MapModel.cs b/CampusAppWP8/CampusAppDLL/Model/Campusmap/MapModel.cs new file mode 100644 index 00000000..50edaf3c --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Model/Campusmap/MapModel.cs @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 24.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppDLL.Model.Campusmap +{ + using CampusAppDLL.Model.GeoDb; + using System; + + /// + /// This Class manage the properties of a Map + /// + public class MapModel + { + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public MapModel(string xmlFilePath) + { + this.LoadSpatials(xmlFilePath); + } + + #endregion + + #region Property + + /// Gets or sets the spatial of the map. + /// The spatial. + public SpsModel Spatial { get; set; } + + #endregion + + #region Methods + + /// Loads the spatial./ + /// Stubbfel, 19.08.2013. + protected virtual void LoadSpatials(string xmlFilePath) + { + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceInformation.cs b/CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceInformation.cs new file mode 100644 index 00000000..f23d4124 --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceInformation.cs @@ -0,0 +1,26 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 19.08.2013 +//---------------------------------------------------------------------- +namespace CampusAppDLL.Model.GeoDb +{ + using System.Xml.Serialization; + + /// Information about the place. + /// Stubbfel, 19.08.2013. + public class PlaceInformation + { + /// Gets or sets the name of the information. + /// The name of the information. + [XmlElement("placeInformationName")] + public string InformationName { get; set; } + + /// Gets or sets the information value. + /// The information value. + [XmlText] + public string InformationValue { get; set; } + } +} diff --git a/CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceModel.cs b/CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceModel.cs new file mode 100644 index 00000000..8e0a0d20 --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceModel.cs @@ -0,0 +1,47 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 08.08.2013 +//---------------------------------------------------------------------- + +namespace CampusAppDLL.Model.GeoDb +{ + using System.Collections.ObjectModel; + using System.Xml.Serialization; + + /// + /// Model for a place of the SPSService + /// + public class PlaceModel + { + /// + /// Gets or sets the placeId + /// + [XmlAttribute("id")] + public string PlaceId { get; set; } + + /// + /// Gets or sets the id of the "parent" of a place + /// + [XmlAttribute("parentId")] + public string ParentId { get; set; } + + /// + /// Gets or sets the ReferencePoint of a place + /// + [XmlAttribute("refpoint")] + public string RefPoint { get; set; } + + /// Gets or sets the information. + /// The information. + [XmlElement("placeInformation")] + public ObservableCollection Informations { get; set; } + + /// Gets or sets the services. + /// The services. + [XmlElement("placeService")] + public ObservableCollection Services { get; set; } + } +} diff --git a/CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceService.cs b/CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceService.cs new file mode 100644 index 00000000..7e17403c --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceService.cs @@ -0,0 +1,32 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 19.08.2013 +//----------------------------------------------------------------------------- + +namespace CampusAppDLL.Model.GeoDb +{ + using System.Xml.Serialization; + + /// Place service. + /// Stubbfel, 19.08.2013. + public class PlaceService + { + /// Gets or sets the name of the service. + /// The name of the service. + [XmlAttribute("placeServiceName")] + public string ServiceName { get; set; } + + /// Gets or sets the SAP of an service. + /// The sap. + [XmlElement("sap")] + public string SAP { get; set; } + + /// Gets or sets the request for a place. + /// The request. + [XmlElement("request")] + public string Request { get; set; } + } +} diff --git a/CampusAppWP8/CampusAppDLL/Model/GeoDb/SpsModel.cs b/CampusAppWP8/CampusAppDLL/Model/GeoDb/SpsModel.cs new file mode 100644 index 00000000..4fa4bb86 --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Model/GeoDb/SpsModel.cs @@ -0,0 +1,87 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 08.08.2013 +//---------------------------------------------------------------------- + +namespace CampusAppDLL.Model.GeoDb +{ + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Linq; + using System.Xml.Serialization; + + /// + /// Model for a xml-response of the SPSService + /// + [XmlRoot("root")] + public class SpsModel + { + /// Initializes a new instance of the SpsModel class. + /// Stubbfel, 20.08.2013. + public SpsModel() + { + this.Places = new ObservableCollection(); + } + + /// + /// Gets or sets a list of places + /// + [XmlElement("place")] + public ObservableCollection Places { get; set; } + + /// Gets places by information. + /// Stubbfel, 19.08.2013. + /// The query. + /// (Optional) the ignore cases. + /// (Optional) name of the information. + /// The places by information. + public List GetPlacesByInformation(string query, bool ignoreCases = true, string informationName = null) + { + string querryLow = string.Empty; + IEnumerable resultplaces = null; + + // select correct statement + if (ignoreCases && informationName == null) + { + querryLow = query.ToLower(); + resultplaces = from place in this.Places + from info in place.Informations + where info.InformationValue.ToLower().Contains(querryLow) + select place; + } + else if (ignoreCases && informationName != null) + { + querryLow = query.ToLower(); + resultplaces = from place in this.Places + from info in place.Informations + where info.InformationValue.ToLower().Contains(querryLow) && info.InformationName.Equals(informationName) + select place; + } + else if (!ignoreCases && informationName == null) + { + resultplaces = from place in this.Places + from info in place.Informations + where info.InformationValue.Contains(querryLow) + select place; + } + else if (!ignoreCases && informationName != null) + { + resultplaces = from place in this.Places + from info in place.Informations + where info.InformationValue.Contains(querryLow) && info.InformationName.Equals(informationName) + select place; + } + + // null assert + if (resultplaces == null) + { + return null; + } + + return resultplaces.ToList(); + } + } +} diff --git a/CampusAppWP8/CampusAppDLL/Properties/AssemblyInfo.cs b/CampusAppWP8/CampusAppDLL/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..7597545e --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die mit einer Assembly verknüpft sind. +[assembly: AssemblyTitle("CampusAppDLL")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CampusAppDLL")] +[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar +// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von +// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("883d352f-0864-47db-8a04-f5eee0800a6d")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern +// übernehmen, indem Sie "*" eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/CampusAppWP8/CampusAppDLL/Utility/Logger.cs b/CampusAppWP8/CampusAppDLL/Utility/Logger.cs new file mode 100644 index 00000000..a3ca7f02 --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Utility/Logger.cs @@ -0,0 +1,35 @@ +//-------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 03.05.2013 +//---------------------------------------------------------------------- +namespace CampusAppDLL.Utility +{ + using System; + + /// + /// This Class creates logs for the app + /// + public class Logger + { + /// + /// Method log a Exception + /// + /// exception which has to log + public static void LogException(Exception exception) + { + // Console.WriteLine(exception); + } + + /// + /// Log a message. + /// + /// to be logged message + public static void LogMsg(string msg) + { + // Console.WriteLine(msg); + } + } +} diff --git a/CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFMessage.cs b/CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFMessage.cs new file mode 100644 index 00000000..30a9fd4d --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFMessage.cs @@ -0,0 +1,154 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 21.08.2013 +//---------------------------------------------------------------------- +namespace CampusAppDLL.Utility.NDEF +{ + using System.Collections.Generic; + using System.IO; + + /// Ndef message. + /// Stubbfel, 21.08.2013. + public class NDEFMessage + { + #region Members + + /// The records. + private List records; + + #endregion + + #region constructors + + /// Initializes a new instance of the NDEFMessage class. + /// Stubbfel, 21.08.2013. + /// The content. + /// The type. + /// (Optional) the tnf. + public NDEFMessage(string content, TYPEVAL type, NDEFRecord.TNFVAL tnf = NDEFRecord.TNFVAL.WKT) + { + this.records = new List(); + float recordsCount = (float)content.Length / NDEFRecord.MaxRecordPayLoad; + NDEFRecord tmpRecord = null; + string praefix = NDEFMessage.GetPraefix(type); + + for (int i = 0; recordsCount > 0; i++) + { + tmpRecord = new NDEFShortRecord(); + tmpRecord.Type = type; + tmpRecord.TNF = tnf; + tmpRecord.PayloadPraefix = praefix; + int recordsize = 255; + if (content.Length < (i + 1) * recordsize) + { + recordsize = content.Length - (i * recordsize); + } + + tmpRecord.Payload = content.Substring(i * 255, recordsize); + if (i == 0) + { + tmpRecord.MB = NDEFRecord.NDEFFlags.MBSET; + } + + this.records.Add(tmpRecord); + recordsCount--; + } + + this.records[this.records.IndexOf(tmpRecord)].ME = NDEFRecord.NDEFFlags.MESET; + } + + /// Initializes a new instance of the NDEFMessage class. + /// Stubbfel, 21.08.2013. + /// The array. + public NDEFMessage(byte[] array) + { + this.records = new List(); + + NDEFRecord tmpRecord = null; + for (int i = 0; i < array.Length; i += tmpRecord.RecordSize) + { + tmpRecord = new NDEFShortRecord(array, i); + + this.records.Add(tmpRecord); + } + } + + #endregion + + #region enum + + /// Values that represent TYPEVAL. + /// Stubbfel, 21.08.2013. + public enum TYPEVAL + { + /// An enum constant representing the empty option. + EMPTY = 0x00, + + /// An enum constant representing the URL option. + URL = 0x55, + + /// An enum constant representing the text option. + TEXT = 0x54, + } + + #endregion + + #region Methods + /// Gets a praefix. + /// Stubbfel, 21.08.2013. + /// The type. + /// The praefix. + public static string GetPraefix(TYPEVAL type) + { + string praefix = string.Empty; + + switch (type) + { + case TYPEVAL.TEXT: + praefix = "\x02" + "de"; + break; + case TYPEVAL.URL: + praefix = "\x01"; + break; + default: + break; + } + + return praefix; + } + + /// Gets the content. + /// Stubbfel, 21.08.2013. + /// The content. + public string GetContent() + { + string result = string.Empty; + + foreach (NDEFRecord record in this.records) + { + result += record.Payload; + } + + return result; + } + + /// Converts this object to a byte array. + /// Stubbfel, 21.08.2013. + /// This object as a byte[]. + public byte[] ToByteArray() + { + MemoryStream ms = new MemoryStream(); + foreach (NDEFRecord record in this.records) + { + ms.Write(record.ToByteArray(), 0, record.RecordSize); + } + + return ms.ToArray(); + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFRecord.cs b/CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFRecord.cs new file mode 100644 index 00000000..ca7e1fc5 --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFRecord.cs @@ -0,0 +1,188 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 21.08.2013 +//---------------------------------------------------------------------- +namespace CampusAppDLL.Utility.NDEF +{ + using System.IO; + using System.Text; + + /// Ndef record of a NDEFMessage. + /// Stubbfel, 21.08.2013. + public abstract class NDEFRecord + { + #region Members + + /// The maximum record pay load. + public const int MaxRecordPayLoad = 255; + + /// Size of the type. + protected const byte TypeSize = 0x01; + + #endregion + + #region Constructors + /// Initializes a new instance of the NDEFRecord class. + /// Stubbfel, 21.08.2013. + public NDEFRecord() + { + } + + /// Initializes a new instance of the NDEFRecord class. + /// Stubbfel, 21.08.2013. + /// The array. + /// (Optional) zero-based index of the. + public NDEFRecord(byte[] array, int index = 0) + { + this.FormatFlags = array[index]; + } + + #endregion + + #region enum + + /// Values that represent NDEFFlags. + /// Stubbfel, 21.08.2013. + public enum NDEFFlags + { + /// An Enum constant representing the UNSET option. + UNSET = 0x00, + + /// An Enum constant representing the Message begin option. + MBSET = 0x80, + + /// An Enum constant representing the Message end option. + MESET = 0x40, + + /// An Enum constant representing the CHUNK FLAG option. + CFSET = 0x20, + + /// An Enum constant representing the Short Record set option. + SRSET = 0x10, + + /// An Enum constant representing the ID length option. + ILSET = 0x08, + + /// An enum constant representing the tnfset option. + TNFSET = 0x03 + } + + /// Values that represent TNFVAL. + /// Stubbfel, 21.08.2013. + public enum TNFVAL + { + /// An enum constant representing the empty option. + EMPTY = 0x00, + + /// An enum constant representing the Well-Know-Type option. + WKT = 0x01, + + /// An enum constant representing the MediaType option. + MEDIATYPE = 0x02, + + /// An enum constant representing the URI option. + URI = 0x03, + + /// An enum constant representing the NFCE option. + NFCE = 0x04, + + /// An enum constant representing the unknow option. + unknow = 0x05, + + /// An enum constant representing the unchanged option. + UNCHANGED = 0x06, + + /// An enum constant representing the reserved option. + RESERVED = 0x07 + } + + #endregion + + #region Properties + /// Gets or sets the MBFlag. + /// The MBFlag. + public NDEFFlags MB { get; set; } + + /// Gets or sets MEFlag. + /// The MEFlag . + public NDEFFlags ME { get; set; } + + /// Gets or sets the CFFlag. + /// The CFFlag. + public NDEFFlags CF { get; set; } + + /// Gets or sets the SRFlag. + /// The SRFlag. + public NDEFFlags SR { get; set; } + + /// Gets or sets the ILFlag. + /// The ILFlag. + public NDEFFlags IL { get; set; } + + /// Gets or sets the TNFField. + /// The TNFField. + public TNFVAL TNF { get; set; } + + /// Gets or sets the type. + /// The type. + public NDEFMessage.TYPEVAL Type { get; set; } + + /// Gets or sets the format flags. + /// The format flags. + public byte FormatFlags + { + get + { + return (byte)((byte)this.TNF | ((byte)this.MB) | ((byte)this.ME) | ((byte)this.CF) | ((byte)this.SR) | ((byte)this.IL)); + } + + protected set + { + this.TNF = (TNFVAL)(value & (byte)NDEFFlags.TNFSET); + this.MB = (NDEFFlags)(value & (byte)NDEFFlags.MBSET); + this.ME = (NDEFFlags)(value & (byte)NDEFFlags.MESET); + this.CF = (NDEFFlags)(value & (byte)NDEFFlags.CFSET); + this.SR = (NDEFFlags)(value & (byte)NDEFFlags.SRSET); + this.IL = (NDEFFlags)(value & (byte)NDEFFlags.ILSET); + } + } + + /// Gets or sets the payload. + /// The payload. + public string Payload { get; set; } + + /// Gets the size of the record. + /// The size of the record. + public int RecordSize + { + get + { + return this.HeaderSize + this.Payload.Length + this.PayloadPraefix.Length; + } + } + + /// Gets or sets the payload praefix. + /// The payload praefix. + public string PayloadPraefix { get; set; } + + /// Gets or sets the size of the header. + /// The size of the header. + protected int HeaderSize { get; set; } + + #endregion + + #region Methods + + /// Converts the record to a byte array. + /// Stubbfel, 21.08.2013. + /// This object as a byte[]. + public abstract byte[] ToByteArray(); + + #endregion + } +} + +// End of Utility\NDEF\NDEFRecord.cs diff --git a/CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFShortRecord.cs b/CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFShortRecord.cs new file mode 100644 index 00000000..bb108ddd --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFShortRecord.cs @@ -0,0 +1,63 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 21.08.2013 +//---------------------------------------------------------------------- +namespace CampusAppDLL.Utility.NDEF +{ + using System.Text; + + /// Ndef short record. + /// Stubbfel, 21.08.2013. + public class NDEFShortRecord : NDEFRecord + { + /// Initializes a new instance of the NDEFShortRecord class. + /// Stubbfel, 21.08.2013. + public NDEFShortRecord() + { + this.HeaderSize = 4; + this.SR = NDEFFlags.SRSET; + this.IL = NDEFFlags.UNSET; + this.CF = NDEFFlags.UNSET; + } + + /// Initializes a new instance of the NDEFShortRecord class. + /// Stubbfel, 21.08.2013. + /// The array. + /// (Optional) zero-based index of the. + public NDEFShortRecord(byte[] array, int index = 0) + : base(array) + { + this.HeaderSize = 4; + this.Type = (NDEFMessage.TYPEVAL)array[index + 3]; + this.PayloadPraefix = NDEFMessage.GetPraefix(this.Type); + int payLoadSize = array[index + 2] - this.PayloadPraefix.Length; + this.Payload = Encoding.UTF8.GetString(array, index + this.HeaderSize + this.PayloadPraefix.Length, payLoadSize); + } + + /// Converts this NDEFShortRecord to a byte array. + /// Stubbfel, 21.08.2013. + /// This object as a byte[]. + public override byte[] ToByteArray() + { + byte[] payloadAr = Encoding.UTF8.GetBytes(this.PayloadPraefix + this.Payload); + byte[] array = new byte[payloadAr.Length + this.HeaderSize]; + + array[0] = this.FormatFlags; + array[1] = NDEFRecord.TypeSize; + array[2] = (byte)(Payload.Length + this.PayloadPraefix.Length); + array[3] = (byte)this.Type; + + int i = this.HeaderSize; + foreach (byte b in payloadAr) + { + array[i] = b; + i++; + } + + return array; + } + } +} diff --git a/CampusAppWP8/CampusAppDLL/Utility/StringManager.cs b/CampusAppWP8/CampusAppDLL/Utility/StringManager.cs new file mode 100644 index 00000000..ff708949 --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Utility/StringManager.cs @@ -0,0 +1,59 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 06.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppDLL.Utility +{ + using System.Text.RegularExpressions; + + /// + /// Class provides some special StringMethods + /// + public static class StringManager + { + #region Members + + /// + /// Patter for Html-Tags + /// + private static readonly string HtmlTagPattern = "<.*?>"; + + #endregion + + #region Methods + + /// + /// Method removes Html-Tag of a String + /// + /// String with Html-Tags + /// String without Html-Tags + public static string StripHTML(string inputString) + { + return Regex.Replace(inputString, HtmlTagPattern, string.Empty); + } + + /// + /// Method add an Newline to a string + /// + /// input string + /// input string + newline + public static string AddNewLine(string str) + { + return str.ToString() + "\n"; + } + + /// + /// Method remove(TrimEND!) an Newline to a string + /// + /// input string + /// input string - newline +// Company copyright tag. +// +// stubbfel +// 18.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppDLL.Utility +{ + using System.IO; + using System.Xml.Linq; + using System.Xml.Serialization; + + /// + /// Class provides some Xml-methods + /// + public class XmlManager + { + /// + /// Method deserialization a string to a Model + /// + /// the model + /// the XmlString + /// name of the RootTag + /// return the deserialization of the model + public static T DeserializationToModel(string xmlString, string validRootName) + { + XmlSerializer serializer = new XmlSerializer(typeof(T)); + XDocument document = XDocument.Parse(xmlString); + if (!document.Root.Name.ToString().Equals(validRootName)) + { + XElement content = document.Root; + document = new XDocument(); + document.Add(new XElement(validRootName, content)); + } + + T model = (T)serializer.Deserialize(document.CreateReader()); + return model; + } + + /// Deserialization a xml file to a model. + /// Stubbfel, 20.08.2013. + /// Generic type parameter. + /// Path to the a XmlFile. + /// model of the XmlFile. + public static T DeserializationFileToModel(string xmlFilePath) + { + XmlSerializer serializer = new XmlSerializer(typeof(T)); + XDocument document = XDocument.Load(xmlFilePath); + T model = (T)serializer.Deserialize(document.CreateReader()); + return model; + } + + /// + /// Method serializes a model to a string. + /// + /// type of the model + /// model object + /// serialized string + public static string SerializationToString(T model) + { + string retValue = string.Empty; + + XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); + ns.Add(string.Empty, string.Empty); + + XmlSerializer serializer = new XmlSerializer(typeof(T)); + TextWriter writer = new StringWriter(); + + serializer.Serialize(writer, model, ns); + + retValue = writer.ToString(); + + if (retValue.StartsWith(""); + retValue = retValue.Substring(endTag + 2); + + if (retValue.StartsWith("\r\n") == true) + { + retValue = retValue.Substring(2); + } + } + + return retValue; + } + } +} diff --git a/CampusAppWP8/CampusAppW8.sln b/CampusAppWP8/CampusAppW8.sln index 97cdc60d..8403729e 100644 --- a/CampusAppWP8/CampusAppW8.sln +++ b/CampusAppWP8/CampusAppW8.sln @@ -9,14 +9,20 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CampusAppWPortalLib8", "Cam EndProject Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "IconCreator", "IconCreator\IconCreator.pyproj", "{78E8DC22-F4E1-42D9-BA04-93EA031C630C}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CampusAppDLL", "CampusAppDLL\CampusAppDLL.csproj", "{E4EC5B95-06FC-4304-97E2-9E3F9B980303}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|ARM = Debug|ARM + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU Release|ARM = Release|ARM + Release|Mixed Platforms = Release|Mixed Platforms + Release|Win32 = Release|Win32 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection @@ -27,6 +33,12 @@ Global {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|ARM.ActiveCfg = Debug|ARM {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|ARM.Build.0 = Debug|ARM {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|ARM.Deploy.0 = Debug|ARM + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|Mixed Platforms.Deploy.0 = Debug|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|Win32.ActiveCfg = Debug|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|Win32.Build.0 = Debug|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|Win32.Deploy.0 = Debug|x86 {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|x64.ActiveCfg = Debug|Any CPU {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|x86.ActiveCfg = Debug|x86 {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|x86.Build.0 = Debug|x86 @@ -37,6 +49,12 @@ Global {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|ARM.ActiveCfg = Release|ARM {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|ARM.Build.0 = Release|ARM {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|ARM.Deploy.0 = Release|ARM + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|Mixed Platforms.Build.0 = Release|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|Mixed Platforms.Deploy.0 = Release|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|Win32.ActiveCfg = Release|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|Win32.Build.0 = Release|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|Win32.Deploy.0 = Release|x86 {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|x64.ActiveCfg = Release|Any CPU {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|x86.ActiveCfg = Release|x86 {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|x86.Build.0 = Release|x86 @@ -47,6 +65,12 @@ Global {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|ARM.ActiveCfg = Debug|ARM {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|ARM.Build.0 = Debug|ARM {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|ARM.Deploy.0 = Debug|ARM + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|Mixed Platforms.Deploy.0 = Debug|x86 + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|Win32.ActiveCfg = Debug|x86 + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|Win32.Build.0 = Debug|x86 + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|Win32.Deploy.0 = Debug|x86 {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|x64.ActiveCfg = Debug|x64 {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|x64.Build.0 = Debug|x64 {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|x64.Deploy.0 = Debug|x64 @@ -59,6 +83,12 @@ Global {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|ARM.ActiveCfg = Release|ARM {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|ARM.Build.0 = Release|ARM {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|ARM.Deploy.0 = Release|ARM + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|Mixed Platforms.Build.0 = Release|x86 + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|Mixed Platforms.Deploy.0 = Release|x86 + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|Win32.ActiveCfg = Release|x86 + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|Win32.Build.0 = Release|x86 + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|Win32.Deploy.0 = Release|x86 {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|x64.ActiveCfg = Release|x64 {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|x64.Build.0 = Release|x64 {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|x64.Deploy.0 = Release|x64 @@ -68,21 +98,47 @@ Global {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Debug|Any CPU.Build.0 = Debug|Any CPU {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Debug|ARM.ActiveCfg = Debug|Any CPU + {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Debug|Win32.ActiveCfg = Debug|Any CPU {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Debug|x64.ActiveCfg = Debug|Any CPU {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Debug|x86.ActiveCfg = Debug|Any CPU {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Release|Any CPU.ActiveCfg = Release|Any CPU {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Release|Any CPU.Build.0 = Release|Any CPU {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Release|ARM.ActiveCfg = Release|Any CPU + {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Release|Win32.ActiveCfg = Release|Any CPU {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Release|x64.ActiveCfg = Release|Any CPU {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Release|x86.ActiveCfg = Release|Any CPU {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Debug|ARM.ActiveCfg = Debug|Any CPU + {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Debug|Win32.ActiveCfg = Debug|Any CPU {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Debug|x64.ActiveCfg = Debug|Any CPU {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Debug|x86.ActiveCfg = Debug|Any CPU {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Release|Any CPU.ActiveCfg = Release|Any CPU {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Release|ARM.ActiveCfg = Release|Any CPU + {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Release|Win32.ActiveCfg = Release|Any CPU {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Release|x64.ActiveCfg = Release|Any CPU {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Release|x86.ActiveCfg = Release|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Debug|ARM.ActiveCfg = Debug|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Debug|Win32.ActiveCfg = Debug|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Debug|x64.ActiveCfg = Debug|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Debug|x86.ActiveCfg = Debug|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Release|Any CPU.Build.0 = Release|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Release|ARM.ActiveCfg = Release|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Release|Win32.ActiveCfg = Release|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Release|x64.ActiveCfg = Release|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj b/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj index 4c60064b..8d9e3e15 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj +++ b/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj @@ -33,6 +33,12 @@ 4 + + + + + + diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Campusmap/CBMainMapModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Campusmap/CBMainMapModel.cs new file mode 100644 index 00000000..7645723a --- /dev/null +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Campusmap/CBMainMapModel.cs @@ -0,0 +1,45 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 13.08.2013 +//----------------------------------------------------------------------------- +using CampusAppWPortalLib8.Model.GeoDb; +using CampusAppWPortalLib8.Utility; + +namespace CampusAppWPortalLib8.Model.Campusmap +{ + + /// + /// Class for the MapModel of the mainCampus of cottbus + /// + public class CBMainMapModel : MapModel + { + /// Variable for the identify of the campus. + private static readonly string Campus = "1"; + + /// + /// Initializes a new instance of the class. + /// + public CBMainMapModel(string xmlFilePath) : base(xmlFilePath) + { + } + + /// Loads the spatial./. + /// Stubbfel, 19.08.2013. + protected override void LoadSpatials(string xmlFilePath) + { + SpsModel model = XmlManager.DeserializationFileToModel(xmlFilePath); + + this.Spatial = new SpsModel(); + foreach (PlaceModel place in model.Places) + { + if (Campus.Equals(place.ParentId) || Campus.Equals(place.PlaceId)) + { + this.Spatial.Places.Add(place); + } + } + } + } +} diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Campusmap/MapModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Campusmap/MapModel.cs new file mode 100644 index 00000000..75448b7b --- /dev/null +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Campusmap/MapModel.cs @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 24.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWPortalLib8.Model.Campusmap +{ + using CampusAppWPortalLib8.Model.GeoDb; + using System; + + /// + /// This Class manage the properties of a Map + /// + public class MapModel + { + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public MapModel(string xmlFilePath) + { + this.LoadSpatials(xmlFilePath); + } + + #endregion + + #region Property + + /// Gets or sets the spatial of the map. + /// The spatial. + public SpsModel Spatial { get; set; } + + #endregion + + #region Methods + + /// Loads the spatial./ + /// Stubbfel, 19.08.2013. + protected virtual void LoadSpatials(string xmlFilePath) + { + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceInformation.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceInformation.cs new file mode 100644 index 00000000..4768712b --- /dev/null +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceInformation.cs @@ -0,0 +1,26 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 19.08.2013 +//---------------------------------------------------------------------- +namespace CampusAppWPortalLib8.Model.GeoDb +{ + using System.Xml.Serialization; + + /// Information about the place. + /// Stubbfel, 19.08.2013. + public class PlaceInformation + { + /// Gets or sets the name of the information. + /// The name of the information. + [XmlElement("placeInformationName")] + public string InformationName { get; set; } + + /// Gets or sets the information value. + /// The information value. + [XmlText] + public string InformationValue { get; set; } + } +} diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceModel.cs new file mode 100644 index 00000000..3b048ee8 --- /dev/null +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceModel.cs @@ -0,0 +1,47 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 08.08.2013 +//---------------------------------------------------------------------- + +namespace CampusAppWPortalLib8.Model.GeoDb +{ + using System.Collections.ObjectModel; + using System.Xml.Serialization; + + /// + /// Model for a place of the SPSService + /// + public class PlaceModel + { + /// + /// Gets or sets the placeId + /// + [XmlAttribute("id")] + public string PlaceId { get; set; } + + /// + /// Gets or sets the id of the "parent" of a place + /// + [XmlAttribute("parentId")] + public string ParentId { get; set; } + + /// + /// Gets or sets the ReferencePoint of a place + /// + [XmlAttribute("refpoint")] + public string RefPoint { get; set; } + + /// Gets or sets the information. + /// The information. + [XmlElement("placeInformation")] + public ObservableCollection Informations { get; set; } + + /// Gets or sets the services. + /// The services. + [XmlElement("placeService")] + public ObservableCollection Services { get; set; } + } +} diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceService.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceService.cs new file mode 100644 index 00000000..8a5f5bf8 --- /dev/null +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceService.cs @@ -0,0 +1,32 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 19.08.2013 +//----------------------------------------------------------------------------- + +namespace CampusAppWPortalLib8.Model.GeoDb +{ + using System.Xml.Serialization; + + /// Place service. + /// Stubbfel, 19.08.2013. + public class PlaceService + { + /// Gets or sets the name of the service. + /// The name of the service. + [XmlAttribute("placeServiceName")] + public string ServiceName { get; set; } + + /// Gets or sets the SAP of an service. + /// The sap. + [XmlElement("sap")] + public string SAP { get; set; } + + /// Gets or sets the request for a place. + /// The request. + [XmlElement("request")] + public string Request { get; set; } + } +} diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/SpsModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/SpsModel.cs new file mode 100644 index 00000000..378d7e90 --- /dev/null +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/SpsModel.cs @@ -0,0 +1,87 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 08.08.2013 +//---------------------------------------------------------------------- + +namespace CampusAppWPortalLib8.Model.GeoDb +{ + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Linq; + using System.Xml.Serialization; + + /// + /// Model for a xml-response of the SPSService + /// + [XmlRoot("root")] + public class SpsModel + { + /// Initializes a new instance of the SpsModel class. + /// Stubbfel, 20.08.2013. + public SpsModel() + { + this.Places = new ObservableCollection(); + } + + /// + /// Gets or sets a list of places + /// + [XmlElement("place")] + public ObservableCollection Places { get; set; } + + /// Gets places by information. + /// Stubbfel, 19.08.2013. + /// The query. + /// (Optional) the ignore cases. + /// (Optional) name of the information. + /// The places by information. + public List GetPlacesByInformation(string query, bool ignoreCases = true, string informationName = null) + { + string querryLow = string.Empty; + IEnumerable resultplaces = null; + + // select correct statement + if (ignoreCases && informationName == null) + { + querryLow = query.ToLower(); + resultplaces = from place in this.Places + from info in place.Informations + where info.InformationValue.ToLower().Contains(querryLow) + select place; + } + else if (ignoreCases && informationName != null) + { + querryLow = query.ToLower(); + resultplaces = from place in this.Places + from info in place.Informations + where info.InformationValue.ToLower().Contains(querryLow) && info.InformationName.Equals(informationName) + select place; + } + else if (!ignoreCases && informationName == null) + { + resultplaces = from place in this.Places + from info in place.Informations + where info.InformationValue.Contains(querryLow) + select place; + } + else if (!ignoreCases && informationName != null) + { + resultplaces = from place in this.Places + from info in place.Informations + where info.InformationValue.Contains(querryLow) && info.InformationName.Equals(informationName) + select place; + } + + // null assert + if (resultplaces == null) + { + return null; + } + + return resultplaces.ToList(); + } + } +}