コード例 #1
0
        /// <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()
                });
            }
        }
コード例 #2
0
        /// <summary>
        /// 统计数据按年份分组
        /// </summary>
        private void LoadYears()
        {
            if (bll == null)
            {
                bll = BLLLoader.GetReportBll();
            }


            for (int year = 2014; year <= DateTime.Now.Year; year++)
            {
                TabPage page = new TabPage(String.Format("{0}年", year));
                page.Controls.Add(initDataGridView(year, this.cmbCategory.DataSource as List <Models.GoodsCategory>));
                this.tabYears.TabPages.Add(page);
            }
        }