Пример #1
0
 public IEnumerable<PriceBook> Get(int level)
 {
     var helper = new SqlHelper(new SysConfigManager().Get().DbConfig.GetConnectionString());
     helper.Open();
     using (var rd = helper.Reader(Sql, new SqlParameter("@date", DateTime.Now.ToString("yyyy-MM-dd"))))
     {
         var list = new List<PriceBook>();
         while (rd.Read())
         {
             decimal price;
             decimal.TryParse(rd["price"].ToString(), out price);
             list.Add(new PriceBook { Code = rd["code"].ToString(), Price = price });
         }
         rd.Close();
         return list;
     }
 }
 public IEnumerable<PriceBook> Get(int level)
 {
     if (level < 5)//5为普通客户价
     {
         level++;
     }
     var helper = new SqlHelper(new SysConfigManager().Get().DbConfig.GetConnectionString());
     helper.Open();
     using (var rd = helper.Reader(string.Format(Sql, level)))
     {
         var list = new List<PriceBook>();
         while (rd.Read())
         {
             decimal price;
             decimal.TryParse(rd["invSCost" + level].ToString(), out price);
             list.Add(new PriceBook { Code = rd["code"].ToString(), Price = price });
         }
         rd.Close();
         return list;
     }
 }