Files
win8phoneApp/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureActivity.cs
stubbfel 2f5c104860 add docs
2013-09-18 14:50:32 +02:00

292 lines
7.7 KiB
C#

//-----------------------------------------------------------------------
// <copyright file="LectureActivity.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>13.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.Lecture
{
using System.Collections.ObjectModel;
using System.Xml.Serialization;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
/// <summary>
/// Model for a Activity
/// </summary>
public class LectureActivity
{
#region Members
/// <summary>The activity icon name lecture.</summary>
private const string ActivityIconNameLecture = "Vorlesung";
/// <summary>The activity icon name seminar.</summary>
private const string ActivityIconNameSeminar = "Seminar";
/// <summary>The activity icon name practice.</summary>
private const string ActivityIconNamePract = "Übung";
/// <summary>The activity icon name lab.</summary>
private const string ActivityIconNameLab = "Labor";
/// <summary>The activity icon name exam.</summary>
private const string ActivityIconNameExam = "Prüfung";
/// <summary>
/// List of lecturer
/// </summary>
private ObservableCollection<LectureLecturer> lecturer;
/// <summary>
/// a formatted string for the names of the lecturers
/// </summary>
private string lecturerString;
/// <summary>
/// a formatted string for the names of the courses
/// </summary>
private string courseString;
/// <summary>
/// a formatted string for the topic of the lecture
/// </summary>
private string topic;
/// <summary>URL of the icon.</summary>
private string iconUrl;
#endregion
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="LectureActivity" /> class.
/// </summary>
public LectureActivity()
{
}
#endregion
#region Proberty
/// <summary>
/// Gets or sets the type of the activity
/// </summary>
[XmlElement("art")]
public string Type { get; set; }
/// <summary>
/// Gets or sets the id of the activity
/// </summary>
[XmlAttribute("id")]
public int Id { get; set; }
/// <summary>
/// Gets or sets semester of the activity
/// </summary>
[XmlElement("semester")]
public int Semester { get; set; }
/// <summary>
/// Gets or sets the contact hour
/// </summary>
[XmlElement("sws")]
public string SWS { get; set; }
/// <summary>
/// Gets or sets LectureModule
/// </summary>
[XmlElement("modul")]
public LectureModule Modul { get; set; }
/// <summary>
/// Gets or sets LectureTitle
/// </summary>
[XmlElement("titel")]
public string Title { get; set; }
/// <summary>
/// Gets or sets the lecturers
/// </summary>
[XmlElement("lehrperson")]
public ObservableCollection<LectureLecturer> Lecturer
{
get
{
return this.lecturer;
}
set
{
if (value != this.lecturer)
{
this.lecturer = value;
}
}
}
/// <summary>
/// Gets or sets the formatted string of the lecturers
/// </summary>
public string LecturerString
{
get
{
return this.lecturerString;
}
set
{
if (value != this.lecturerString)
{
this.lecturerString = value;
}
}
}
/// <summary>
/// Gets or sets formatted string of the courses
/// </summary>
public string CourseString
{
get
{
return this.courseString;
}
set
{
if (value != this.courseString)
{
this.courseString = value;
}
}
}
/// <summary>
/// Gets or sets the courses
/// </summary>
[XmlElement("studiengang")]
public ObservableCollection<LectureCourse> Course { get; set; }
/// <summary>
/// Gets or sets the dates of the activity
/// </summary>
[XmlElement("termin")]
public ObservableCollection<LectureDate> Dates { get; set; }
/// <summary>
/// Gets or sets the Department
/// </summary>
[XmlElement("zugeordnete_einrichtung")]
public string Department { get; set; }
/// <summary>
/// Gets or sets the topic of the Lecture
/// </summary>
[XmlElement("lehrinhalt")]
public string Topic
{
get
{
return this.topic;
}
set
{
if (value != this.topic)
{
this.topic = Wp8StringManager.StripAndDecodeHTML(value);
}
}
}
/// <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 public
/// <summary>
/// Method create a formatted string of the LecturerList
/// </summary>
public void CreateLectureString()
{
string result = string.Empty;
foreach (LectureLecturer tmpLecturer in this.Lecturer)
{
result += Wp8StringManager.AddNewLine(tmpLecturer.ToString());
}
this.LecturerString = Wp8StringManager.RemoveNewLine(result);
}
/// <summary>
/// Method create a formatted string of the CourseList
/// </summary>
public void CreateCourseString()
{
string result = string.Empty;
foreach (LectureCourse course in this.Course)
{
result += Wp8StringManager.AddNewLine(course.Title);
}
this.CourseString = Wp8StringManager.RemoveNewLine(result);
}
#endregion
#region private
/// <summary>Creates icon URL.</summary>
/// <remarks>Stubbfel, 12.09.2013.</remarks>
private void CreateIconUrl()
{
string typeStr = this.Type;
if (typeStr.Contains(LectureActivity.ActivityIconNameLecture))
{
this.iconUrl = Icons.Lecture;
}
else if (typeStr.Contains(LectureActivity.ActivityIconNameExam))
{
this.iconUrl = Icons.Exams;
}
else if (typeStr.Contains(LectureActivity.ActivityIconNamePract))
{
this.iconUrl = Icons.Practise;
}
else if (typeStr.Contains(LectureActivity.ActivityIconNameSeminar))
{
this.iconUrl = Icons.Info;
}
else if (typeStr.Contains(LectureActivity.ActivityIconNameLab))
{
this.iconUrl = Icons.Lab;
}
else
{
this.iconUrl = Icons.Info;
}
}
#endregion
#endregion
}
}