finish#211

This commit is contained in:
stubbfel
2013-10-02 13:27:45 +02:00
parent d9838ddc16
commit 710b4c1e07
6 changed files with 122 additions and 15 deletions

View File

@@ -0,0 +1,79 @@
//-----------------------------------------------------------------------
// <copyright file="LectureWp8Activity.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>13.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.Lecture
{
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Model.Lecture;
/// <summary>
/// Model for a Activity
/// </summary>
public class LectureWp8Activity : LectureActivity
{
#region Members
/// <summary>URL of the icon.</summary>
private string iconUrl;
#endregion
#region Proberty
/// <summary>Gets URL of the icon.</summary>
/// <value>The icon URL.</value>
public string IconUrl
{
get
{
this.CreateIconUrl();
return this.iconUrl;
}
}
#endregion
#region Methods
#region private
/// <summary>Creates icon URL.</summary>
/// <remarks>Stubbfel, 12.09.2013.</remarks>
private void CreateIconUrl()
{
string typeStr = this.Type;
if (typeStr.Contains(CampusAppWPortalLib8.Model.Lecture.LectureActivity.ActivityTypeLecture))
{
this.iconUrl = Icons.Lecture;
}
else if (typeStr.Contains(CampusAppWPortalLib8.Model.Lecture.LectureActivity.ActivityTypeExam))
{
this.iconUrl = Icons.Exams;
}
else if (typeStr.Contains(CampusAppWPortalLib8.Model.Lecture.LectureActivity.ActivityTypePract))
{
this.iconUrl = Icons.Practise;
}
else if (typeStr.Contains(CampusAppWPortalLib8.Model.Lecture.LectureActivity.ActivityTypeSeminar))
{
this.iconUrl = Icons.Seminar;
}
else if (typeStr.Contains(CampusAppWPortalLib8.Model.Lecture.LectureActivity.ActivityTypeLab))
{
this.iconUrl = Icons.Lab;
}
else
{
this.iconUrl = Icons.Info;
}
}
#endregion
#endregion
}
}

View File

@@ -0,0 +1,34 @@
//-----------------------------------------------------------------------
// <copyright file="LectureWp8List.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>10.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.Lecture
{
using System.Linq;
using System.Xml.Serialization;
/// <summary>
/// Model for a List of LectureActivity
/// </summary>
[XmlRoot("lsf_auszug")]
public class LectureWp8List : CampusAppWPortalLib8.Model.Lecture.LectureList<LectureWp8Activity>
{
#region Methods
/// <summary>
/// Method return a certain activity
/// </summary>
/// <param name="id"> id of the activity</param>
/// <returns> the activity (FirstOrDefault)</returns>
public new LectureWp8Activity GetActivity(int id)
{
LectureWp8Activity activity = this.Activities.Where(p => p.Id == id).FirstOrDefault();
return base.GetActivity(id) as LectureWp8Activity;
}
#endregion
}
}

View File

@@ -16,7 +16,7 @@ namespace CampusAppWPortalLib8.Model.Exams
/// <summary>Exam list model.</summary>
/// <remarks>Stubbfel, 02.09.2013.</remarks>
[XmlRoot("links")]
public class ExamListModel<T>
public class ExamListModel<T> where T : ExamModel
{
#region Property
@@ -35,14 +35,8 @@ namespace CampusAppWPortalLib8.Model.Exams
public List<CourseModel> CreateCourseList()
{
List<CourseModel> result = new List<CourseModel>();
foreach (T item in this.Exams)
foreach (T exam in this.Exams)
{
ExamModel exam = item as ExamModel;
if (exam == null)
{
continue;
}
CourseModel tmpModel = new CourseModel(exam.CourseNumber, exam.CourseText);
if (!result.Contains(tmpModel))

View File

@@ -13,7 +13,7 @@ namespace CampusAppWPortalLib8.Model.Person
/// Interface for PersonModel classes
/// </summary>
/// <typeparam name="T">PersonFunctionModel template</typeparam>
public interface IPersonModel<T>
public interface IPersonModel<T> where T : IPersonFunctionModel
{
/// <summary>Gets or sets the functions of a person.</summary>
/// <value>The functions.</value>

View File

@@ -35,7 +35,7 @@ namespace CampusAppWPortalLib8.Model.Person
{
foreach (T item in this.Persons)
{
IPersonModel<T> person = item as IPersonModel<T>;
IPersonModel<IPersonFunctionModel> person = item as IPersonModel<IPersonFunctionModel>;
if (person != null)
{
person.SetPersonIdToFunction();
@@ -47,11 +47,11 @@ namespace CampusAppWPortalLib8.Model.Person
/// <remarks>Stubbfel, 05.09.2013.</remarks>
/// <param name="id">The identifier.</param>
/// <returns>The person.</returns>
public IPersonModel<T> GetPerson(string id)
public IPersonModel<IPersonFunctionModel> GetPerson(string id)
{
foreach (T item in this.Persons)
{
IPersonModel<T> tmpPerson = item as IPersonModel<T>;
IPersonModel<IPersonFunctionModel> tmpPerson = item as IPersonModel<IPersonFunctionModel>;
if (tmpPerson == null)
{
continue;
@@ -63,7 +63,7 @@ namespace CampusAppWPortalLib8.Model.Person
}
}
return default(IPersonModel<T>);
return default(IPersonModel<IPersonFunctionModel>);
}
/// <summary>Removes the non function and set identifiers person.</summary>
@@ -81,7 +81,7 @@ namespace CampusAppWPortalLib8.Model.Person
List<T> removeList = new List<T>();
foreach (T item in this.Persons)
{
IPersonModel<T> tmpPerson = item as IPersonModel<T>;
IPersonModel<IPersonFunctionModel> tmpPerson = item as IPersonModel<IPersonFunctionModel>;
if (tmpPerson == null)
{
continue;

View File

@@ -13,7 +13,7 @@ namespace CampusAppWPortalLib8.Model.Person
/// <summary>Person model.</summary>
/// <remarks>Stubbfel, 05.09.2013.</remarks>
/// <typeparam name="T">template for the PersonFunction-Class</typeparam>
public class PersonModel<T> : IPersonModel<T>
public class PersonModel<T> : IPersonModel<T> where T : IPersonFunctionModel
{
#region Member