Пример #1
0
        public List <AutoProducts> getAutoRandomProducts(string CompanyId, string peopleCount)
        {
            List <AutoProducts> list = null;

            try
            {
                IParameterMapper            ipmapper = new getAutoRandomProductsParameterMapper();
                DataAccessor <AutoProducts> tableAccessor;
                string strSql = @"exec Intelligent_Product @People=@peopleCount,@CompanyId=@CompanyId";
                tableAccessor = db.CreateSqlStringAccessor(strSql, ipmapper, MapBuilder <AutoProducts> .MapAllProperties()
                                                           .Map(t => t.ProductId).ToColumn("ProductId")
                                                           .Map(t => t.ProductName).ToColumn("ProductName")
                                                           .Map(t => t.Price).ToColumn("Price")
                                                           .Map(t => t.ProductCount).ToColumn("ProductCount")
                                                           .Map(t => t.Count).ToColumn("Count")
                                                           .Map(t => t.Description).ToColumn("Description")
                                                           .Map(t => t.Hot).ToColumn("Hot")
                                                           .Map(t => t.LoveCount).ToColumn("LoveCount")
                                                           .Map(t => t.Popular).ToColumn("Popular")

                                                           .Build());

                list = tableAccessor.Execute(new string[] { CompanyId, peopleCount }).ToList();
                return(list);
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
                return(null);
            }
        }
Пример #2
0
     public List<AutoProducts> getAutoRandomProducts(string CompanyId, string peopleCount)
  {
      List<AutoProducts> list = null;
      try
      {
          IParameterMapper ipmapper = new getAutoRandomProductsParameterMapper();
          DataAccessor<AutoProducts> tableAccessor;
          string strSql = @"exec Intelligent_Product @People=@peopleCount,@CompanyId=@CompanyId";
          tableAccessor = db.CreateSqlStringAccessor(strSql, ipmapper, MapBuilder<AutoProducts>.MapAllProperties()
               .Map(t => t.ProductId).ToColumn("ProductId")
               .Map(t => t.ProductName).ToColumn("ProductName")
              .Map(t => t.Price).ToColumn("Price")
              .Map(t => t.ProductCount).ToColumn("ProductCount")
              .Map(t => t.Count).ToColumn("Count")
              .Map(t => t.Description).ToColumn("Description")
              .Map(t => t.Hot).ToColumn("Hot")
              .Map(t => t.LoveCount).ToColumn("LoveCount")
              .Map(t => t.Popular).ToColumn("Popular")
                  
              .Build());
       
          list = tableAccessor.Execute(new string[] { CompanyId, peopleCount}).ToList();
          return list;
      }
      catch (Exception ex)
      {
          Logger.Log(ex);
          return null;
      }
 
  }