Files
win8phoneApp/CampusAppWP8/CampusAppWPortalLib8/Model/Lecture/LectureActivity.cs
2013-11-19 14:18:29 +01:00

240 lines
7.2 KiB
C#

//-----------------------------------------------------------------------
// <copyright file="LectureActivity.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Stubbfel</author>
// <date>15.10.2013</date>
// <summary>Implements the lecture activity class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Model.Lecture
{
using System.Collections.ObjectModel;
using System.Xml.Serialization;
using CampusAppWPortalLib8.Resources;
using CampusAppWPortalLib8.Utility;
/// <summary> Model for a Activity. </summary>
/// <remarks> Stubbfel, 15.10.2013. </remarks>
public class LectureActivity
{
#region Members
/// <summary> The activity icon name lecture. </summary>
public const string ActivityTypeLecture = "Vorlesung";
/// <summary> The activity icon name seminar. </summary>
public const string ActivityTypeSeminar = "Seminar";
/// <summary> The activity icon name practice. </summary>
public const string ActivityTypePract = "Übung";
/// <summary> The activity icon name lab. </summary>
public const string ActivityTypeLab = "Labor";
/// <summary> The activity icon name exam. </summary>
public const string ActivityTypeExam = "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;
#endregion
#region Constructor
/// <summary> Initializes a new instance of the <see cref="LectureActivity" /> class. </summary>
/// <remarks> Stubbfel, 15.10.2013. </remarks>
public LectureActivity()
{
}
#endregion
#region Proberty
/// <summary> Gets or sets the type of the activity. </summary>
/// <value> The type. </value>
[XmlElement("art")]
public string Type { get; set; }
/// <summary> Gets or sets the id of the activity. </summary>
/// <value> The identifier. </value>
[XmlAttribute("id")]
public int Id { get; set; }
/// <summary> Gets or sets semester of the activity. </summary>
/// <value> The semester. </value>
[XmlElement("semester")]
public int Semester { get; set; }
/// <summary> Gets or sets the contact hour. </summary>
/// <value> The sws. </value>
[XmlElement("sws")]
public string SWS { get; set; }
/// <summary> Gets or sets LectureModule. </summary>
/// <value> The modul. </value>
[XmlElement("modul")]
public LectureModule Modul { get; set; }
/// <summary> Gets or sets LectureTitle. </summary>
/// <value> The title. </value>
[XmlElement("titel")]
public string Title { get; set; }
/// <summary> Gets or sets the lecturers. </summary>
/// <value> The lecturer. </value>
[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>
/// <value> The lecturer string. </value>
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>
/// <value> The course string. </value>
public string CourseString
{
get
{
return this.courseString;
}
set
{
if (value != this.courseString)
{
this.courseString = value;
}
}
}
/// <summary> Gets or sets the courses. </summary>
/// <value> The course. </value>
[XmlElement("studiengang")]
public ObservableCollection<LectureCourse> Course { get; set; }
/// <summary> Gets or sets the dates of the activity. </summary>
/// <value> The dates. </value>
[XmlElement("termin")]
public ObservableCollection<LectureDate> Dates { get; set; }
/// <summary> Gets or sets the Department. </summary>
/// <value> The department. </value>
[XmlElement("zugeordnete_einrichtung")]
public string Department { get; set; }
/// <summary> Gets or sets the topic of the Lecture. </summary>
/// <value> The topic. </value>
[XmlElement("lehrinhalt")]
public string Topic
{
get
{
return this.topic;
}
set
{
if (value != this.topic)
{
this.topic = value;
}
}
}
#endregion
#region Methods
#region public
/// <summary> Method create a formatted string of the LecturerList. </summary>
/// <remarks> Stubbfel, 15.10.2013. </remarks>
public void CreateLectureString()
{
string result = string.Empty;
foreach (LectureLecturer tmpLecturer in this.Lecturer)
{
result += DefaultStringManager.AddNewLine(tmpLecturer.ToString());
}
this.LecturerString = DefaultStringManager.RemoveNewLine(result);
}
/// <summary> Method create a formatted string of the CourseList. </summary>
/// <remarks> Stubbfel, 15.10.2013. </remarks>
public void CreateCourseString()
{
string result = string.Empty;
foreach (LectureCourse course in this.Course)
{
result += DefaultStringManager.AddNewLine(course.Title);
}
this.CourseString = DefaultStringManager.RemoveNewLine(result);
}
/// <summary> Gets a date. </summary>
/// <remarks> Stubbfel, 19.11.2013. </remarks>
/// <param name="id"> The identifier. </param>
/// <returns> The date. </returns>
public LectureDate GetDate(string id)
{
if (this.Dates == null || id == null)
{
return null;
}
foreach (LectureDate date in this.Dates)
{
if (id.Equals(date.Id))
{
return date;
}
}
return null;
}
#endregion
#endregion
}
}