client/src/Iri.Modernisation.Data/Ldt/IRIElement.cs
changeset 38 bd33267300aa
parent 35 43bb1b8ed555
--- a/client/src/Iri.Modernisation.Data/Ldt/IRIElement.cs	Wed Jan 27 10:55:59 2010 +0100
+++ b/client/src/Iri.Modernisation.Data/Ldt/IRIElement.cs	Thu Feb 04 16:38:04 2010 +0100
@@ -17,11 +17,10 @@
         //<element id="elD_0" order="" prev="" next="" begin="0" dur="933" author="DDC - IRI" date="06/2006" title="plan 0" abstract="" src="testauthor_testtitle/thumbs/0_in.jpg"/>
 
         public String Id { get; set; }
-        public int Order { get; set; }
+    
         public DateTime Date { get; set; }
         public int Chapter { get; set; }
-        public String Prev { get; set; }
-        public String Next { get; set; }
+     
         public TimeSpan Begin { get; set; }
         public TimeSpan Dur { get; set; }
         public String Author { get; set; }
@@ -32,11 +31,10 @@
 
         public IRIElement()
         {
-            Id = String.Empty;
-            Order = 0;
+            Id = System.Guid.NewGuid().ToString();
+        
             Chapter = 0;
-            Prev = String.Empty;
-            Next = String.Empty;
+ 
             Begin = TimeSpan.Zero;
             Dur = TimeSpan.Zero;
             Author = String.Empty;
@@ -47,18 +45,18 @@
         }
         public IRIElement(XElement elem)
         {
+        
             Id = elem.Attribute("id").Value;
-            Order = int.Parse(elem.Attribute("order").Value);
-            Prev = elem.Attribute("prev").Value;
-            Next = elem.Attribute("next").Value;
+       
             Begin = TimeSpan.FromMilliseconds(double.Parse(elem.Attribute("begin").Value));
             Dur = TimeSpan.FromMilliseconds(double.Parse(elem.Attribute("dur").Value));
             Author = elem.Attribute("author").Value;
-            Title = elem.Attribute("title").Value;
-            Abstract = elem.Attribute("abstract").Value;
+            Title = elem.Element("title").Value;
+            Abstract = elem.Element("abstract").Value;
             Src = elem.Attribute("src").Value;
             if(elem.Element("tags")!=null)
             {
+                Tags = new List<string>();
                 foreach (XElement XTag in elem.Element("tags").Elements())
                 {
                     Tags.Add(XTag.Value);
@@ -83,11 +81,9 @@
             {
                 XElement temp =  new XElement("element",
                     new XAttribute("id",Id),
-                    new XAttribute("order",Order),
                     new XAttribute("date",Date.ToString("dd/MM/yyyy")),
                     new XAttribute("chapter",Chapter),
-                    new XAttribute("prev",Prev),
-                    new XAttribute("next",Next),
+
                     new XAttribute("begin",Begin.TotalMilliseconds),
                     new XAttribute("dur",Dur.TotalMilliseconds),
                     new XAttribute("author",Author),
@@ -96,6 +92,7 @@
                     new XAttribute("src",Src)
                     );
                 XElement Xtags = new XElement("tags");
+              
                 foreach (String tag in Tags)
                 {
                     Xtags.Add(new XElement("tag", tag));