/// <summary> /// 加载销售排行榜 /// </summary> private void LoadGoodsRank() { this.dgvGoodsRank.Rows.Clear(); bll = BLLLoader.GetReportBll(); List <ReportGoodsRank> ranks = null; try { ranks = bll.SaleGoodsRankByAll(); } catch (Exception e) { MessageBox.Show(e.Message, "数据库不可用", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (ranks == null) { return; } foreach (ReportGoodsRank rank in ranks) { this.dgvGoodsRank.Rows.Add(new String[] { rank.GoodsName, rank.Price.ToString(), rank.Count.ToString() }); } }