From f4ef9d8bdbe2dbf7dc99e9ce75ccc3ed0b3d9009 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Thu, 5 Sep 2013 11:21:54 +0200 Subject: [PATCH 1/4] mv apis to Api namespace --- .../CampusAppWP8/Api/GeoApi/CampusSpsApi.cs | 2 +- .../CampusAppWP8/Api/GeoApi/SpsApi.cs | 2 +- .../CampusAppWP8/Api/Lecture/LectureApi.cs | 2 +- .../Api/Person/PersonSearchApi.cs | 12 +++ CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 2 + .../Model/Person/PersonFunctionModel.cs | 102 +++++++++++++++--- .../Model/Person/PersonListModel.cs | 24 +++++ .../CampusAppWP8/Model/Person/PersonModel.cs | 92 +++++++++++++--- .../Pages/Lecture/LecturePage.xaml.cs | 2 +- .../Pages/Mensa/MensaPage.xaml.cs | 2 +- 10 files changed, 210 insertions(+), 32 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/Api/Person/PersonSearchApi.cs create mode 100644 CampusAppWP8/CampusAppWP8/Model/Person/PersonListModel.cs diff --git a/CampusAppWP8/CampusAppWP8/Api/GeoApi/CampusSpsApi.cs b/CampusAppWP8/CampusAppWP8/Api/GeoApi/CampusSpsApi.cs index 3502c684..e008cee8 100644 --- a/CampusAppWP8/CampusAppWP8/Api/GeoApi/CampusSpsApi.cs +++ b/CampusAppWP8/CampusAppWP8/Api/GeoApi/CampusSpsApi.cs @@ -5,7 +5,7 @@ // stubbfel // 12.08.2013 //---------------------------------------------------------------------- -namespace CampusAppWP8.Feed.GeoApi +namespace CampusAppWP8.Api.GeoApi { using System; using System.Collections.Generic; diff --git a/CampusAppWP8/CampusAppWP8/Api/GeoApi/SpsApi.cs b/CampusAppWP8/CampusAppWP8/Api/GeoApi/SpsApi.cs index 7972517f..3bef6f90 100644 --- a/CampusAppWP8/CampusAppWP8/Api/GeoApi/SpsApi.cs +++ b/CampusAppWP8/CampusAppWP8/Api/GeoApi/SpsApi.cs @@ -5,7 +5,7 @@ // stubbfel // 06.08.2013 //---------------------------------------------------------------------- -namespace CampusAppWP8.Feed.GeoApi +namespace CampusAppWP8.Api.GeoApi { using System; using System.Collections.Generic; diff --git a/CampusAppWP8/CampusAppWP8/Api/Lecture/LectureApi.cs b/CampusAppWP8/CampusAppWP8/Api/Lecture/LectureApi.cs index da60d1a9..96ce98a2 100644 --- a/CampusAppWP8/CampusAppWP8/Api/Lecture/LectureApi.cs +++ b/CampusAppWP8/CampusAppWP8/Api/Lecture/LectureApi.cs @@ -5,7 +5,7 @@ // stubbfel // 13.06.2013 //---------------------------------------------------------------------- -namespace CampusAppWP8.Feed.Lecture +namespace CampusAppWP8.Api.Lecture { using CampusAppWP8.Model; using CampusAppWP8.Model.Lecture; diff --git a/CampusAppWP8/CampusAppWP8/Api/Person/PersonSearchApi.cs b/CampusAppWP8/CampusAppWP8/Api/Person/PersonSearchApi.cs new file mode 100644 index 00000000..56bf909e --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Api/Person/PersonSearchApi.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CampusAppWP8.Api.Person +{ + class PersonSearchApi + { + } +} diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index d3a8f03c..54bc80fd 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -95,6 +95,7 @@ + App.xaml @@ -119,6 +120,7 @@ + diff --git a/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs b/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs index 6e558548..86c91b26 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs @@ -1,24 +1,42 @@ -using CampusAppWP8.Resources; -using CampusAppWP8.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml.Serialization; - +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 05.09.2013 +//----------------------------------------------------------------------------- namespace CampusAppWP8.Model.Person { + using System.Xml.Serialization; + using CampusAppWP8.Utility; + + /// Person function model. + /// Stubbfel, 05.09.2013. public class PersonFunctionModel { + /// The first tel. private string tel1; + /// The second tel. private string tel2; + /// The fax. private string fax; + /// The mail. private string mail; + /// The function. + private string function; + + /// The appointment. + private string appointment; + + /// The building. + private string building; + + /// Gets or sets the tel 1. + /// The tel 1. [XmlAttribute("telefon")] public string Tel1 { @@ -26,6 +44,7 @@ namespace CampusAppWP8.Model.Person { return this.tel1; } + set { if (value != null && value != this.tel1) @@ -35,6 +54,8 @@ namespace CampusAppWP8.Model.Person } } + /// Gets or sets the tel 2. + /// The tel 2. [XmlAttribute("telefon2")] public string Tel2 { @@ -42,6 +63,7 @@ namespace CampusAppWP8.Model.Person { return this.tel2; } + set { if (value != null && value != this.tel2) @@ -51,6 +73,8 @@ namespace CampusAppWP8.Model.Person } } + /// Gets or sets the fax. + /// The fax. [XmlAttribute("fax")] public string Fax { @@ -58,6 +82,7 @@ namespace CampusAppWP8.Model.Person { return this.fax; } + set { if (value != null && value != this.fax) @@ -67,15 +92,65 @@ namespace CampusAppWP8.Model.Person } } + /// Gets or sets the function. + /// The function. [XmlAttribute("funktion")] - public string Function { get; set; } + public string Function + { + get + { + return this.function; + } + set + { + if (value != this.function) + { + this.function = StringManager.StripHTML(value); + } + } + } + + /// Gets or sets the appointment. + /// The appointment. [XmlAttribute("einrichtung")] - public string Appointment { get; set; } + public string Appointment + { + get + { + return this.appointment; + } + set + { + if (value != this.appointment) + { + this.appointment = StringManager.StripHTML(value); + } + } + } + + /// Gets or sets the building. + /// The building. [XmlAttribute("gebaeude")] - public string Building { get; set; } + public string Building + { + get + { + return this.building; + } + set + { + if (value != this.building) + { + this.building = StringManager.StripHTML(value); + } + } + } + + /// Gets or sets the mail. + /// The mail. [XmlAttribute("mail")] public string Mail { @@ -83,6 +158,7 @@ namespace CampusAppWP8.Model.Person { return this.mail; } + set { if (value != null && value != this.mail && StringManager.IsValidEmail(value)) @@ -91,7 +167,5 @@ namespace CampusAppWP8.Model.Person } } } - - } } diff --git a/CampusAppWP8/CampusAppWP8/Model/Person/PersonListModel.cs b/CampusAppWP8/CampusAppWP8/Model/Person/PersonListModel.cs new file mode 100644 index 00000000..3f181cc9 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Person/PersonListModel.cs @@ -0,0 +1,24 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 05.09.2013 +//----------------------------------------------------------------------------- + +namespace CampusAppWP8.Model.Person +{ + using System.Collections.ObjectModel; + using System.Xml.Serialization; + + /// Person list model. + /// Stubbfel, 05.09.2013. + [XmlRoot("Uebersicht")] + public class PersonListModel + { + /// Gets or sets the persons. + /// The persons. + [XmlElement("person")] + public ObservableCollection Persons { get; set; } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Person/PersonModel.cs b/CampusAppWP8/CampusAppWP8/Model/Person/PersonModel.cs index e5cc4d8d..8fd06768 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Person/PersonModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Person/PersonModel.cs @@ -1,28 +1,94 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Serialization; - +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 05.09.2013 +//----------------------------------------------------------------------------- namespace CampusAppWP8.Model.Person { + using System.Collections.ObjectModel; + using System.Xml.Serialization; + using CampusAppWP8.Utility; + + /// Person model. + /// Stubbfel, 05.09.2013. public class PersonModel { + /// The akadgrad. + private string akadgrad; + + /// Name of the sur. + private string surName; + + /// The person's first name. + private string firstName; + + /// Gets or sets the identifier. + /// The identifier. [XmlAttribute("id")] - public string ID {get; set;} + public string ID { get; set; } + /// Gets or sets the akadgrad. + /// The akadgrad. [XmlAttribute("akadgrad")] - public string Akadgrad { get; set; } + public string Akadgrad + { + get + { + return this.akadgrad; + } + set + { + if (value != this.akadgrad) + { + this.akadgrad = StringManager.StripHTML(value); + } + } + } + + /// Gets or sets the name of the sur. + /// The name of the sur. [XmlAttribute("nachname")] - public string SureName { get; set; } + public string SurName + { + get + { + return this.surName; + } + set + { + if (value != this.surName) + { + this.surName = StringManager.StripHTML(value); + } + } + } + + /// Gets or sets the person's first name. + /// The name of the first. [XmlAttribute("vorname")] - public string FirstName { get; set; } + public string FirstName + { + get + { + return this.firstName; + } + set + { + if (value != this.firstName) + { + this.firstName = StringManager.StripHTML(value); + } + } + } + + /// Gets or sets the functions of a person. + /// The functions. [XmlElement("funktion")] - public ObservableCollection Function { get; set; } + public ObservableCollection Functions { get; set; } } } diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs index df00699e..0954f3b6 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs @@ -11,7 +11,7 @@ namespace CampusAppWP8.Pages.Lecture using System.Collections.Generic; using System.Windows; using System.Windows.Navigation; - using CampusAppWP8.Feed.Lecture; + using CampusAppWP8.Api.Lecture; using CampusAppWP8.Model.Lecture; using CampusAppWP8.Model.Utility; using CampusAppWP8.Resources; diff --git a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs index 228ffcb9..3f777e48 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs @@ -11,7 +11,7 @@ namespace CampusAppWP8.Pages.Mensa using System.Threading; using System.Windows; using System.Windows.Navigation; - using CampusAppWP8.Feed.GeoApi; + using CampusAppWP8.Api.GeoApi; using CampusAppWP8.Feed.Mensa; using CampusAppWP8.Resources; using CampusAppWP8.Utility.Lui.MessageBoxes; From 1bb85927a39fc5aacdcb223999a46eab7049f169 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Thu, 5 Sep 2013 16:24:51 +0200 Subject: [PATCH 2/4] add add contact function --- CampusAppWP8/CampusAppDLL/CampusAppDLL.csproj | 3 +- CampusAppWP8/CampusAppW8.sln | 12 +-- .../Api/Person/PersonSearchApi.cs | 29 +++++-- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 1 + .../Model/Person/PersonFunctionModel.cs | 17 ++++- .../Model/Person/PersonListModel.cs | 56 +++++++++++++- .../CampusAppWP8/Model/Person/PersonModel.cs | 65 +++++++++++++++- .../Pages/Lecture/LecturePage.xaml.cs | 3 - .../CampusAppWP8/Pages/Person/PersonPage.xaml | 58 ++++++++++++-- .../Pages/Person/PersonPage.xaml.cs | 75 +++++++++++++++++++ .../Resources/Constants.Designer.cs | 18 +++++ .../CampusAppWP8/Resources/Constants.resx | 6 ++ .../Utility/Lui/Button/AddPersonButton.cs | 43 +++++++++++ 13 files changed, 356 insertions(+), 30 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/Utility/Lui/Button/AddPersonButton.cs diff --git a/CampusAppWP8/CampusAppDLL/CampusAppDLL.csproj b/CampusAppWP8/CampusAppDLL/CampusAppDLL.csproj index ac3271f3..d039f9d6 100644 --- a/CampusAppWP8/CampusAppDLL/CampusAppDLL.csproj +++ b/CampusAppWP8/CampusAppDLL/CampusAppDLL.csproj @@ -9,8 +9,9 @@ Properties CampusAppDLL CampusAppDLL - v4.5 + v4.0 512 + Client true diff --git a/CampusAppWP8/CampusAppW8.sln b/CampusAppWP8/CampusAppW8.sln index 8403729e..f65bd6ee 100644 --- a/CampusAppWP8/CampusAppW8.sln +++ b/CampusAppWP8/CampusAppW8.sln @@ -33,9 +33,9 @@ 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|Mixed Platforms.ActiveCfg = Debug|Any CPU + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|Mixed Platforms.Deploy.0 = Debug|Any CPU {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 @@ -65,9 +65,9 @@ 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|Mixed Platforms.ActiveCfg = Debug|Any CPU + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|Mixed Platforms.Deploy.0 = Debug|Any CPU {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 diff --git a/CampusAppWP8/CampusAppWP8/Api/Person/PersonSearchApi.cs b/CampusAppWP8/CampusAppWP8/Api/Person/PersonSearchApi.cs index 56bf909e..055c6c2d 100644 --- a/CampusAppWP8/CampusAppWP8/Api/Person/PersonSearchApi.cs +++ b/CampusAppWP8/CampusAppWP8/Api/Person/PersonSearchApi.cs @@ -1,12 +1,27 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 05.09.2013 +//----------------------------------------------------------------------------- +// namespace CampusAppWP8.Api.Person { - class PersonSearchApi + using CampusAppWP8.Model; + using CampusAppWP8.Model.Person; + using CampusAppWP8.Resources; + + /// Person search api. + /// Stubbfel, 05.09.2013. + public class PersonSearchApi : XmlModel { + /// Initializes a new instance of the PersonSearchApi class. + /// Stubbfel, 05.09.2013. + public PersonSearchApi() + : base(ModelType.Feed, Constants.UrlPerson_PersonSearchByName) + { + this.ValidRootName = Constants.PersonListValidRootName; + } } } diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 54bc80fd..a6d11552 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -134,6 +134,7 @@ PersonPage.xaml + diff --git a/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs b/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs index 86c91b26..07304ff7 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs @@ -8,7 +8,7 @@ namespace CampusAppWP8.Model.Person { using System.Xml.Serialization; - using CampusAppWP8.Utility; + using CampusAppWP8.Utility; /// Person function model. /// Stubbfel, 05.09.2013. @@ -35,6 +35,7 @@ namespace CampusAppWP8.Model.Person /// The building. private string building; + /// Gets or sets the tel 1. /// The tel 1. [XmlAttribute("telefon")] @@ -47,7 +48,7 @@ namespace CampusAppWP8.Model.Person set { - if (value != null && value != this.tel1) + if (value != null && value != string.Empty && value != this.tel1) { this.tel1 = StringManager.CreateUniTelefonNumber(value); } @@ -66,7 +67,7 @@ namespace CampusAppWP8.Model.Person set { - if (value != null && value != this.tel2) + if (value != null && value != string.Empty && value != this.tel2) { this.tel2 = StringManager.CreateUniTelefonNumber(value); } @@ -85,7 +86,7 @@ namespace CampusAppWP8.Model.Person set { - if (value != null && value != this.fax) + if (value != null && value != string.Empty && value != this.fax) { this.fax = StringManager.CreateUniTelefonNumber(value); } @@ -167,5 +168,13 @@ namespace CampusAppWP8.Model.Person } } } + + /// Gets or sets the identifier of the person. + /// The identifier of the person. + public string PersonID { get; set; } + + /// Gets or sets zero-based index of the function. + /// The function index. + public int FunctionIndex { get; set; } } } diff --git a/CampusAppWP8/CampusAppWP8/Model/Person/PersonListModel.cs b/CampusAppWP8/CampusAppWP8/Model/Person/PersonListModel.cs index 3f181cc9..2f6dc513 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Person/PersonListModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Person/PersonListModel.cs @@ -8,6 +8,7 @@ namespace CampusAppWP8.Model.Person { + using System.Collections.Generic; using System.Collections.ObjectModel; using System.Xml.Serialization; @@ -19,6 +20,59 @@ namespace CampusAppWP8.Model.Person /// Gets or sets the persons. /// The persons. [XmlElement("person")] - public ObservableCollection Persons { get; set; } + public ObservableCollection Persons { get; set; } + + /// Sets person identifier to function. + /// Stubbfel, 05.09.2013. + public void SetPersonIdToFunction() + { + foreach (PersonModel person in this.Persons) + { + person.SetPersonIdToFunction(); + } + } + + /// Gets a person. + /// Stubbfel, 05.09.2013. + /// The identifier. + /// The person. + public PersonModel GetPerson(string id) + { + foreach (PersonModel tmpPerson in this.Persons) + { + if (tmpPerson.ID.Equals(id)) + { + return tmpPerson; + } + } + return null; + } + + /// Removes the non function and set identifiers person. + /// Stubbfel, 05.09.2013. + public void RemoveNonFunctionAndSetIdsPerson() + { + this.RemoveNonFunctionPerson(); + this.SetPersonIdToFunction(); + } + + /// Removes the non function person. + /// Stubbfel, 05.09.2013. + public void RemoveNonFunctionPerson() + { + List rmList = new List(); + foreach (PersonModel tmpPerson in this.Persons) + { + if (tmpPerson.Functions.Count < 1) + { + rmList.Add(tmpPerson); + } + } + + foreach (PersonModel rmPerson in rmList) + { + this.Persons.Remove(rmPerson); + } + } } } diff --git a/CampusAppWP8/CampusAppWP8/Model/Person/PersonModel.cs b/CampusAppWP8/CampusAppWP8/Model/Person/PersonModel.cs index 8fd06768..ef2caedf 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Person/PersonModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Person/PersonModel.cs @@ -24,10 +24,30 @@ namespace CampusAppWP8.Model.Person /// The person's first name. private string firstName; + /// The identifier. + private string id; + + /// The functions. + private ObservableCollection functions; + /// Gets or sets the identifier. /// The identifier. [XmlAttribute("id")] - public string ID { get; set; } + public string ID + { + get + { + return this.id; + } + set + { + if (value != this.id) + { + this.id = value; + this.SetPersonIdToFunction(); + } + } + } /// Gets or sets the akadgrad. /// The akadgrad. @@ -89,6 +109,47 @@ namespace CampusAppWP8.Model.Person /// Gets or sets the functions of a person. /// The functions. [XmlElement("funktion")] - public ObservableCollection Functions { get; set; } + public ObservableCollection Functions + { + get + { + return this.functions; + } + set + { + if (value != this.functions) + { + this.functions = value; + this.SetPersonIdToFunction(); + } + } + } + + /// Gets the name of a Person ( ). + /// The name of a Person. + public string FullName + { + get + { + return this.Akadgrad + " " + this.FirstName + " " + this.SurName; + } + } + + /// Sets person identifier to function. + /// Stubbfel, 05.09.2013. + public void SetPersonIdToFunction() + { + if (this.id == null || this.id.Equals(string.Empty) || this.functions == null) + { + return; + } + + int index = 0; + foreach (PersonFunctionModel function in this.functions) + { + function.PersonID = this.ID; + function.FunctionIndex = index++; + } + } } } diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs index 0954f3b6..0ed9ee1b 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs @@ -159,9 +159,6 @@ namespace CampusAppWP8.Pages.Lecture /// /// Method send a request to the Feed /// - /// - /// have to refactors - /// /// sender of this event /// events arguments private void SendRequest(object sender, RoutedEventArgs e) diff --git a/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml index 42be8898..f0cd53ea 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml @@ -6,6 +6,7 @@ xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" @@ -20,6 +21,8 @@ + + @@ -39,12 +42,12 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs index 42f82e7f..cc686ab4 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs @@ -7,14 +7,89 @@ using System.Windows.Controls; using System.Windows.Navigation; using Microsoft.Phone.Controls; using Microsoft.Phone.Shell; +using CampusAppWP8.Api.Person; +using CampusAppWP8.Model.Utility; +using CampusAppWP8.Utility.Lui.MessageBoxes; +using CampusAppWP8.Resources; +using Microsoft.Phone.Tasks; +using CampusAppWP8.Utility.Lui.Button; +using CampusAppWP8.Model.Person; namespace CampusAppWP8.Pages.Person { public partial class PersonPage : PhoneApplicationPage { + private PersonSearchApi api; + public PersonPage() { InitializeComponent(); } + + private void SendRequest(object sender, RoutedEventArgs e) + { + string query = this.SearchName.Text.Trim(); + if (query.Equals(string.Empty)) + { + return; + } + + this.api = new PersonSearchApi(); + this.api.OnLoaded += new PersonSearchApi.OnIO(this.ApiIsReady); + this.api.OnFailedLoad += new PersonSearchApi.OnFailed(this.ApiIsFail); + this.ProgressBar.Visibility = System.Windows.Visibility.Visible; + List parameterList = this.CreateUrlParameter(query); + this.api.SetUriParams(parameterList); + this.api.LoadData(); + } + + private List CreateUrlParameter(string name) + { + List parameterList = new List(); + parameterList.Add(new CleanUrlParamModel("Uebersicht", name)); + return parameterList; + } + + private void ApiIsFail() + { + MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoad); + this.ProgressBar.Visibility = Visibility.Collapsed; + } + + private void ApiIsReady() + { + this.SetupResultBox(); + this.ProgressBar.Visibility = Visibility.Collapsed; + } + + private void SetupResultBox() + { + this.api.Model.RemoveNonFunctionAndSetIdsPerson(); + this.ResultBox.ItemsSource = this.api.Model.Persons; + } + + private void Button_Click(object sender, RoutedEventArgs e) + { + AddPersonButton btn = sender as AddPersonButton; + string personID = btn.PersonId as string; + int fIndex = (int)btn.FunctionIndex; + PersonModel person = this.api.Model.GetPerson(personID); + // int functionIndex = btn.Parent. + SaveContactTask saveContactTask = new SaveContactTask(); + saveContactTask.FirstName = person.FirstName; + saveContactTask.LastName = person.SurName; + saveContactTask.Title = person.Akadgrad; + saveContactTask.JobTitle = person.Functions[fIndex].Function; + saveContactTask.Company = "BTU - " + person.Functions[fIndex].Appointment; + saveContactTask.WorkAddressCountry = "De"; + saveContactTask.WorkAddressCity = "Cottbus"; + saveContactTask.WorkAddressState = "Brandenburg"; + saveContactTask.WorkAddressZipCode = "03046"; + saveContactTask.WorkAddressStreet = person.Functions[fIndex].Building; + saveContactTask.WorkPhone = person.Functions[fIndex].Tel1; + saveContactTask.WorkEmail = person.Functions[fIndex].Mail; + + saveContactTask.Show(); + } } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs index d4c18d60..c3ead845 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs @@ -780,6 +780,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Uebersicht ähnelt. + /// + public static string PersonListValidRootName { + get { + return ResourceManager.GetString("PersonListValidRootName", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die [+-]{0,1}[0-9]+[.,]{0,1}[0-9]+[\s][+-]{0,1}[0-9]+[.,]{0,1}[0-9]+ ähnelt. /// @@ -978,6 +987,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die https://www.zv.tu-cottbus.de/CMS-Webservice/Person ähnelt. + /// + public static string UrlPerson_PersonSearchByName { + get { + return ResourceManager.GetString("UrlPerson_PersonSearchByName", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die http://141.43.76.140/service/sps ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index ef787291..53511539 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -459,4 +459,10 @@ 035569 + + Uebersicht + + + https://www.zv.tu-cottbus.de/CMS-Webservice/Person + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/AddPersonButton.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/AddPersonButton.cs new file mode 100644 index 00000000..6653f038 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/AddPersonButton.cs @@ -0,0 +1,43 @@ +using CampusAppWP8.Resources; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media.Imaging; + +namespace CampusAppWP8.Utility.Lui.Button +{ + public class AddPersonButton : System.Windows.Controls.Button + { + private static BitmapImage icon = new BitmapImage(new Uri(Icons.Add, UriKind.Relative)); + + public AddPersonButton() + : base() + { + this.Content = new Image + { + Source = icon + }; + } + + public static readonly DependencyProperty PersonIdProperty = DependencyProperty.Register("PersonID", typeof(object), typeof(AddPersonButton), new PropertyMetadata(false)); + + + public static readonly DependencyProperty FunctionIndexProperty = DependencyProperty.Register("FunctionIndex", typeof(object), typeof(AddPersonButton), new PropertyMetadata(false)); + + public object PersonId + { + get { return (object)this.GetValue(PersonIdProperty); } + set { this.SetValue(PersonIdProperty, value); } + } + + public object FunctionIndex + { + get { return (object)this.GetValue(FunctionIndexProperty); } + set { this.SetValue(FunctionIndexProperty, value); } + } + } +} From 25f65e4551181fa7fa168b955868e35243396fc5 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 9 Sep 2013 11:26:19 +0200 Subject: [PATCH 3/4] finish personsearch --- .../CampusAppWP8/Api/GeoApi/CampusSpsApi.cs | 6 +- .../Api/Person/PersonSearchApi.cs | 4 +- .../Model/Person/PersonFunctionModel.cs | 1 - .../Model/Person/PersonListModel.cs | 9 +- .../CampusAppWP8/Model/Person/PersonModel.cs | 4 +- .../Departments/DepartmentIndexPage.xaml.cs | 2 +- .../Pages/Events/EventIndexPage.xaml.cs | 2 +- .../CampusAppWP8/Pages/Exams/Exams.xaml.cs | 2 +- .../CampusAppWP8/Pages/Links/LinkPage.xaml.cs | 4 +- .../Pages/Mensa/MensaPage.xaml.cs | 2 +- .../Pages/News/NewsIndexPage.xaml.cs | 2 +- .../Openinghours/OpeninghoursPage.xaml.cs | 2 +- .../CampusAppWP8/Pages/Person/PersonPage.xaml | 31 ++++-- .../Pages/Person/PersonPage.xaml.cs | 96 +++++++++++++------ .../StudentCouncil/StudentCouncilPage.xaml.cs | 2 +- .../Resources/AppResources.Designer.cs | 36 +++++++ .../CampusAppWP8/Resources/AppResources.resx | 12 +++ .../Resources/Constants.Designer.cs | 54 +++++++++++ .../CampusAppWP8/Resources/Constants.resx | 18 ++++ .../CampusAppWP8/Utility/Utilities.cs | 8 +- 20 files changed, 233 insertions(+), 64 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Api/GeoApi/CampusSpsApi.cs b/CampusAppWP8/CampusAppWP8/Api/GeoApi/CampusSpsApi.cs index e008cee8..b6a1eeaf 100644 --- a/CampusAppWP8/CampusAppWP8/Api/GeoApi/CampusSpsApi.cs +++ b/CampusAppWP8/CampusAppWP8/Api/GeoApi/CampusSpsApi.cs @@ -8,13 +8,9 @@ namespace CampusAppWP8.Api.GeoApi { using System; - using System.Collections.Generic; - using CampusAppWP8.Model; using CampusAppWP8.Model.GeoDb; - using CampusAppWP8.Model.Utility; using CampusAppWP8.Resources; - using CampusAppWP8.Utility; - using System.Device.Location; + using CampusAppWP8.Utility; /// /// Class for SPSAPI diff --git a/CampusAppWP8/CampusAppWP8/Api/Person/PersonSearchApi.cs b/CampusAppWP8/CampusAppWP8/Api/Person/PersonSearchApi.cs index 055c6c2d..fbc838e7 100644 --- a/CampusAppWP8/CampusAppWP8/Api/Person/PersonSearchApi.cs +++ b/CampusAppWP8/CampusAppWP8/Api/Person/PersonSearchApi.cs @@ -1,11 +1,11 @@ //----------------------------------------------------------------------------- -// +// // Company copyright tag. // // stubbfel // 05.09.2013 //----------------------------------------------------------------------------- -// + namespace CampusAppWP8.Api.Person { using CampusAppWP8.Model; diff --git a/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs b/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs index 07304ff7..147fbc5d 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs @@ -35,7 +35,6 @@ namespace CampusAppWP8.Model.Person /// The building. private string building; - /// Gets or sets the tel 1. /// The tel 1. [XmlAttribute("telefon")] diff --git a/CampusAppWP8/CampusAppWP8/Model/Person/PersonListModel.cs b/CampusAppWP8/CampusAppWP8/Model/Person/PersonListModel.cs index 2f6dc513..0182d9ce 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Person/PersonListModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Person/PersonListModel.cs @@ -45,6 +45,7 @@ namespace CampusAppWP8.Model.Person return tmpPerson; } } + return null; } @@ -60,18 +61,18 @@ namespace CampusAppWP8.Model.Person /// Stubbfel, 05.09.2013. public void RemoveNonFunctionPerson() { - List rmList = new List(); + List removeList = new List(); foreach (PersonModel tmpPerson in this.Persons) { if (tmpPerson.Functions.Count < 1) { - rmList.Add(tmpPerson); + removeList.Add(tmpPerson); } } - foreach (PersonModel rmPerson in rmList) + foreach (PersonModel removePerson in removeList) { - this.Persons.Remove(rmPerson); + this.Persons.Remove(removePerson); } } } diff --git a/CampusAppWP8/CampusAppWP8/Model/Person/PersonModel.cs b/CampusAppWP8/CampusAppWP8/Model/Person/PersonModel.cs index ef2caedf..a8b51572 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Person/PersonModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Person/PersonModel.cs @@ -39,6 +39,7 @@ namespace CampusAppWP8.Model.Person { return this.id; } + set { if (value != this.id) @@ -115,6 +116,7 @@ namespace CampusAppWP8.Model.Person { return this.functions; } + set { if (value != this.functions) @@ -125,7 +127,7 @@ namespace CampusAppWP8.Model.Person } } - /// Gets the name of a Person ( ). + /// Gets the name of a Person (FirstName SurName). /// The name of a Person. public string FullName { diff --git a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentIndexPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentIndexPage.xaml.cs index de83647e..f71e932e 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentIndexPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentIndexPage.xaml.cs @@ -50,7 +50,7 @@ namespace CampusAppWP8.Pages.Departments DepartmentIndexPage.feed.OnFailedWeb += new DepartmentFeed.OnFailed(this.FeedIsFailedWeb); DepartmentIndexPage.feed.OnFailedFile += new DepartmentFeed.OnFailed(this.FeedIsFailedFile); - DepartmentIndexPage.feed.LoadData(Utilities.getLoadModus()); + DepartmentIndexPage.feed.LoadData(Utilities.GetLoadModus()); if (DepartmentIndexPage.favorite == null) { diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs index be2584e2..b3d55e45 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs @@ -49,7 +49,7 @@ namespace CampusAppWP8.Pages.Events EventIndexPage.eventFeed.OnLoaded += new EventFeed.OnIO(this.SetupEventPageList); EventIndexPage.eventFeed.OnFailedWeb += new EventFeed.OnFailed(this.FeedIsFailedWeb); EventIndexPage.eventFeed.OnFailedFile += new EventFeed.OnFailed(this.FeedIsFailedFile); - EventIndexPage.eventFeed.LoadData(Utilities.getLoadModus()); + EventIndexPage.eventFeed.LoadData(Utilities.GetLoadModus()); } /// diff --git a/CampusAppWP8/CampusAppWP8/Pages/Exams/Exams.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Exams/Exams.xaml.cs index 6bcaebe2..1aaaaa0a 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Exams/Exams.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Exams/Exams.xaml.cs @@ -47,7 +47,7 @@ namespace CampusAppWP8.Pages.Exams } this.ProgressBar.Visibility = System.Windows.Visibility.Visible; - this.feed.LoadData(Utilities.getLoadModus()); + this.feed.LoadData(Utilities.GetLoadModus()); } /// diff --git a/CampusAppWP8/CampusAppWP8/Pages/Links/LinkPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Links/LinkPage.xaml.cs index 4cac9c3a..ed045122 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Links/LinkPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Links/LinkPage.xaml.cs @@ -67,8 +67,8 @@ namespace CampusAppWP8.Pages.Links this.InitializeFeeds(); this.ProgressBar.Visibility = System.Windows.Visibility.Visible; this.loadingFeeds = 2; - this.commonLinkFeed.LoadData(Utilities.getLoadModus()); - this.clubLinkFeed.LoadData(Utilities.getLoadModus()); + this.commonLinkFeed.LoadData(Utilities.GetLoadModus()); + this.clubLinkFeed.LoadData(Utilities.GetLoadModus()); } /// diff --git a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs index 3f777e48..4559285f 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs @@ -177,7 +177,7 @@ namespace CampusAppWP8.Pages.Mensa } else { - this.feed.LoadData(Utilities.getLoadModus()); + this.feed.LoadData(Utilities.GetLoadModus()); } } diff --git a/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs index b48619c2..c46b20d8 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs @@ -49,7 +49,7 @@ namespace CampusAppWP8.Pages.News NewsIndexPage.newsFeed.OnLoaded += new NewsFeed.OnIO(this.SetupNewsPageList); NewsIndexPage.newsFeed.OnFailedWeb += new NewsFeed.OnFailed(this.FeedIsFailWeb); NewsIndexPage.newsFeed.OnFailedFile += new NewsFeed.OnFailed(this.FeedIsFailFile); - NewsIndexPage.newsFeed.LoadData(Utilities.getLoadModus()); + NewsIndexPage.newsFeed.LoadData(Utilities.GetLoadModus()); } /// diff --git a/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml.cs index ab256c91..276189b1 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml.cs @@ -52,7 +52,7 @@ namespace CampusAppWP8.Pages.Openinghours this.feed.OnLoaded += new OpeninghoursFeed.OnIO(this.FeedIsReady); this.feed.OnFailedWeb += new OpeninghoursFeed.OnFailed(this.FeedIsFailedWeb); this.feed.OnFailedFile += new OpeninghoursFeed.OnFailed(this.FeedIsFailedFile); - this.feed.LoadData(Utilities.getLoadModus()); + this.feed.LoadData(Utilities.GetLoadModus()); } this.isNewInstance = true; diff --git a/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml index f0cd53ea..bfc4d4ca 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml @@ -36,7 +36,11 @@ - + + + + + @@ -58,7 +62,7 @@ - + @@ -67,7 +71,7 @@ - + @@ -82,20 +86,29 @@ - + + + + + - + + + + - + + + + + - - - + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs index cc686ab4..1fa324ca 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs @@ -1,31 +1,42 @@ -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; -using CampusAppWP8.Api.Person; -using CampusAppWP8.Model.Utility; -using CampusAppWP8.Utility.Lui.MessageBoxes; -using CampusAppWP8.Resources; -using Microsoft.Phone.Tasks; -using CampusAppWP8.Utility.Lui.Button; -using CampusAppWP8.Model.Person; +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 09.09.2013 +//---------------------------------------------------------------------- namespace CampusAppWP8.Pages.Person { + using System.Collections.Generic; + using System.Windows; + using CampusAppWP8.Api.Person; + using CampusAppWP8.Model.Person; + using CampusAppWP8.Model.Utility; + using CampusAppWP8.Resources; + using CampusAppWP8.Utility.Lui.Button; + using CampusAppWP8.Utility.Lui.MessageBoxes; + using Microsoft.Phone.Controls; + using Microsoft.Phone.Tasks; + + /// Person page. + /// Stubbfel, 09.09.2013. public partial class PersonPage : PhoneApplicationPage { + /// The API. private PersonSearchApi api; + /// Initializes a new instance of the PersonPage class. + /// Stubbfel, 09.09.2013. public PersonPage() { - InitializeComponent(); + this.InitializeComponent(); } + /// Sends a request. + /// Stubbfel, 09.09.2013. + /// Source of the event. + /// Routed event information. private void SendRequest(object sender, RoutedEventArgs e) { string query = this.SearchName.Text.Trim(); @@ -43,51 +54,76 @@ namespace CampusAppWP8.Pages.Person this.api.LoadData(); } + /// Creates URL parameter. + /// Stubbfel, 09.09.2013. + /// The name. + /// The new URL parameter. private List CreateUrlParameter(string name) { List parameterList = new List(); - parameterList.Add(new CleanUrlParamModel("Uebersicht", name)); + parameterList.Add(new CleanUrlParamModel(Constants.ParamPersonList, name)); return parameterList; } + /// API is fail. + /// Stubbfel, 09.09.2013. private void ApiIsFail() { MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoad); this.ProgressBar.Visibility = Visibility.Collapsed; } + /// API is ready. + /// Stubbfel, 09.09.2013. private void ApiIsReady() { this.SetupResultBox(); this.ProgressBar.Visibility = Visibility.Collapsed; } + /// Sets up the result box. + /// Stubbfel, 09.09.2013. private void SetupResultBox() { this.api.Model.RemoveNonFunctionAndSetIdsPerson(); this.ResultBox.ItemsSource = this.api.Model.Persons; } + /// Event handler. Called by Button for click events. + /// Stubbfel, 09.09.2013. + /// Source of the event. + /// Routed event information. private void Button_Click(object sender, RoutedEventArgs e) { AddPersonButton btn = sender as AddPersonButton; + if (btn == null) + { + return; + } + string personID = btn.PersonId as string; - int fIndex = (int)btn.FunctionIndex; + int functionIndex = (int)btn.FunctionIndex; + PersonModel person = this.api.Model.GetPerson(personID); - // int functionIndex = btn.Parent. - SaveContactTask saveContactTask = new SaveContactTask(); + if (person == null) + { + return; + } + + SaveContactTask saveContactTask = new SaveContactTask(); + saveContactTask.FirstName = person.FirstName; saveContactTask.LastName = person.SurName; saveContactTask.Title = person.Akadgrad; - saveContactTask.JobTitle = person.Functions[fIndex].Function; - saveContactTask.Company = "BTU - " + person.Functions[fIndex].Appointment; - saveContactTask.WorkAddressCountry = "De"; - saveContactTask.WorkAddressCity = "Cottbus"; - saveContactTask.WorkAddressState = "Brandenburg"; - saveContactTask.WorkAddressZipCode = "03046"; - saveContactTask.WorkAddressStreet = person.Functions[fIndex].Building; - saveContactTask.WorkPhone = person.Functions[fIndex].Tel1; - saveContactTask.WorkEmail = person.Functions[fIndex].Mail; + saveContactTask.JobTitle = person.Functions[functionIndex].Function; + saveContactTask.Company = Constants.Addr_CBMainCompanyName + " - " + person.Functions[functionIndex].Appointment; + saveContactTask.WorkAddressCountry = Constants.Addr_CBMainCountry; + saveContactTask.WorkAddressCity = Constants.Addr_CBMainCity; + saveContactTask.WorkAddressState = Constants.Addr_CBMainState; + saveContactTask.WorkAddressZipCode = Constants.Addr_CBMainZipCode; + saveContactTask.WorkAddressStreet = person.Functions[functionIndex].Building; + saveContactTask.WorkPhone = person.Functions[functionIndex].Tel1; + saveContactTask.WorkEmail = person.Functions[functionIndex].Mail; saveContactTask.Show(); } diff --git a/CampusAppWP8/CampusAppWP8/Pages/StudentCouncil/StudentCouncilPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StudentCouncil/StudentCouncilPage.xaml.cs index 63523e6f..a1de45c2 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StudentCouncil/StudentCouncilPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/StudentCouncil/StudentCouncilPage.xaml.cs @@ -60,7 +60,7 @@ namespace CampusAppWP8.Pages.StudentCouncil } this.ProgressBar.Visibility = System.Windows.Visibility.Visible; - this.feed.LoadData(Utilities.getLoadModus()); + this.feed.LoadData(Utilities.GetLoadModus()); } /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs index 9cb9bff8..9bbb8d49 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs @@ -699,6 +699,33 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Einrichtung ähnelt. + /// + public static string PersonApp_Appointment { + get { + return ResourceManager.GetString("PersonApp_Appointment", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Sitz ähnelt. + /// + public static string PersonApp_Building { + get { + return ResourceManager.GetString("PersonApp_Building", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Tätigkeit ähnelt. + /// + public static string PersonApp_FunctionName { + get { + return ResourceManager.GetString("PersonApp_FunctionName", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Personensuche ähnelt. /// @@ -708,6 +735,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Nachname ähnelt. + /// + public static string PersonApp_SearchTextLabel { + get { + return ResourceManager.GetString("PersonApp_SearchTextLabel", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Personen ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx index 72626477..8c61fce3 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx @@ -431,4 +431,16 @@ Personen + + Einrichtung + + + Sitz + + + Tätigkeit + + + Nachname + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs index c3ead845..e50aa78f 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs @@ -60,6 +60,51 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Cottbus ähnelt. + /// + public static string Addr_CBMainCity { + get { + return ResourceManager.GetString("Addr_CBMainCity", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die BTU ähnelt. + /// + public static string Addr_CBMainCompanyName { + get { + return ResourceManager.GetString("Addr_CBMainCompanyName", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die De ähnelt. + /// + public static string Addr_CBMainCountry { + get { + return ResourceManager.GetString("Addr_CBMainCountry", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Brandenburg ähnelt. + /// + public static string Addr_CBMainState { + get { + return ResourceManager.GetString("Addr_CBMainState", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die 03046 ähnelt. + /// + public static string Addr_CBMainZipCode { + get { + return ResourceManager.GetString("Addr_CBMainZipCode", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die DevMode ähnelt. /// @@ -564,6 +609,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Uebersicht ähnelt. + /// + public static string ParamPersonList { + get { + return ResourceManager.GetString("ParamPersonList", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die pivotindex ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index 53511539..5710e363 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -465,4 +465,22 @@ https://www.zv.tu-cottbus.de/CMS-Webservice/Person + + Cottbus + + + BTU + + + De + + + Brandenburg + + + 03046 + + + Uebersicht + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs index b5543dd9..0cba0d1f 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs @@ -302,12 +302,13 @@ namespace CampusAppWP8.Utility return true; } } + return false; } - /// Queries if a wifik is available. + /// Queries if a wifi is available. /// Stubbfel, 26.08.2013. - /// true if a wifik is available, false if not. + /// true if a wifi is available, false if not. public static bool IsWifiAvailable() { NetworkInterfaceList networkInterfaceList = new NetworkInterfaceList(); @@ -320,6 +321,7 @@ namespace CampusAppWP8.Utility return true; } } + return false; } @@ -327,7 +329,7 @@ namespace CampusAppWP8.Utility /// Stubbfel, 27.08.2013. /// Generic type parameter. /// The load modus< t> - public static MainModel.ForceType getLoadModus() + public static MainModel.ForceType GetLoadModus() { if (Settings.AppSetting.OnlyWifi && !Settings.AppSetting.WifiEnable) { From 2875d42b2c14ef55fbb17b057ee868af9bf1f8ac Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 9 Sep 2013 11:26:54 +0200 Subject: [PATCH 4/4] update stylecop --- CampusAppWP8/CampusAppWP8/Settings.StyleCop | 1 + 1 file changed, 1 insertion(+) diff --git a/CampusAppWP8/CampusAppWP8/Settings.StyleCop b/CampusAppWP8/CampusAppWP8/Settings.StyleCop index ea0eb655..3ecec60b 100644 --- a/CampusAppWP8/CampusAppWP8/Settings.StyleCop +++ b/CampusAppWP8/CampusAppWP8/Settings.StyleCop @@ -1,6 +1,7 @@ + api enum Stubbfel