public static string Bulid(HttpContext context) { bool value = false; string message = "Fail"; XElement result = new XElement("Result"); try { using (ProduceBussiness db = new ProduceBussiness()) { StrengthenInfo[] infos = db.GetAllStrengthen(); foreach (StrengthenInfo info in infos) { result.Add(Road.Flash.FlashUtils.CreateStrengthenInfo(info)); } } value = true; message = "Success!"; } catch (Exception ex) { log.Error("ItemStrengthenList", ex); } result.Add(new XAttribute("value", value)); result.Add(new XAttribute("message", message)); //return result.ToString(false); return csFunction.CreateCompressXml(context, result, "ItemStrengthenList", true); }
private static bool LoadStrengthen(Dictionary<int, StrengthenInfo> strengthen, Dictionary<int, StrengthenInfo> RefineryStrengthen) { using (ProduceBussiness db = new ProduceBussiness()) { StrengthenInfo[] infos = db.GetAllStrengthen(); StrengthenInfo[] Refineryinfos = db.GetAllRefineryStrengthen(); StrengthenGoodsInfo[] StrengthGoodInfos = db.GetAllStrengthenGoodsInfo(); foreach (StrengthenInfo info in infos) { if (!strengthen.ContainsKey(info.StrengthenLevel)) { strengthen.Add(info.StrengthenLevel, info); } } foreach (StrengthenInfo info in Refineryinfos) { if (!RefineryStrengthen.ContainsKey(info.StrengthenLevel)) { RefineryStrengthen.Add(info.StrengthenLevel, info); } } foreach (StrengthenGoodsInfo info in StrengthGoodInfos) { if (!Strengthens_Goods.ContainsKey(info.ID)) { Strengthens_Goods.Add(info.ID, info); } } } return true; }