//public BestEquipInfo[] public BestEquipInfo[] GetCelebByDayBestEquip() { List<BestEquipInfo> infos = new List<BestEquipInfo>(); SqlDataReader reader = null; try { db.GetReader(ref reader, "SP_Users_BestEquip"); while (reader.Read()) { BestEquipInfo info = new BestEquipInfo(); info.Date = (DateTime)reader["RemoveDate"]; info.GP = (int)reader["GP"]; info.Grade = (int)reader["Grade"]; info.ItemName = reader["Name"] == null ? "" : reader["Name"].ToString(); info.NickName = reader["NickName"] == null ? "" : reader["NickName"].ToString(); info.Sex = (bool)reader["Sex"]; info.Strengthenlevel = (int)reader["Strengthenlevel"]; info.UserName = reader["UserName"] == null ? "" : reader["UserName"].ToString(); infos.Add(info); } } catch (Exception e) { if (log.IsErrorEnabled) log.Error("Init", e); } finally { if (reader != null && !reader.IsClosed) reader.Close(); } return infos.ToArray(); }
public static XElement CreateBestEquipInfo(BestEquipInfo info) { return new XElement("Item", new XAttribute("Date", info.Date.ToString("yyyy-MM-dd HH:mm:ss")), new XAttribute("GP", info.GP), new XAttribute("Grade", info.Grade), new XAttribute("ItemName", info.ItemName == null ? "" : info.ItemName), new XAttribute("NickName", info.NickName == null ? "" : info.NickName), new XAttribute("Sex", info.Sex), new XAttribute("Strengthenlevel", info.Strengthenlevel), new XAttribute("Type", info.UserName == null ? "" : info.UserName)); }