diff --git a/CampusAppWP8/CampusAppWP8/Model/Person/PersonListWp8Model.cs b/CampusAppWP8/CampusAppWP8/Model/Person/PersonListWp8Model.cs index 5e64ccdc..eb65095a 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Person/PersonListWp8Model.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Person/PersonListWp8Model.cs @@ -9,59 +9,12 @@ namespace CampusAppWP8.Model.Person { using System.Xml.Serialization; - using CampusAppWPortalLib8.Model.Person; - using System.Collections.Generic; /// Person list model. /// Stubbfel, 05.09.2013. /// [XmlRoot("Uebersicht")] - public class PersonListWp8Model : CampusAppWPortalLib8.Model.Person.PersonListModel + public class PersonListWp8Model : CampusAppWPortalLib8.Model.Person.PersonListModel { - /// Gets a person. - /// Stubbfel, 15.10.2013. - /// The identifier. - /// The person. - public override PersonWp8Model GetPerson(string id) - { - foreach (PersonWp8Model tmpPerson in this.Persons) - { - if (tmpPerson.ID.Equals(id)) - { - return tmpPerson; - } - } - - return null; - } - - /// Removes the non function person. - /// Stubbfel, 05.09.2013. - public override void RemoveNonFunctionPerson() - { - List removeList = new List(); - foreach (PersonWp8Model tmpPerson in this.Persons) - { - if (tmpPerson.Functions.Count < 1) - { - removeList.Add(tmpPerson); - } - } - - foreach (PersonWp8Model removePerson in removeList) - { - this.Persons.Remove(removePerson); - } - } - - /// Sets person identifier to function. - /// Stubbfel, 05.09.2013. - public override void SetPersonIdToFunction() - { - foreach (PersonWp8Model person in this.Persons) - { - person.SetPersonIdToFunction(); - } - } } } diff --git a/CampusAppWP8/CampusAppWP8/Model/Person/PersonWp8Model.cs b/CampusAppWP8/CampusAppWP8/Model/Person/PersonWp8Model.cs index ccc49410..a8de6168 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Person/PersonWp8Model.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Person/PersonWp8Model.cs @@ -11,8 +11,8 @@ namespace CampusAppWP8.Model.Person using System.Xml.Serialization; using CampusAppWP8.Utility; - /// Person model. - /// Stubbfel, 05.09.2013. + /// A data Model for the person . + /// Stubbfel, 21.10.2013. /// public class PersonWp8Model : CampusAppWPortalLib8.Model.Person.PersonModel { diff --git a/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs index 886c8239..6f23a2c7 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs @@ -132,15 +132,16 @@ namespace CampusAppWP8.Pages.Person saveContactTask.FirstName = person.FirstName; saveContactTask.LastName = person.SurName; saveContactTask.Title = person.Akadgrad; - saveContactTask.JobTitle = person.Functions[functionIndex].Function; - saveContactTask.Company = Constants.Addr_CBMainCompanyName + " - " + person.Functions[functionIndex].Appointment; + PersonFunctionWp8Model personFunction = person.Functions[functionIndex]; + saveContactTask.JobTitle = personFunction.Function; + saveContactTask.Company = Constants.Addr_CBMainCompanyName + " - " + personFunction.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.WorkAddressStreet = personFunction.Building; + saveContactTask.WorkPhone = personFunction.Tel; + saveContactTask.WorkEmail = personFunction.Mail; saveContactTask.Show(); } diff --git a/CampusAppWP8/CampusAppWP8/SubmissionInfo/720p_lecture.png b/CampusAppWP8/CampusAppWP8/SubmissionInfo/720p_lecture.png index 3bf8548b..3be6b815 100644 Binary files a/CampusAppWP8/CampusAppWP8/SubmissionInfo/720p_lecture.png and b/CampusAppWP8/CampusAppWP8/SubmissionInfo/720p_lecture.png differ diff --git a/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj b/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj index dea60ce8..166b9581 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj +++ b/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj @@ -53,8 +53,6 @@ - - diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Person/IPersonFunctionModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Person/IPersonFunctionModel.cs deleted file mode 100644 index 243896e1..00000000 --- a/CampusAppWP8/CampusAppWPortalLib8/Model/Person/IPersonFunctionModel.cs +++ /dev/null @@ -1,23 +0,0 @@ -//----------------------------------------------------------------------- -// -// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. -// -// Stubbfel -// 15.10.2013 -// Declares the IPersonFunctionModel interface -//----------------------------------------------------------------------- -namespace CampusAppWPortalLib8.Model.Person -{ - /// Interface for PersonFunctionModel classes. - /// Stubbfel, 15.10.2013. - public interface IPersonFunctionModel - { - /// Gets or sets the identifier of the person. - /// The identifier of the person. - string PersonID { get; set; } - - /// Gets or sets zero-based index of the function. - /// The function index. - int FunctionIndex { get; set; } - } -} diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Person/IPersonModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Person/IPersonModel.cs deleted file mode 100644 index 0456bd45..00000000 --- a/CampusAppWP8/CampusAppWPortalLib8/Model/Person/IPersonModel.cs +++ /dev/null @@ -1,30 +0,0 @@ -//----------------------------------------------------------------------- -// -// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. -// -// Stubbfel -// 15.10.2013 -// Declares the IPersonModel interface -//----------------------------------------------------------------------- -namespace CampusAppWPortalLib8.Model.Person -{ - using System.Collections.ObjectModel; - - /// Interface for PersonModel classes. - /// Stubbfel, 15.10.2013. - /// PersonFunctionModel template. - public interface IPersonModel where T : IPersonFunctionModel - { - /// Gets or sets the functions of a person. - /// The functions. - ObservableCollection Functions { get; set; } - - /// Gets or sets the identifier. - /// The identifier. - string ID { get; set; } - - /// Sets person identifier to function. - /// Stubbfel, 05.09.2013. - void SetPersonIdToFunction(); - } -} diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Person/PersonFunctionModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Person/PersonFunctionModel.cs index 52163d12..2daef138 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/Model/Person/PersonFunctionModel.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Person/PersonFunctionModel.cs @@ -14,7 +14,7 @@ namespace CampusAppWPortalLib8.Model.Person /// Person function model. /// Stubbfel, 05.09.2013. /// - public class PersonFunctionModel : IPersonFunctionModel + public class PersonFunctionModel { #region Member @@ -62,6 +62,19 @@ namespace CampusAppWPortalLib8.Model.Person } } + public string Tel + { + get + { + return this.Tel1; + } + + set + { + this.Tel1 = value; + } + } + /// Gets or sets the tel 2. /// The tel 2. [XmlAttribute("telefon2")] diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Person/PersonListModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Person/PersonListModel.cs index c42361fd..15ecb134 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/Model/Person/PersonListModel.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Person/PersonListModel.cs @@ -12,11 +12,14 @@ namespace CampusAppWPortalLib8.Model.Person using System.Collections.ObjectModel; using System.Xml.Serialization; - /// Person list model. - /// Stubbfel, 05.09.2013. - /// personModel template. + /// A data Model for the person list. + /// Stubbfel, 21.10.2013. + /// Generic type parameter (PersonModel). + /// Generic type parameter (PersonFunctionModel). [XmlRoot("Uebersicht")] - public abstract class PersonListModel + public abstract class PersonListModel + where V : PersonFunctionModel + where T : PersonModel { #region Property @@ -29,15 +32,22 @@ namespace CampusAppWPortalLib8.Model.Person #region Method - /// Sets person identifier to function. - /// Stubbfel, 05.09.2013. - public abstract void SetPersonIdToFunction(); - /// Gets a person. /// Stubbfel, 05.09.2013. /// The identifier. /// The person. - public abstract T GetPerson(string id); + public T GetPerson(string id) + { + foreach (T tmpPerson in this.Persons) + { + if (tmpPerson.ID.Equals(id)) + { + return tmpPerson; + } + } + + return default(T); + } /// Removes the non function and set identifiers person. /// Stubbfel, 05.09.2013. @@ -49,8 +59,33 @@ namespace CampusAppWPortalLib8.Model.Person /// Removes the non function person. /// Stubbfel, 05.09.2013. - public abstract void RemoveNonFunctionPerson(); - + public void RemoveNonFunctionPerson() + { + List removeList = new List(); + foreach (T tmpPerson in this.Persons) + { + if (tmpPerson.Functions.Count < 1) + { + removeList.Add(tmpPerson); + } + } + + foreach (T removePerson in removeList) + { + this.Persons.Remove(removePerson); + } + } + + /// Sets person identifier to function. + /// Stubbfel, 05.09.2013. + public void SetPersonIdToFunction() + { + foreach (T person in this.Persons) + { + person.SetPersonIdToFunction(); + } + } + #endregion } } diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Person/PersonModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Person/PersonModel.cs index a7fa8f93..7aa164a9 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/Model/Person/PersonModel.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Person/PersonModel.cs @@ -12,9 +12,9 @@ namespace CampusAppWPortalLib8.Model.Person using System.Xml.Serialization; /// A data Model for the person. - /// Stubbfel, 15.10.2013. - /// - public class PersonModel : IPersonModel where T : IPersonFunctionModel + /// Stubbfel, 21.10.2013. + /// Generic type parameter (PersonFunctionModel). + public class PersonModel where T : PersonFunctionModel { #region Member @@ -158,14 +158,10 @@ namespace CampusAppWPortalLib8.Model.Person } int index = 0; - foreach (T item in this.functions) + foreach (PersonFunctionModel function in this.functions) { - IPersonFunctionModel function = item as IPersonFunctionModel; - if (function != null) - { - function.PersonID = this.ID; - function.FunctionIndex = index++; - } + function.PersonID = this.ID; + function.FunctionIndex = index++; } }