fix person bug

This commit is contained in:
stubbfel
2013-10-11 14:35:09 +02:00
parent 874636b5af
commit 4c09ec4139
2 changed files with 26 additions and 32 deletions

View File

@@ -21,10 +21,21 @@ namespace CampusAppWP8.Model.Person
/// <remarks>Stubbfel, 05.09.2013.</remarks>
/// <param name="id">The identifier.</param>
/// <returns>The person.</returns>
public new PersonWp8Model GetPerson(string id)
/// <summary>Gets a person.</summary>
/// <remarks>Stubbfel, 05.09.2013.</remarks>
/// <param name="id">The identifier.</param>
/// <returns>The person.</returns>
public override PersonWp8Model GetPerson(string id)
{
IPersonModel<IPersonFunctionModel> tmpPerson = base.GetPerson(id);
return tmpPerson as PersonWp8Model;
foreach (PersonWp8Model tmpPerson in this.Persons)
{
if (tmpPerson.ID.Equals(id))
{
return tmpPerson;
}
}
return null;
}
@@ -46,5 +57,15 @@ namespace CampusAppWP8.Model.Person
this.Persons.Remove(removePerson);
}
}
/// <summary>Sets person identifier to function.</summary>
/// <remarks>Stubbfel, 05.09.2013.</remarks>
public override void SetPersonIdToFunction()
{
foreach (PersonWp8Model person in this.Persons)
{
person.SetPersonIdToFunction();
}
}
}
}

View File

@@ -31,40 +31,13 @@ namespace CampusAppWPortalLib8.Model.Person
/// <summary>Sets person identifier to function.</summary>
/// <remarks>Stubbfel, 05.09.2013.</remarks>
public void SetPersonIdToFunction()
{
foreach (T item in this.Persons)
{
IPersonModel<IPersonFunctionModel> person = item as IPersonModel<IPersonFunctionModel>;
if (person != null)
{
person.SetPersonIdToFunction();
}
}
}
public abstract void SetPersonIdToFunction();
/// <summary>Gets a person.</summary>
/// <remarks>Stubbfel, 05.09.2013.</remarks>
/// <param name="id">The identifier.</param>
/// <returns>The person.</returns>
public IPersonModel<IPersonFunctionModel> GetPerson(string id)
{
foreach (T item in this.Persons)
{
IPersonModel<IPersonFunctionModel> tmpPerson = item as IPersonModel<IPersonFunctionModel>;
if (tmpPerson == null)
{
continue;
}
if (tmpPerson.ID.Equals(id))
{
return tmpPerson;
}
}
return default(IPersonModel<IPersonFunctionModel>);
}
public abstract T GetPerson(string id);
/// <summary>Removes the non function and set identifiers person.</summary>
/// <remarks>Stubbfel, 05.09.2013.</remarks>