public List <News> SelNewsInfo(string RstId)
        {
            List <News> list = null;

            try
            {
                IParameterMapper    ipmapper = new SelNewsInfoParameterMapper();
                DataAccessor <News> tableAccessor;
                string strSql = @"select n.ID,n.Title,n.CompanyId,n.Contents,n.Datetime  from news n
                    where n.CompanyId=@RstId";
                tableAccessor = db.CreateSqlStringAccessor(strSql, ipmapper, MapBuilder <News> .MapAllProperties()
                                                           .Map(t => t.CompanyId).ToColumn("CompanyId")
                                                           .Map(t => t.Contents).ToColumn("Contents")
                                                           .Map(t => t.DateTime).ToColumn("DateTime")
                                                           .Map(t => t.ID).ToColumn("ID")
                                                           .Map(t => t.Title).ToColumn("Title")
                                                           .Build());
                list = tableAccessor.Execute(new string[] { RstId }).ToList();
                return(list);
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
                return(null);
            }
        }
Exemple #2
0
 public List<News> SelNewsInfo(string RstId)
 {
     List<News> list = null;
     try
     {
         IParameterMapper ipmapper = new SelNewsInfoParameterMapper();
         DataAccessor<News> tableAccessor;
         string strSql = @"select n.ID,n.Title,n.CompanyId,n.Contents,n.Datetime  from news n
             where n.CompanyId=@RstId";
         tableAccessor = db.CreateSqlStringAccessor(strSql, ipmapper, MapBuilder<News>.MapAllProperties()
              .Map(t => t.CompanyId).ToColumn("CompanyId")
              .Map(t => t.Contents).ToColumn("Contents")
             .Map(t => t.DateTime).ToColumn("DateTime")
             .Map(t => t.ID).ToColumn("ID")
             .Map(t => t.Title).ToColumn("Title")
             .Build());
         list = tableAccessor.Execute(new string[] { RstId }).ToList();
         return list;
     }
     catch (Exception ex)
     {
         Logger.Log(ex);
         return null;
     }
 }