Beispiel #1
0
 //get parameters per room, Übergabeparameter: 1-n Rooms
 public static void getParameters(List<XElement> xmlRooms)
 {
     Rooms ro = new Rooms();
     ro.newZimmerT = new ZimmerTyp();
     ro.newZimmer = new Zimmer();
     foreach (XElement xele in xmlRooms)
     {
         foreach (XElement parameter in xele.Descendants("member"))
         {
             ro = switchRooms(parameter,ro);
         }
         hm.repZimmerTyp.Create(ro.newZimmerT);
         ro.newZimmerT = new ZimmerTyp();
     }
 }
Beispiel #2
0
 static Rooms switchRooms(XElement parameter, Rooms room)
 {
     XElement variable = parameter.Descendants("name").FirstOrDefault();
     XElement value = parameter.Descendants("value").FirstOrDefault();
     switch (variable.Value)
     {
         case "name":
             room.newZimmerT.typBezeichnung = value.Value;
             break;
         case "price":
             room.newZimmerT.preis = Convert.ToDecimal(value.Value,new CultureInfo("en-US"));
             break;
         case "men":
             room.newZimmerT.anzahlErw = Convert.ToInt32(value.Value);
             break;
         case "occupancy":
             room.newZimmerT.anzahlBetten = Convert.ToInt32(value.Value);
             break;
         case "id":
             room.newZimmerT.idZimmerTyp = Convert.ToInt32(value.Value);
             break;
         case "board":
             room.newZimmerT.board = value.Value;
             break;
         case "availability":
             room.newZimmerT.bettenVorhanden = Convert.ToInt32(value.Value);
             break;
         case "shortname":
             room.newZimmerT.kurzBezeichnung = value.Value;
             break;
         case "children":
             room.newZimmerT.anzahlKinder = Convert.ToInt32(value.Value);
             break;
     }
     return room;
 }