Test Creation DesktopApp
This commit is contained in:
8
LaDOSE.Src/LaDOSE.Service/Helper/Reservation.cs
Normal file
8
LaDOSE.Src/LaDOSE.Service/Helper/Reservation.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace LaDOSE.Business.Helper
|
||||
{
|
||||
public class Reservation
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public bool Valid { get; set; }
|
||||
}
|
||||
}
|
||||
37
LaDOSE.Src/LaDOSE.Service/Helper/WpEventDeserialize.cs
Normal file
37
LaDOSE.Src/LaDOSE.Service/Helper/WpEventDeserialize.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace LaDOSE.Business.Helper
|
||||
{
|
||||
public static class WpEventDeserialize
|
||||
{
|
||||
public static readonly List<String> EventManagerField =new List<string>(new []{"HR3", "HR2", "COMMENT", "BOOKING_COMMENT"});
|
||||
public static List<Reservation> Parse(string meta)
|
||||
{
|
||||
if (meta == null) return new List<Reservation>();
|
||||
PhpSerializer p = new PhpSerializer();
|
||||
var b = p.Deserialize(meta);
|
||||
Hashtable Wpbook = b as Hashtable;
|
||||
|
||||
var games = new List<Reservation>();
|
||||
if (Wpbook != null)
|
||||
{
|
||||
Hashtable reg2 = Wpbook["booking"] as Hashtable;
|
||||
foreach (string reg2Key in reg2.Keys)
|
||||
{
|
||||
if (!EventManagerField.Contains(reg2Key.ToUpperInvariant()))
|
||||
games.Add(new Reservation()
|
||||
{
|
||||
Name = reg2Key,
|
||||
Valid = (string)reg2[reg2Key] == "1"
|
||||
});
|
||||
}
|
||||
|
||||
return games;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user