Example #1
0
 public static XElement CreateActiveInfo(ActiveInfo info)
 {
     return new XElement("Item", new XAttribute("ActiveID", info.ActiveID),
         new XAttribute("Description", info.Description == null ? "" : info.Description),
         new XAttribute("Content", info.Content == null ? "" : info.Content),
         new XAttribute("AwardContent", info.AwardContent == null ? "" : info.AwardContent),
         new XAttribute("HasKey", info.HasKey),
         new XAttribute("EndDate", info.EndDate == null ? "" : ((DateTime)info.EndDate).ToString("yyyy-MM-dd HH:mm:ss")),
         new XAttribute("IsOnly", info.IsOnly),
         new XAttribute("StartDate", string.IsNullOrEmpty(info.StartDate.ToString()) ? "" : info.StartDate.ToString("yyyy-MM-dd HH:mm:ss")),
         new XAttribute("Title", info.Title == null ? "" : info.Title),
         new XAttribute("Type", info.Type),
         new XAttribute("ActionTimeContent", info.ActionTimeContent == null ? "" : info.ActionTimeContent),
     //IsAdvance="false"
     new XAttribute("IsAdvance", info.IsAdvance),
     //GoodsExchangeTypes=""
     new XAttribute("GoodsExchangeTypes", info.GoodsExchangeTypes == null ? "" : info.GoodsExchangeTypes),
     //GoodsExchangeNum=""
     new XAttribute("GoodsExchangeNum", info.GoodsExchangeNum == null ? "" : info.GoodsExchangeNum),
     //limitType=""
     new XAttribute("limitType", info.limitType == null ? "" : info.limitType),
     //limitValue=""
     new XAttribute("limitValue", info.limitValue == null ? "" : info.limitValue),
     new XAttribute("IsShow", info.IsShow));
 }
Example #2
0
 public ActiveInfo InitActiveInfo(SqlDataReader reader)
 {
     ActiveInfo info = new ActiveInfo();
     info.ActiveID = (int)reader["ActiveID"];
     info.Description = reader["Description"] == null ? "" : reader["Description"].ToString();
     info.Content = reader["Content"] == null ? "" : reader["Content"].ToString();
     info.AwardContent = reader["AwardContent"] == null ? "" : reader["AwardContent"].ToString();
     info.HasKey = (int)reader["HasKey"];
     //info.EndDate = reader["EndDate"] == null ? reader["EndDate"] : (DateTime)reader["EndDate"];
     if (!string.IsNullOrEmpty(reader["EndDate"].ToString()))
     {
         info.EndDate = (DateTime)reader["EndDate"];
     }
     info.IsOnly = (int)reader["IsOnly"];
     //info.StartDate = reader["StartDate"] == null ? reader["StartDate"] : (DateTime)reader["StartDate"];
     info.StartDate = (DateTime)reader["StartDate"];
     info.Title = reader["Title"].ToString();
     info.Type = (int)reader["Type"];
     info.ActionTimeContent = reader["ActionTimeContent"] == null ? "" : reader["ActionTimeContent"].ToString();
     info.IsAdvance = (bool)reader["IsAdvance"];
     info.GoodsExchangeTypes = reader["GoodsExchangeTypes"] == null ? "" : reader["GoodsExchangeTypes"].ToString();
     info.GoodsExchangeNum = reader["GoodsExchangeNum"] == null ? "" : reader["GoodsExchangeNum"].ToString();
     info.limitType = reader["limitType"] == null ? "" : reader["limitType"].ToString();
     info.limitValue = reader["limitValue"] == null ? "" : reader["limitValue"].ToString();
     info.IsShow = (bool)reader["IsShow"];
     return info;
 }