public static string Build(HttpContext context) { bool value = false; string message = "Fail"; XElement result = new XElement("Result"); try { using (PveBussiness db = new PveBussiness()) { PveInfo[] infos = db.GetAllPveInfos(); foreach (var info in infos) { result.Add(Road.Flash.FlashUtils.CreatePveInfo(info)); } } value = true; message = "Success!"; } catch (Exception ex) { log.Error("LoadPVEItems", ex); } result.Add(new XAttribute("value", value)); result.Add(new XAttribute("message", message)); return csFunction.CreateCompressXml(context, result, "LoadPVEItems", true); }
public static Dictionary<int, PveInfo> LoadFromDatabase() { Dictionary<int, PveInfo> list = new Dictionary<int, PveInfo>(); using(PveBussiness db = new PveBussiness()) { PveInfo[] infos = db.GetAllPveInfos(); foreach(PveInfo info in infos) { if (!list.ContainsKey(info.ID)) { list.Add(info.ID, info); } } } return list; }