Exemplo n.º 1
0
        public List<AboutUs> getPromotionListData(string CompanyId)
        {
            List<AboutUs> list = null;
            try
            {
                IParameterMapper ipmapper = new getMessageParameterMapper();
                DataAccessor<AboutUs> tableAccessor;
                string strSql = @"select a.CompanyId ,a.Contents,a.Datetime,a.ID,a.Title
            from news  a where a.CompanyId=@CompanyId";
                tableAccessor = db.CreateSqlStringAccessor(strSql, ipmapper, MapBuilder<AboutUs>.MapAllProperties()
                     .Map(t => t.ID).ToColumn("ID")
                     .Map(t => t.Title).ToColumn("Title")
                     .Map(t => t.Contents).ToColumn("Contents")
                      .Map(t => t.CompanyId).ToColumn("CompanyId")
                    .Map(t => t.DateTime).ToColumn("DateTime")
                    .Build());
                 list = tableAccessor.Execute(new string[] { CompanyId  }).ToList();
               // list = tableAccessor.Execute().ToList(new string[] { CompanyId }).ToList();
                return list;

            }
            catch (Exception ex)
            {
                Logger.Log(ex);
                return null;
            }
        }
Exemplo n.º 2
0
        public List <AboutUs> getPromotionListData(string CompanyId)
        {
            List <AboutUs> list = null;

            try
            {
                IParameterMapper       ipmapper = new getMessageParameterMapper();
                DataAccessor <AboutUs> tableAccessor;
                string strSql = @"select a.CompanyId ,a.Contents,a.Datetime,a.ID,a.Title 
        from news  a where a.CompanyId=@CompanyId";
                tableAccessor = db.CreateSqlStringAccessor(strSql, ipmapper, MapBuilder <AboutUs> .MapAllProperties()
                                                           .Map(t => t.ID).ToColumn("ID")
                                                           .Map(t => t.Title).ToColumn("Title")
                                                           .Map(t => t.Contents).ToColumn("Contents")
                                                           .Map(t => t.CompanyId).ToColumn("CompanyId")
                                                           .Map(t => t.DateTime).ToColumn("DateTime")
                                                           .Build());
                list = tableAccessor.Execute(new string[] { CompanyId }).ToList();
                // list = tableAccessor.Execute().ToList(new string[] { CompanyId }).ToList();
                return(list);
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
                return(null);
            }
        }