diff --git a/CampusAppWP8/CampusAppDLL/CampusAppDLL.csproj b/CampusAppWP8/CampusAppDLL/CampusAppDLL.csproj new file mode 100644 index 00000000..d039f9d6 --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/CampusAppDLL.csproj @@ -0,0 +1,65 @@ + + + + + Debug + AnyCPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303} + Library + Properties + CampusAppDLL + CampusAppDLL + v4.0 + 512 + Client + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppDLL/Model/Campusmap/CBMainMapModel.cs b/CampusAppWP8/CampusAppDLL/Model/Campusmap/CBMainMapModel.cs new file mode 100644 index 00000000..9f6684a4 --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Model/Campusmap/CBMainMapModel.cs @@ -0,0 +1,45 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 13.08.2013 +//----------------------------------------------------------------------------- +using CampusAppDLL.Model.GeoDb; +using CampusAppDLL.Utility; + +namespace CampusAppDLL.Model.Campusmap +{ + + /// + /// Class for the MapModel of the mainCampus of cottbus + /// + public class CBMainMapModel : MapModel + { + /// Variable for the identify of the campus. + private static readonly string Campus = "1"; + + /// + /// Initializes a new instance of the class. + /// + public CBMainMapModel(string xmlFilePath) : base(xmlFilePath) + { + } + + /// Loads the spatial./. + /// Stubbfel, 19.08.2013. + protected override void LoadSpatials(string xmlFilePath) + { + SpsModel model = XmlManager.DeserializationFileToModel(xmlFilePath); + + this.Spatial = new SpsModel(); + foreach (PlaceModel place in model.Places) + { + if (Campus.Equals(place.ParentId) || Campus.Equals(place.PlaceId)) + { + this.Spatial.Places.Add(place); + } + } + } + } +} diff --git a/CampusAppWP8/CampusAppDLL/Model/Campusmap/MapModel.cs b/CampusAppWP8/CampusAppDLL/Model/Campusmap/MapModel.cs new file mode 100644 index 00000000..50edaf3c --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Model/Campusmap/MapModel.cs @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 24.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppDLL.Model.Campusmap +{ + using CampusAppDLL.Model.GeoDb; + using System; + + /// + /// This Class manage the properties of a Map + /// + public class MapModel + { + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public MapModel(string xmlFilePath) + { + this.LoadSpatials(xmlFilePath); + } + + #endregion + + #region Property + + /// Gets or sets the spatial of the map. + /// The spatial. + public SpsModel Spatial { get; set; } + + #endregion + + #region Methods + + /// Loads the spatial./ + /// Stubbfel, 19.08.2013. + protected virtual void LoadSpatials(string xmlFilePath) + { + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceInformation.cs b/CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceInformation.cs new file mode 100644 index 00000000..f23d4124 --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceInformation.cs @@ -0,0 +1,26 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 19.08.2013 +//---------------------------------------------------------------------- +namespace CampusAppDLL.Model.GeoDb +{ + using System.Xml.Serialization; + + /// Information about the place. + /// Stubbfel, 19.08.2013. + public class PlaceInformation + { + /// Gets or sets the name of the information. + /// The name of the information. + [XmlElement("placeInformationName")] + public string InformationName { get; set; } + + /// Gets or sets the information value. + /// The information value. + [XmlText] + public string InformationValue { get; set; } + } +} diff --git a/CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceModel.cs b/CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceModel.cs new file mode 100644 index 00000000..8e0a0d20 --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceModel.cs @@ -0,0 +1,47 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 08.08.2013 +//---------------------------------------------------------------------- + +namespace CampusAppDLL.Model.GeoDb +{ + using System.Collections.ObjectModel; + using System.Xml.Serialization; + + /// + /// Model for a place of the SPSService + /// + public class PlaceModel + { + /// + /// Gets or sets the placeId + /// + [XmlAttribute("id")] + public string PlaceId { get; set; } + + /// + /// Gets or sets the id of the "parent" of a place + /// + [XmlAttribute("parentId")] + public string ParentId { get; set; } + + /// + /// Gets or sets the ReferencePoint of a place + /// + [XmlAttribute("refpoint")] + public string RefPoint { get; set; } + + /// Gets or sets the information. + /// The information. + [XmlElement("placeInformation")] + public ObservableCollection Informations { get; set; } + + /// Gets or sets the services. + /// The services. + [XmlElement("placeService")] + public ObservableCollection Services { get; set; } + } +} diff --git a/CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceService.cs b/CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceService.cs new file mode 100644 index 00000000..7e17403c --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Model/GeoDb/PlaceService.cs @@ -0,0 +1,32 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 19.08.2013 +//----------------------------------------------------------------------------- + +namespace CampusAppDLL.Model.GeoDb +{ + using System.Xml.Serialization; + + /// Place service. + /// Stubbfel, 19.08.2013. + public class PlaceService + { + /// Gets or sets the name of the service. + /// The name of the service. + [XmlAttribute("placeServiceName")] + public string ServiceName { get; set; } + + /// Gets or sets the SAP of an service. + /// The sap. + [XmlElement("sap")] + public string SAP { get; set; } + + /// Gets or sets the request for a place. + /// The request. + [XmlElement("request")] + public string Request { get; set; } + } +} diff --git a/CampusAppWP8/CampusAppDLL/Model/GeoDb/SpsModel.cs b/CampusAppWP8/CampusAppDLL/Model/GeoDb/SpsModel.cs new file mode 100644 index 00000000..4fa4bb86 --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Model/GeoDb/SpsModel.cs @@ -0,0 +1,87 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 08.08.2013 +//---------------------------------------------------------------------- + +namespace CampusAppDLL.Model.GeoDb +{ + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Linq; + using System.Xml.Serialization; + + /// + /// Model for a xml-response of the SPSService + /// + [XmlRoot("root")] + public class SpsModel + { + /// Initializes a new instance of the SpsModel class. + /// Stubbfel, 20.08.2013. + public SpsModel() + { + this.Places = new ObservableCollection(); + } + + /// + /// Gets or sets a list of places + /// + [XmlElement("place")] + public ObservableCollection Places { get; set; } + + /// Gets places by information. + /// Stubbfel, 19.08.2013. + /// The query. + /// (Optional) the ignore cases. + /// (Optional) name of the information. + /// The places by information. + public List GetPlacesByInformation(string query, bool ignoreCases = true, string informationName = null) + { + string querryLow = string.Empty; + IEnumerable resultplaces = null; + + // select correct statement + if (ignoreCases && informationName == null) + { + querryLow = query.ToLower(); + resultplaces = from place in this.Places + from info in place.Informations + where info.InformationValue.ToLower().Contains(querryLow) + select place; + } + else if (ignoreCases && informationName != null) + { + querryLow = query.ToLower(); + resultplaces = from place in this.Places + from info in place.Informations + where info.InformationValue.ToLower().Contains(querryLow) && info.InformationName.Equals(informationName) + select place; + } + else if (!ignoreCases && informationName == null) + { + resultplaces = from place in this.Places + from info in place.Informations + where info.InformationValue.Contains(querryLow) + select place; + } + else if (!ignoreCases && informationName != null) + { + resultplaces = from place in this.Places + from info in place.Informations + where info.InformationValue.Contains(querryLow) && info.InformationName.Equals(informationName) + select place; + } + + // null assert + if (resultplaces == null) + { + return null; + } + + return resultplaces.ToList(); + } + } +} diff --git a/CampusAppWP8/CampusAppDLL/Properties/AssemblyInfo.cs b/CampusAppWP8/CampusAppDLL/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..7597545e --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die mit einer Assembly verknüpft sind. +[assembly: AssemblyTitle("CampusAppDLL")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CampusAppDLL")] +[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar +// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von +// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("883d352f-0864-47db-8a04-f5eee0800a6d")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern +// übernehmen, indem Sie "*" eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/CampusAppWP8/CampusAppDLL/Utility/Logger.cs b/CampusAppWP8/CampusAppDLL/Utility/Logger.cs new file mode 100644 index 00000000..a3ca7f02 --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Utility/Logger.cs @@ -0,0 +1,35 @@ +//-------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 03.05.2013 +//---------------------------------------------------------------------- +namespace CampusAppDLL.Utility +{ + using System; + + /// + /// This Class creates logs for the app + /// + public class Logger + { + /// + /// Method log a Exception + /// + /// exception which has to log + public static void LogException(Exception exception) + { + // Console.WriteLine(exception); + } + + /// + /// Log a message. + /// + /// to be logged message + public static void LogMsg(string msg) + { + // Console.WriteLine(msg); + } + } +} diff --git a/CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFMessage.cs b/CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFMessage.cs new file mode 100644 index 00000000..30a9fd4d --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFMessage.cs @@ -0,0 +1,154 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 21.08.2013 +//---------------------------------------------------------------------- +namespace CampusAppDLL.Utility.NDEF +{ + using System.Collections.Generic; + using System.IO; + + /// Ndef message. + /// Stubbfel, 21.08.2013. + public class NDEFMessage + { + #region Members + + /// The records. + private List records; + + #endregion + + #region constructors + + /// Initializes a new instance of the NDEFMessage class. + /// Stubbfel, 21.08.2013. + /// The content. + /// The type. + /// (Optional) the tnf. + public NDEFMessage(string content, TYPEVAL type, NDEFRecord.TNFVAL tnf = NDEFRecord.TNFVAL.WKT) + { + this.records = new List(); + float recordsCount = (float)content.Length / NDEFRecord.MaxRecordPayLoad; + NDEFRecord tmpRecord = null; + string praefix = NDEFMessage.GetPraefix(type); + + for (int i = 0; recordsCount > 0; i++) + { + tmpRecord = new NDEFShortRecord(); + tmpRecord.Type = type; + tmpRecord.TNF = tnf; + tmpRecord.PayloadPraefix = praefix; + int recordsize = 255; + if (content.Length < (i + 1) * recordsize) + { + recordsize = content.Length - (i * recordsize); + } + + tmpRecord.Payload = content.Substring(i * 255, recordsize); + if (i == 0) + { + tmpRecord.MB = NDEFRecord.NDEFFlags.MBSET; + } + + this.records.Add(tmpRecord); + recordsCount--; + } + + this.records[this.records.IndexOf(tmpRecord)].ME = NDEFRecord.NDEFFlags.MESET; + } + + /// Initializes a new instance of the NDEFMessage class. + /// Stubbfel, 21.08.2013. + /// The array. + public NDEFMessage(byte[] array) + { + this.records = new List(); + + NDEFRecord tmpRecord = null; + for (int i = 0; i < array.Length; i += tmpRecord.RecordSize) + { + tmpRecord = new NDEFShortRecord(array, i); + + this.records.Add(tmpRecord); + } + } + + #endregion + + #region enum + + /// Values that represent TYPEVAL. + /// Stubbfel, 21.08.2013. + public enum TYPEVAL + { + /// An enum constant representing the empty option. + EMPTY = 0x00, + + /// An enum constant representing the URL option. + URL = 0x55, + + /// An enum constant representing the text option. + TEXT = 0x54, + } + + #endregion + + #region Methods + /// Gets a praefix. + /// Stubbfel, 21.08.2013. + /// The type. + /// The praefix. + public static string GetPraefix(TYPEVAL type) + { + string praefix = string.Empty; + + switch (type) + { + case TYPEVAL.TEXT: + praefix = "\x02" + "de"; + break; + case TYPEVAL.URL: + praefix = "\x01"; + break; + default: + break; + } + + return praefix; + } + + /// Gets the content. + /// Stubbfel, 21.08.2013. + /// The content. + public string GetContent() + { + string result = string.Empty; + + foreach (NDEFRecord record in this.records) + { + result += record.Payload; + } + + return result; + } + + /// Converts this object to a byte array. + /// Stubbfel, 21.08.2013. + /// This object as a byte[]. + public byte[] ToByteArray() + { + MemoryStream ms = new MemoryStream(); + foreach (NDEFRecord record in this.records) + { + ms.Write(record.ToByteArray(), 0, record.RecordSize); + } + + return ms.ToArray(); + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFRecord.cs b/CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFRecord.cs new file mode 100644 index 00000000..ca7e1fc5 --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFRecord.cs @@ -0,0 +1,188 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 21.08.2013 +//---------------------------------------------------------------------- +namespace CampusAppDLL.Utility.NDEF +{ + using System.IO; + using System.Text; + + /// Ndef record of a NDEFMessage. + /// Stubbfel, 21.08.2013. + public abstract class NDEFRecord + { + #region Members + + /// The maximum record pay load. + public const int MaxRecordPayLoad = 255; + + /// Size of the type. + protected const byte TypeSize = 0x01; + + #endregion + + #region Constructors + /// Initializes a new instance of the NDEFRecord class. + /// Stubbfel, 21.08.2013. + public NDEFRecord() + { + } + + /// Initializes a new instance of the NDEFRecord class. + /// Stubbfel, 21.08.2013. + /// The array. + /// (Optional) zero-based index of the. + public NDEFRecord(byte[] array, int index = 0) + { + this.FormatFlags = array[index]; + } + + #endregion + + #region enum + + /// Values that represent NDEFFlags. + /// Stubbfel, 21.08.2013. + public enum NDEFFlags + { + /// An Enum constant representing the UNSET option. + UNSET = 0x00, + + /// An Enum constant representing the Message begin option. + MBSET = 0x80, + + /// An Enum constant representing the Message end option. + MESET = 0x40, + + /// An Enum constant representing the CHUNK FLAG option. + CFSET = 0x20, + + /// An Enum constant representing the Short Record set option. + SRSET = 0x10, + + /// An Enum constant representing the ID length option. + ILSET = 0x08, + + /// An enum constant representing the tnfset option. + TNFSET = 0x03 + } + + /// Values that represent TNFVAL. + /// Stubbfel, 21.08.2013. + public enum TNFVAL + { + /// An enum constant representing the empty option. + EMPTY = 0x00, + + /// An enum constant representing the Well-Know-Type option. + WKT = 0x01, + + /// An enum constant representing the MediaType option. + MEDIATYPE = 0x02, + + /// An enum constant representing the URI option. + URI = 0x03, + + /// An enum constant representing the NFCE option. + NFCE = 0x04, + + /// An enum constant representing the unknow option. + unknow = 0x05, + + /// An enum constant representing the unchanged option. + UNCHANGED = 0x06, + + /// An enum constant representing the reserved option. + RESERVED = 0x07 + } + + #endregion + + #region Properties + /// Gets or sets the MBFlag. + /// The MBFlag. + public NDEFFlags MB { get; set; } + + /// Gets or sets MEFlag. + /// The MEFlag . + public NDEFFlags ME { get; set; } + + /// Gets or sets the CFFlag. + /// The CFFlag. + public NDEFFlags CF { get; set; } + + /// Gets or sets the SRFlag. + /// The SRFlag. + public NDEFFlags SR { get; set; } + + /// Gets or sets the ILFlag. + /// The ILFlag. + public NDEFFlags IL { get; set; } + + /// Gets or sets the TNFField. + /// The TNFField. + public TNFVAL TNF { get; set; } + + /// Gets or sets the type. + /// The type. + public NDEFMessage.TYPEVAL Type { get; set; } + + /// Gets or sets the format flags. + /// The format flags. + public byte FormatFlags + { + get + { + return (byte)((byte)this.TNF | ((byte)this.MB) | ((byte)this.ME) | ((byte)this.CF) | ((byte)this.SR) | ((byte)this.IL)); + } + + protected set + { + this.TNF = (TNFVAL)(value & (byte)NDEFFlags.TNFSET); + this.MB = (NDEFFlags)(value & (byte)NDEFFlags.MBSET); + this.ME = (NDEFFlags)(value & (byte)NDEFFlags.MESET); + this.CF = (NDEFFlags)(value & (byte)NDEFFlags.CFSET); + this.SR = (NDEFFlags)(value & (byte)NDEFFlags.SRSET); + this.IL = (NDEFFlags)(value & (byte)NDEFFlags.ILSET); + } + } + + /// Gets or sets the payload. + /// The payload. + public string Payload { get; set; } + + /// Gets the size of the record. + /// The size of the record. + public int RecordSize + { + get + { + return this.HeaderSize + this.Payload.Length + this.PayloadPraefix.Length; + } + } + + /// Gets or sets the payload praefix. + /// The payload praefix. + public string PayloadPraefix { get; set; } + + /// Gets or sets the size of the header. + /// The size of the header. + protected int HeaderSize { get; set; } + + #endregion + + #region Methods + + /// Converts the record to a byte array. + /// Stubbfel, 21.08.2013. + /// This object as a byte[]. + public abstract byte[] ToByteArray(); + + #endregion + } +} + +// End of Utility\NDEF\NDEFRecord.cs diff --git a/CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFShortRecord.cs b/CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFShortRecord.cs new file mode 100644 index 00000000..bb108ddd --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Utility/NDEF/NDEFShortRecord.cs @@ -0,0 +1,63 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 21.08.2013 +//---------------------------------------------------------------------- +namespace CampusAppDLL.Utility.NDEF +{ + using System.Text; + + /// Ndef short record. + /// Stubbfel, 21.08.2013. + public class NDEFShortRecord : NDEFRecord + { + /// Initializes a new instance of the NDEFShortRecord class. + /// Stubbfel, 21.08.2013. + public NDEFShortRecord() + { + this.HeaderSize = 4; + this.SR = NDEFFlags.SRSET; + this.IL = NDEFFlags.UNSET; + this.CF = NDEFFlags.UNSET; + } + + /// Initializes a new instance of the NDEFShortRecord class. + /// Stubbfel, 21.08.2013. + /// The array. + /// (Optional) zero-based index of the. + public NDEFShortRecord(byte[] array, int index = 0) + : base(array) + { + this.HeaderSize = 4; + this.Type = (NDEFMessage.TYPEVAL)array[index + 3]; + this.PayloadPraefix = NDEFMessage.GetPraefix(this.Type); + int payLoadSize = array[index + 2] - this.PayloadPraefix.Length; + this.Payload = Encoding.UTF8.GetString(array, index + this.HeaderSize + this.PayloadPraefix.Length, payLoadSize); + } + + /// Converts this NDEFShortRecord to a byte array. + /// Stubbfel, 21.08.2013. + /// This object as a byte[]. + public override byte[] ToByteArray() + { + byte[] payloadAr = Encoding.UTF8.GetBytes(this.PayloadPraefix + this.Payload); + byte[] array = new byte[payloadAr.Length + this.HeaderSize]; + + array[0] = this.FormatFlags; + array[1] = NDEFRecord.TypeSize; + array[2] = (byte)(Payload.Length + this.PayloadPraefix.Length); + array[3] = (byte)this.Type; + + int i = this.HeaderSize; + foreach (byte b in payloadAr) + { + array[i] = b; + i++; + } + + return array; + } + } +} diff --git a/CampusAppWP8/CampusAppDLL/Utility/StringManager.cs b/CampusAppWP8/CampusAppDLL/Utility/StringManager.cs new file mode 100644 index 00000000..ff708949 --- /dev/null +++ b/CampusAppWP8/CampusAppDLL/Utility/StringManager.cs @@ -0,0 +1,59 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 06.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppDLL.Utility +{ + using System.Text.RegularExpressions; + + /// + /// Class provides some special StringMethods + /// + public static class StringManager + { + #region Members + + /// + /// Patter for Html-Tags + /// + private static readonly string HtmlTagPattern = "<.*?>"; + + #endregion + + #region Methods + + /// + /// Method removes Html-Tag of a String + /// + /// String with Html-Tags + /// String without Html-Tags + public static string StripHTML(string inputString) + { + return Regex.Replace(inputString, HtmlTagPattern, string.Empty); + } + + /// + /// Method add an Newline to a string + /// + /// input string + /// input string + newline + public static string AddNewLine(string str) + { + return str.ToString() + "\n"; + } + + /// + /// Method remove(TrimEND!) an Newline to a string + /// + /// input string + /// input string - newline +// Company copyright tag. +// +// stubbfel +// 18.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppDLL.Utility +{ + using System.IO; + using System.Xml.Linq; + using System.Xml.Serialization; + + /// + /// Class provides some Xml-methods + /// + public class XmlManager + { + /// + /// Method deserialization a string to a Model + /// + /// the model + /// the XmlString + /// name of the RootTag + /// return the deserialization of the model + public static T DeserializationToModel(string xmlString, string validRootName) + { + XmlSerializer serializer = new XmlSerializer(typeof(T)); + XDocument document = XDocument.Parse(xmlString); + if (!document.Root.Name.ToString().Equals(validRootName)) + { + XElement content = document.Root; + document = new XDocument(); + document.Add(new XElement(validRootName, content)); + } + + T model = (T)serializer.Deserialize(document.CreateReader()); + return model; + } + + /// Deserialization a xml file to a model. + /// Stubbfel, 20.08.2013. + /// Generic type parameter. + /// Path to the a XmlFile. + /// model of the XmlFile. + public static T DeserializationFileToModel(string xmlFilePath) + { + XmlSerializer serializer = new XmlSerializer(typeof(T)); + XDocument document = XDocument.Load(xmlFilePath); + T model = (T)serializer.Deserialize(document.CreateReader()); + return model; + } + + /// + /// Method serializes a model to a string. + /// + /// type of the model + /// model object + /// serialized string + public static string SerializationToString(T model) + { + string retValue = string.Empty; + + XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); + ns.Add(string.Empty, string.Empty); + + XmlSerializer serializer = new XmlSerializer(typeof(T)); + TextWriter writer = new StringWriter(); + + serializer.Serialize(writer, model, ns); + + retValue = writer.ToString(); + + if (retValue.StartsWith(""); + retValue = retValue.Substring(endTag + 2); + + if (retValue.StartsWith("\r\n") == true) + { + retValue = retValue.Substring(2); + } + } + + return retValue; + } + } +} diff --git a/CampusAppWP8/CampusAppW8.sln b/CampusAppWP8/CampusAppW8.sln index 97cdc60d..f65bd6ee 100644 --- a/CampusAppWP8/CampusAppW8.sln +++ b/CampusAppWP8/CampusAppW8.sln @@ -9,14 +9,20 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CampusAppWPortalLib8", "Cam EndProject Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "IconCreator", "IconCreator\IconCreator.pyproj", "{78E8DC22-F4E1-42D9-BA04-93EA031C630C}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CampusAppDLL", "CampusAppDLL\CampusAppDLL.csproj", "{E4EC5B95-06FC-4304-97E2-9E3F9B980303}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|ARM = Debug|ARM + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU Release|ARM = Release|ARM + Release|Mixed Platforms = Release|Mixed Platforms + Release|Win32 = Release|Win32 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection @@ -27,6 +33,12 @@ Global {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|ARM.ActiveCfg = Debug|ARM {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|ARM.Build.0 = Debug|ARM {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|ARM.Deploy.0 = Debug|ARM + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|Mixed Platforms.Deploy.0 = Debug|Any CPU + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|Win32.ActiveCfg = Debug|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|Win32.Build.0 = Debug|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|Win32.Deploy.0 = Debug|x86 {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|x64.ActiveCfg = Debug|Any CPU {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|x86.ActiveCfg = Debug|x86 {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|x86.Build.0 = Debug|x86 @@ -37,6 +49,12 @@ Global {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|ARM.ActiveCfg = Release|ARM {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|ARM.Build.0 = Release|ARM {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|ARM.Deploy.0 = Release|ARM + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|Mixed Platforms.Build.0 = Release|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|Mixed Platforms.Deploy.0 = Release|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|Win32.ActiveCfg = Release|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|Win32.Build.0 = Release|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|Win32.Deploy.0 = Release|x86 {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|x64.ActiveCfg = Release|Any CPU {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|x86.ActiveCfg = Release|x86 {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|x86.Build.0 = Release|x86 @@ -47,6 +65,12 @@ Global {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|ARM.ActiveCfg = Debug|ARM {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|ARM.Build.0 = Debug|ARM {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|ARM.Deploy.0 = Debug|ARM + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|Mixed Platforms.Deploy.0 = Debug|Any CPU + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|Win32.ActiveCfg = Debug|x86 + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|Win32.Build.0 = Debug|x86 + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|Win32.Deploy.0 = Debug|x86 {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|x64.ActiveCfg = Debug|x64 {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|x64.Build.0 = Debug|x64 {E49420AA-3023-42EF-8255-67B1F5E52B43}.Debug|x64.Deploy.0 = Debug|x64 @@ -59,6 +83,12 @@ Global {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|ARM.ActiveCfg = Release|ARM {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|ARM.Build.0 = Release|ARM {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|ARM.Deploy.0 = Release|ARM + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|Mixed Platforms.Build.0 = Release|x86 + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|Mixed Platforms.Deploy.0 = Release|x86 + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|Win32.ActiveCfg = Release|x86 + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|Win32.Build.0 = Release|x86 + {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|Win32.Deploy.0 = Release|x86 {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|x64.ActiveCfg = Release|x64 {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|x64.Build.0 = Release|x64 {E49420AA-3023-42EF-8255-67B1F5E52B43}.Release|x64.Deploy.0 = Release|x64 @@ -68,21 +98,47 @@ Global {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Debug|Any CPU.Build.0 = Debug|Any CPU {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Debug|ARM.ActiveCfg = Debug|Any CPU + {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Debug|Win32.ActiveCfg = Debug|Any CPU {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Debug|x64.ActiveCfg = Debug|Any CPU {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Debug|x86.ActiveCfg = Debug|Any CPU {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Release|Any CPU.ActiveCfg = Release|Any CPU {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Release|Any CPU.Build.0 = Release|Any CPU {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Release|ARM.ActiveCfg = Release|Any CPU + {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Release|Win32.ActiveCfg = Release|Any CPU {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Release|x64.ActiveCfg = Release|Any CPU {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}.Release|x86.ActiveCfg = Release|Any CPU {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Debug|ARM.ActiveCfg = Debug|Any CPU + {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Debug|Win32.ActiveCfg = Debug|Any CPU {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Debug|x64.ActiveCfg = Debug|Any CPU {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Debug|x86.ActiveCfg = Debug|Any CPU {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Release|Any CPU.ActiveCfg = Release|Any CPU {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Release|ARM.ActiveCfg = Release|Any CPU + {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Release|Win32.ActiveCfg = Release|Any CPU {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Release|x64.ActiveCfg = Release|Any CPU {78E8DC22-F4E1-42D9-BA04-93EA031C630C}.Release|x86.ActiveCfg = Release|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Debug|ARM.ActiveCfg = Debug|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Debug|Win32.ActiveCfg = Debug|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Debug|x64.ActiveCfg = Debug|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Debug|x86.ActiveCfg = Debug|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Release|Any CPU.Build.0 = Release|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Release|ARM.ActiveCfg = Release|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Release|Win32.ActiveCfg = Release|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Release|x64.ActiveCfg = Release|Any CPU + {E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CampusAppWP8/CampusAppWP8/Api/GeoApi/CampusSpsApi.cs b/CampusAppWP8/CampusAppWP8/Api/GeoApi/CampusSpsApi.cs index 3502c684..b6a1eeaf 100644 --- a/CampusAppWP8/CampusAppWP8/Api/GeoApi/CampusSpsApi.cs +++ b/CampusAppWP8/CampusAppWP8/Api/GeoApi/CampusSpsApi.cs @@ -5,16 +5,12 @@ // stubbfel // 12.08.2013 //---------------------------------------------------------------------- -namespace CampusAppWP8.Feed.GeoApi +namespace CampusAppWP8.Api.GeoApi { using System; - using System.Collections.Generic; - using CampusAppWP8.Model; using CampusAppWP8.Model.GeoDb; - using CampusAppWP8.Model.Utility; using CampusAppWP8.Resources; - using CampusAppWP8.Utility; - using System.Device.Location; + using CampusAppWP8.Utility; /// /// Class for SPSAPI diff --git a/CampusAppWP8/CampusAppWP8/Api/GeoApi/SpsApi.cs b/CampusAppWP8/CampusAppWP8/Api/GeoApi/SpsApi.cs index 7972517f..3bef6f90 100644 --- a/CampusAppWP8/CampusAppWP8/Api/GeoApi/SpsApi.cs +++ b/CampusAppWP8/CampusAppWP8/Api/GeoApi/SpsApi.cs @@ -5,7 +5,7 @@ // stubbfel // 06.08.2013 //---------------------------------------------------------------------- -namespace CampusAppWP8.Feed.GeoApi +namespace CampusAppWP8.Api.GeoApi { using System; using System.Collections.Generic; diff --git a/CampusAppWP8/CampusAppWP8/Api/Lecture/LectureApi.cs b/CampusAppWP8/CampusAppWP8/Api/Lecture/LectureApi.cs index da60d1a9..96ce98a2 100644 --- a/CampusAppWP8/CampusAppWP8/Api/Lecture/LectureApi.cs +++ b/CampusAppWP8/CampusAppWP8/Api/Lecture/LectureApi.cs @@ -5,7 +5,7 @@ // stubbfel // 13.06.2013 //---------------------------------------------------------------------- -namespace CampusAppWP8.Feed.Lecture +namespace CampusAppWP8.Api.Lecture { using CampusAppWP8.Model; using CampusAppWP8.Model.Lecture; diff --git a/CampusAppWP8/CampusAppWP8/Api/Person/PersonSearchApi.cs b/CampusAppWP8/CampusAppWP8/Api/Person/PersonSearchApi.cs new file mode 100644 index 00000000..fbc838e7 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Api/Person/PersonSearchApi.cs @@ -0,0 +1,27 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 05.09.2013 +//----------------------------------------------------------------------------- + +namespace CampusAppWP8.Api.Person +{ + using CampusAppWP8.Model; + using CampusAppWP8.Model.Person; + using CampusAppWP8.Resources; + + /// Person search api. + /// Stubbfel, 05.09.2013. + public class PersonSearchApi : XmlModel + { + /// Initializes a new instance of the PersonSearchApi class. + /// Stubbfel, 05.09.2013. + public PersonSearchApi() + : base(ModelType.Feed, Constants.UrlPerson_PersonSearchByName) + { + this.ValidRootName = Constants.PersonListValidRootName; + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/person_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/person_159.png new file mode 100644 index 00000000..c2163d6f Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/person_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/person_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/person_159.png new file mode 100644 index 00000000..c9bd664b Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/person_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 8c591a6c..a6d11552 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -95,6 +95,7 @@ + App.xaml @@ -118,6 +119,9 @@ + + + @@ -127,6 +131,10 @@ Exams.xaml + + PersonPage.xaml + + @@ -351,6 +359,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -411,6 +423,7 @@ + @@ -437,6 +450,7 @@ + diff --git a/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs b/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs new file mode 100644 index 00000000..147fbc5d --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Person/PersonFunctionModel.cs @@ -0,0 +1,179 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 05.09.2013 +//----------------------------------------------------------------------------- +namespace CampusAppWP8.Model.Person +{ + using System.Xml.Serialization; + using CampusAppWP8.Utility; + + /// Person function model. + /// Stubbfel, 05.09.2013. + public class PersonFunctionModel + { + /// The first tel. + private string tel1; + + /// The second tel. + private string tel2; + + /// The fax. + private string fax; + + /// The mail. + private string mail; + + /// The function. + private string function; + + /// The appointment. + private string appointment; + + /// The building. + private string building; + + /// Gets or sets the tel 1. + /// The tel 1. + [XmlAttribute("telefon")] + public string Tel1 + { + get + { + return this.tel1; + } + + set + { + if (value != null && value != string.Empty && value != this.tel1) + { + this.tel1 = StringManager.CreateUniTelefonNumber(value); + } + } + } + + /// Gets or sets the tel 2. + /// The tel 2. + [XmlAttribute("telefon2")] + public string Tel2 + { + get + { + return this.tel2; + } + + set + { + if (value != null && value != string.Empty && value != this.tel2) + { + this.tel2 = StringManager.CreateUniTelefonNumber(value); + } + } + } + + /// Gets or sets the fax. + /// The fax. + [XmlAttribute("fax")] + public string Fax + { + get + { + return this.fax; + } + + set + { + if (value != null && value != string.Empty && value != this.fax) + { + this.fax = StringManager.CreateUniTelefonNumber(value); + } + } + } + + /// Gets or sets the function. + /// The function. + [XmlAttribute("funktion")] + public string Function + { + get + { + return this.function; + } + + set + { + if (value != this.function) + { + this.function = StringManager.StripHTML(value); + } + } + } + + /// Gets or sets the appointment. + /// The appointment. + [XmlAttribute("einrichtung")] + public string Appointment + { + get + { + return this.appointment; + } + + set + { + if (value != this.appointment) + { + this.appointment = StringManager.StripHTML(value); + } + } + } + + /// Gets or sets the building. + /// The building. + [XmlAttribute("gebaeude")] + public string Building + { + get + { + return this.building; + } + + set + { + if (value != this.building) + { + this.building = StringManager.StripHTML(value); + } + } + } + + /// Gets or sets the mail. + /// The mail. + [XmlAttribute("mail")] + public string Mail + { + get + { + return this.mail; + } + + set + { + if (value != null && value != this.mail && StringManager.IsValidEmail(value)) + { + this.mail = value; + } + } + } + + /// Gets or sets the identifier of the person. + /// The identifier of the person. + public string PersonID { get; set; } + + /// Gets or sets zero-based index of the function. + /// The function index. + public int FunctionIndex { get; set; } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Person/PersonListModel.cs b/CampusAppWP8/CampusAppWP8/Model/Person/PersonListModel.cs new file mode 100644 index 00000000..0182d9ce --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Person/PersonListModel.cs @@ -0,0 +1,79 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 05.09.2013 +//----------------------------------------------------------------------------- + +namespace CampusAppWP8.Model.Person +{ + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Xml.Serialization; + + /// Person list model. + /// Stubbfel, 05.09.2013. + [XmlRoot("Uebersicht")] + public class PersonListModel + { + /// Gets or sets the persons. + /// The persons. + [XmlElement("person")] + public ObservableCollection Persons { get; set; } + + /// Sets person identifier to function. + /// Stubbfel, 05.09.2013. + public void SetPersonIdToFunction() + { + foreach (PersonModel person in this.Persons) + { + person.SetPersonIdToFunction(); + } + } + + /// Gets a person. + /// Stubbfel, 05.09.2013. + /// The identifier. + /// The person. + public PersonModel GetPerson(string id) + { + foreach (PersonModel tmpPerson in this.Persons) + { + if (tmpPerson.ID.Equals(id)) + { + return tmpPerson; + } + } + + return null; + } + + /// Removes the non function and set identifiers person. + /// Stubbfel, 05.09.2013. + public void RemoveNonFunctionAndSetIdsPerson() + { + this.RemoveNonFunctionPerson(); + this.SetPersonIdToFunction(); + } + + /// Removes the non function person. + /// Stubbfel, 05.09.2013. + public void RemoveNonFunctionPerson() + { + List removeList = new List(); + foreach (PersonModel tmpPerson in this.Persons) + { + if (tmpPerson.Functions.Count < 1) + { + removeList.Add(tmpPerson); + } + } + + foreach (PersonModel removePerson in removeList) + { + this.Persons.Remove(removePerson); + } + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Person/PersonModel.cs b/CampusAppWP8/CampusAppWP8/Model/Person/PersonModel.cs new file mode 100644 index 00000000..a8b51572 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Person/PersonModel.cs @@ -0,0 +1,157 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 05.09.2013 +//----------------------------------------------------------------------------- +namespace CampusAppWP8.Model.Person +{ + using System.Collections.ObjectModel; + using System.Xml.Serialization; + using CampusAppWP8.Utility; + + /// Person model. + /// Stubbfel, 05.09.2013. + public class PersonModel + { + /// The akadgrad. + private string akadgrad; + + /// Name of the sur. + private string surName; + + /// The person's first name. + private string firstName; + + /// The identifier. + private string id; + + /// The functions. + private ObservableCollection functions; + + /// Gets or sets the identifier. + /// The identifier. + [XmlAttribute("id")] + public string ID + { + get + { + return this.id; + } + + set + { + if (value != this.id) + { + this.id = value; + this.SetPersonIdToFunction(); + } + } + } + + /// Gets or sets the akadgrad. + /// The akadgrad. + [XmlAttribute("akadgrad")] + public string Akadgrad + { + get + { + return this.akadgrad; + } + + set + { + if (value != this.akadgrad) + { + this.akadgrad = StringManager.StripHTML(value); + } + } + } + + /// Gets or sets the name of the sur. + /// The name of the sur. + [XmlAttribute("nachname")] + public string SurName + { + get + { + return this.surName; + } + + set + { + if (value != this.surName) + { + this.surName = StringManager.StripHTML(value); + } + } + } + + /// Gets or sets the person's first name. + /// The name of the first. + [XmlAttribute("vorname")] + public string FirstName + { + get + { + return this.firstName; + } + + set + { + if (value != this.firstName) + { + this.firstName = StringManager.StripHTML(value); + } + } + } + + /// Gets or sets the functions of a person. + /// The functions. + [XmlElement("funktion")] + public ObservableCollection Functions + { + get + { + return this.functions; + } + + set + { + if (value != this.functions) + { + this.functions = value; + this.SetPersonIdToFunction(); + } + } + } + + /// Gets the name of a Person (FirstName SurName). + /// The name of a Person. + public string FullName + { + get + { + return this.Akadgrad + " " + this.FirstName + " " + this.SurName; + } + } + + /// Sets person identifier to function. + /// Stubbfel, 05.09.2013. + public void SetPersonIdToFunction() + { + if (this.id == null || this.id.Equals(string.Empty) || this.functions == null) + { + return; + } + + int index = 0; + foreach (PersonFunctionModel function in this.functions) + { + function.PersonID = this.ID; + function.FunctionIndex = index++; + } + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml index cf91d39f..bc93963e 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml @@ -51,7 +51,7 @@ --> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs new file mode 100644 index 00000000..1fa324ca --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs @@ -0,0 +1,131 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 09.09.2013 +//---------------------------------------------------------------------- + +namespace CampusAppWP8.Pages.Person +{ + using System.Collections.Generic; + using System.Windows; + using CampusAppWP8.Api.Person; + using CampusAppWP8.Model.Person; + using CampusAppWP8.Model.Utility; + using CampusAppWP8.Resources; + using CampusAppWP8.Utility.Lui.Button; + using CampusAppWP8.Utility.Lui.MessageBoxes; + using Microsoft.Phone.Controls; + using Microsoft.Phone.Tasks; + + /// Person page. + /// Stubbfel, 09.09.2013. + public partial class PersonPage : PhoneApplicationPage + { + /// The API. + private PersonSearchApi api; + + /// Initializes a new instance of the PersonPage class. + /// Stubbfel, 09.09.2013. + public PersonPage() + { + this.InitializeComponent(); + } + + /// Sends a request. + /// Stubbfel, 09.09.2013. + /// Source of the event. + /// Routed event information. + private void SendRequest(object sender, RoutedEventArgs e) + { + string query = this.SearchName.Text.Trim(); + if (query.Equals(string.Empty)) + { + return; + } + + this.api = new PersonSearchApi(); + this.api.OnLoaded += new PersonSearchApi.OnIO(this.ApiIsReady); + this.api.OnFailedLoad += new PersonSearchApi.OnFailed(this.ApiIsFail); + this.ProgressBar.Visibility = System.Windows.Visibility.Visible; + List parameterList = this.CreateUrlParameter(query); + this.api.SetUriParams(parameterList); + this.api.LoadData(); + } + + /// Creates URL parameter. + /// Stubbfel, 09.09.2013. + /// The name. + /// The new URL parameter. + private List CreateUrlParameter(string name) + { + List parameterList = new List(); + parameterList.Add(new CleanUrlParamModel(Constants.ParamPersonList, name)); + return parameterList; + } + + /// API is fail. + /// Stubbfel, 09.09.2013. + private void ApiIsFail() + { + MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoad); + this.ProgressBar.Visibility = Visibility.Collapsed; + } + + /// API is ready. + /// Stubbfel, 09.09.2013. + private void ApiIsReady() + { + this.SetupResultBox(); + this.ProgressBar.Visibility = Visibility.Collapsed; + } + + /// Sets up the result box. + /// Stubbfel, 09.09.2013. + private void SetupResultBox() + { + this.api.Model.RemoveNonFunctionAndSetIdsPerson(); + this.ResultBox.ItemsSource = this.api.Model.Persons; + } + + /// Event handler. Called by Button for click events. + /// Stubbfel, 09.09.2013. + /// Source of the event. + /// Routed event information. + private void Button_Click(object sender, RoutedEventArgs e) + { + AddPersonButton btn = sender as AddPersonButton; + if (btn == null) + { + return; + } + + string personID = btn.PersonId as string; + int functionIndex = (int)btn.FunctionIndex; + + PersonModel person = this.api.Model.GetPerson(personID); + if (person == null) + { + return; + } + + SaveContactTask saveContactTask = new SaveContactTask(); + + 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; + 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.Show(); + } + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml index 99e5cc03..4ec8dd6e 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml @@ -174,6 +174,13 @@ + + + + + + + diff --git a/CampusAppWP8/CampusAppWP8/Pages/StudentCouncil/StudentCouncilPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StudentCouncil/StudentCouncilPage.xaml.cs index 63523e6f..a1de45c2 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StudentCouncil/StudentCouncilPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/StudentCouncil/StudentCouncilPage.xaml.cs @@ -60,7 +60,7 @@ namespace CampusAppWP8.Pages.StudentCouncil } this.ProgressBar.Visibility = System.Windows.Visibility.Visible; - this.feed.LoadData(Utilities.getLoadModus()); + this.feed.LoadData(Utilities.GetLoadModus()); } /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs index 86a670dd..9bbb8d49 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs @@ -699,6 +699,60 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Einrichtung ähnelt. + /// + public static string PersonApp_Appointment { + get { + return ResourceManager.GetString("PersonApp_Appointment", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Sitz ähnelt. + /// + public static string PersonApp_Building { + get { + return ResourceManager.GetString("PersonApp_Building", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Tätigkeit ähnelt. + /// + public static string PersonApp_FunctionName { + get { + return ResourceManager.GetString("PersonApp_FunctionName", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Personensuche ähnelt. + /// + public static string PersonApp_Header { + get { + return ResourceManager.GetString("PersonApp_Header", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Nachname ähnelt. + /// + public static string PersonApp_SearchTextLabel { + get { + return ResourceManager.GetString("PersonApp_SearchTextLabel", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Personen ähnelt. + /// + public static string PersonApp_Title { + get { + return ResourceManager.GetString("PersonApp_Title", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Die primäre Kamera steht nicht zur Verfügung. ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx index 43dcd186..8c61fce3 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx @@ -425,4 +425,22 @@ Prüfungsordnungen + + Personensuche + + + Personen + + + Einrichtung + + + Sitz + + + Tätigkeit + + + Nachname + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs index ca04fe9e..e50aa78f 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs @@ -60,6 +60,51 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Cottbus ähnelt. + /// + public static string Addr_CBMainCity { + get { + return ResourceManager.GetString("Addr_CBMainCity", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die BTU ähnelt. + /// + public static string Addr_CBMainCompanyName { + get { + return ResourceManager.GetString("Addr_CBMainCompanyName", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die De ähnelt. + /// + public static string Addr_CBMainCountry { + get { + return ResourceManager.GetString("Addr_CBMainCountry", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Brandenburg ähnelt. + /// + public static string Addr_CBMainState { + get { + return ResourceManager.GetString("Addr_CBMainState", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die 03046 ähnelt. + /// + public static string Addr_CBMainZipCode { + get { + return ResourceManager.GetString("Addr_CBMainZipCode", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die DevMode ähnelt. /// @@ -132,6 +177,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die +49 ähnelt. + /// + public static string DeTelPrefix { + get { + return ResourceManager.GetString("DeTelPrefix", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die ExamsPage.LastPivotIndex ähnelt. /// @@ -555,6 +609,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Uebersicht ähnelt. + /// + public static string ParamPersonList { + get { + return ResourceManager.GetString("ParamPersonList", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die pivotindex ähnelt. /// @@ -735,6 +798,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Person/PersonPage.xaml ähnelt. + /// + public static string PathPerson_Person { + get { + return ResourceManager.GetString("PathPerson_Person", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Setting/AppSettingPage.xaml ähnelt. /// @@ -762,6 +834,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Uebersicht ähnelt. + /// + public static string PersonListValidRootName { + get { + return ResourceManager.GetString("PersonListValidRootName", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die [+-]{0,1}[0-9]+[.,]{0,1}[0-9]+[\s][+-]{0,1}[0-9]+[.,]{0,1}[0-9]+ ähnelt. /// @@ -834,6 +915,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die 035569 ähnelt. + /// + public static string UniCBTelPrefix { + get { + return ResourceManager.GetString("UniCBTelPrefix", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/professorships.xml ähnelt. /// @@ -951,6 +1041,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die https://www.zv.tu-cottbus.de/CMS-Webservice/Person ähnelt. + /// + public static string UrlPerson_PersonSearchByName { + get { + return ResourceManager.GetString("UrlPerson_PersonSearchByName", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die http://141.43.76.140/service/sps ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index 827f5f98..5710e363 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -450,4 +450,37 @@ ExamsPage.LastPivotIndex + + /Pages/Person/PersonPage.xaml + + + +49 + + + 035569 + + + Uebersicht + + + https://www.zv.tu-cottbus.de/CMS-Webservice/Person + + + Cottbus + + + BTU + + + De + + + Brandenburg + + + 03046 + + + Uebersicht + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Icons.cs b/CampusAppWP8/CampusAppWP8/Resources/Icons.cs index d381d0e4..b52d7047 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Icons.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Icons.cs @@ -242,6 +242,17 @@ namespace CampusAppWP8.Resources } } + /// + /// Gets the uri string of the Person icon. + /// + public static string Person + { + get + { + return Themerize("person_159.png"); + } + } + /// /// Gets the uri string of the Phone icon. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/Icons.resx b/CampusAppWP8/CampusAppWP8/Resources/Icons.resx index 4a349994..1cdc52f7 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Icons.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Icons.resx @@ -177,6 +177,9 @@ openhours_159.png + + person_159.png + phone_159.png diff --git a/CampusAppWP8/CampusAppWP8/Settings.StyleCop b/CampusAppWP8/CampusAppWP8/Settings.StyleCop index ea0eb655..3ecec60b 100644 --- a/CampusAppWP8/CampusAppWP8/Settings.StyleCop +++ b/CampusAppWP8/CampusAppWP8/Settings.StyleCop @@ -1,6 +1,7 @@ + api enum Stubbfel diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/AddPersonButton.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/AddPersonButton.cs new file mode 100644 index 00000000..6653f038 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/AddPersonButton.cs @@ -0,0 +1,43 @@ +using CampusAppWP8.Resources; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media.Imaging; + +namespace CampusAppWP8.Utility.Lui.Button +{ + public class AddPersonButton : System.Windows.Controls.Button + { + private static BitmapImage icon = new BitmapImage(new Uri(Icons.Add, UriKind.Relative)); + + public AddPersonButton() + : base() + { + this.Content = new Image + { + Source = icon + }; + } + + public static readonly DependencyProperty PersonIdProperty = DependencyProperty.Register("PersonID", typeof(object), typeof(AddPersonButton), new PropertyMetadata(false)); + + + public static readonly DependencyProperty FunctionIndexProperty = DependencyProperty.Register("FunctionIndex", typeof(object), typeof(AddPersonButton), new PropertyMetadata(false)); + + public object PersonId + { + get { return (object)this.GetValue(PersonIdProperty); } + set { this.SetValue(PersonIdProperty, value); } + } + + public object FunctionIndex + { + get { return (object)this.GetValue(FunctionIndexProperty); } + set { this.SetValue(FunctionIndexProperty, value); } + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Utility/StringManager.cs b/CampusAppWP8/CampusAppWP8/Utility/StringManager.cs index 2181dd89..4c8b93d9 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/StringManager.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/StringManager.cs @@ -7,6 +7,8 @@ //---------------------------------------------------------------------- namespace CampusAppWP8.Utility { + using CampusAppWP8.Resources; + using System; using System.Text.RegularExpressions; /// @@ -55,6 +57,48 @@ namespace CampusAppWP8.Utility { return str.TrimEnd('\n'); } + + /// Query if 'strIn' is valid email. + /// Stubbfel, 04.09.2013. + /// The in. + /// true if valid email, false if not. + public static bool IsValidEmail(string strIn) + { + // Return true if strIn is in valid e-mail format. + try + { + return Regex.IsMatch(strIn, + @"^(?("")(""[^""]+?""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))" + + @"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9]{2,17}))$", + RegexOptions.IgnoreCase); + } + catch (Exception) + { + return false; + } + } + + /// Creates uni telefon number. + /// Stubbfel, 04.09.2013. + /// The input. + /// The new uni telefon number. + public static string CreateUniTelefonNumber(string input) + { + string result = null; + if (input.Length < 5) + { + result = Constants.UniCBTelPrefix + input.TrimStart('0'); + } + else + { + result = input; + } + + Regex regexObj = new Regex(@"[^\d]"); + result = regexObj.Replace(result.TrimStart('0'), ""); + result = Constants.DeTelPrefix + result; + return result; + } #endregion } } diff --git a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs index b5543dd9..0cba0d1f 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs @@ -302,12 +302,13 @@ namespace CampusAppWP8.Utility return true; } } + return false; } - /// Queries if a wifik is available. + /// Queries if a wifi is available. /// Stubbfel, 26.08.2013. - /// true if a wifik is available, false if not. + /// true if a wifi is available, false if not. public static bool IsWifiAvailable() { NetworkInterfaceList networkInterfaceList = new NetworkInterfaceList(); @@ -320,6 +321,7 @@ namespace CampusAppWP8.Utility return true; } } + return false; } @@ -327,7 +329,7 @@ namespace CampusAppWP8.Utility /// Stubbfel, 27.08.2013. /// Generic type parameter. /// The load modus< t> - public static MainModel.ForceType getLoadModus() + public static MainModel.ForceType GetLoadModus() { if (Settings.AppSetting.OnlyWifi && !Settings.AppSetting.WifiEnable) { diff --git a/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj b/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj index 4c60064b..8d9e3e15 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj +++ b/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj @@ -33,6 +33,12 @@ 4 + + + + + + diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Campusmap/CBMainMapModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Campusmap/CBMainMapModel.cs new file mode 100644 index 00000000..7645723a --- /dev/null +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Campusmap/CBMainMapModel.cs @@ -0,0 +1,45 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 13.08.2013 +//----------------------------------------------------------------------------- +using CampusAppWPortalLib8.Model.GeoDb; +using CampusAppWPortalLib8.Utility; + +namespace CampusAppWPortalLib8.Model.Campusmap +{ + + /// + /// Class for the MapModel of the mainCampus of cottbus + /// + public class CBMainMapModel : MapModel + { + /// Variable for the identify of the campus. + private static readonly string Campus = "1"; + + /// + /// Initializes a new instance of the class. + /// + public CBMainMapModel(string xmlFilePath) : base(xmlFilePath) + { + } + + /// Loads the spatial./. + /// Stubbfel, 19.08.2013. + protected override void LoadSpatials(string xmlFilePath) + { + SpsModel model = XmlManager.DeserializationFileToModel(xmlFilePath); + + this.Spatial = new SpsModel(); + foreach (PlaceModel place in model.Places) + { + if (Campus.Equals(place.ParentId) || Campus.Equals(place.PlaceId)) + { + this.Spatial.Places.Add(place); + } + } + } + } +} diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Campusmap/MapModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Campusmap/MapModel.cs new file mode 100644 index 00000000..75448b7b --- /dev/null +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Campusmap/MapModel.cs @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 24.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWPortalLib8.Model.Campusmap +{ + using CampusAppWPortalLib8.Model.GeoDb; + using System; + + /// + /// This Class manage the properties of a Map + /// + public class MapModel + { + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public MapModel(string xmlFilePath) + { + this.LoadSpatials(xmlFilePath); + } + + #endregion + + #region Property + + /// Gets or sets the spatial of the map. + /// The spatial. + public SpsModel Spatial { get; set; } + + #endregion + + #region Methods + + /// Loads the spatial./ + /// Stubbfel, 19.08.2013. + protected virtual void LoadSpatials(string xmlFilePath) + { + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceInformation.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceInformation.cs new file mode 100644 index 00000000..4768712b --- /dev/null +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceInformation.cs @@ -0,0 +1,26 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 19.08.2013 +//---------------------------------------------------------------------- +namespace CampusAppWPortalLib8.Model.GeoDb +{ + using System.Xml.Serialization; + + /// Information about the place. + /// Stubbfel, 19.08.2013. + public class PlaceInformation + { + /// Gets or sets the name of the information. + /// The name of the information. + [XmlElement("placeInformationName")] + public string InformationName { get; set; } + + /// Gets or sets the information value. + /// The information value. + [XmlText] + public string InformationValue { get; set; } + } +} diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceModel.cs new file mode 100644 index 00000000..3b048ee8 --- /dev/null +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceModel.cs @@ -0,0 +1,47 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 08.08.2013 +//---------------------------------------------------------------------- + +namespace CampusAppWPortalLib8.Model.GeoDb +{ + using System.Collections.ObjectModel; + using System.Xml.Serialization; + + /// + /// Model for a place of the SPSService + /// + public class PlaceModel + { + /// + /// Gets or sets the placeId + /// + [XmlAttribute("id")] + public string PlaceId { get; set; } + + /// + /// Gets or sets the id of the "parent" of a place + /// + [XmlAttribute("parentId")] + public string ParentId { get; set; } + + /// + /// Gets or sets the ReferencePoint of a place + /// + [XmlAttribute("refpoint")] + public string RefPoint { get; set; } + + /// Gets or sets the information. + /// The information. + [XmlElement("placeInformation")] + public ObservableCollection Informations { get; set; } + + /// Gets or sets the services. + /// The services. + [XmlElement("placeService")] + public ObservableCollection Services { get; set; } + } +} diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceService.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceService.cs new file mode 100644 index 00000000..8a5f5bf8 --- /dev/null +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceService.cs @@ -0,0 +1,32 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 19.08.2013 +//----------------------------------------------------------------------------- + +namespace CampusAppWPortalLib8.Model.GeoDb +{ + using System.Xml.Serialization; + + /// Place service. + /// Stubbfel, 19.08.2013. + public class PlaceService + { + /// Gets or sets the name of the service. + /// The name of the service. + [XmlAttribute("placeServiceName")] + public string ServiceName { get; set; } + + /// Gets or sets the SAP of an service. + /// The sap. + [XmlElement("sap")] + public string SAP { get; set; } + + /// Gets or sets the request for a place. + /// The request. + [XmlElement("request")] + public string Request { get; set; } + } +} diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/SpsModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/SpsModel.cs new file mode 100644 index 00000000..378d7e90 --- /dev/null +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/SpsModel.cs @@ -0,0 +1,87 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 08.08.2013 +//---------------------------------------------------------------------- + +namespace CampusAppWPortalLib8.Model.GeoDb +{ + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Linq; + using System.Xml.Serialization; + + /// + /// Model for a xml-response of the SPSService + /// + [XmlRoot("root")] + public class SpsModel + { + /// Initializes a new instance of the SpsModel class. + /// Stubbfel, 20.08.2013. + public SpsModel() + { + this.Places = new ObservableCollection(); + } + + /// + /// Gets or sets a list of places + /// + [XmlElement("place")] + public ObservableCollection Places { get; set; } + + /// Gets places by information. + /// Stubbfel, 19.08.2013. + /// The query. + /// (Optional) the ignore cases. + /// (Optional) name of the information. + /// The places by information. + public List GetPlacesByInformation(string query, bool ignoreCases = true, string informationName = null) + { + string querryLow = string.Empty; + IEnumerable resultplaces = null; + + // select correct statement + if (ignoreCases && informationName == null) + { + querryLow = query.ToLower(); + resultplaces = from place in this.Places + from info in place.Informations + where info.InformationValue.ToLower().Contains(querryLow) + select place; + } + else if (ignoreCases && informationName != null) + { + querryLow = query.ToLower(); + resultplaces = from place in this.Places + from info in place.Informations + where info.InformationValue.ToLower().Contains(querryLow) && info.InformationName.Equals(informationName) + select place; + } + else if (!ignoreCases && informationName == null) + { + resultplaces = from place in this.Places + from info in place.Informations + where info.InformationValue.Contains(querryLow) + select place; + } + else if (!ignoreCases && informationName != null) + { + resultplaces = from place in this.Places + from info in place.Informations + where info.InformationValue.Contains(querryLow) && info.InformationName.Equals(informationName) + select place; + } + + // null assert + if (resultplaces == null) + { + return null; + } + + return resultplaces.ToList(); + } + } +}