⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 saleroom.aspx.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
字号:
namespace PowerEasy.WebSite.Admin.Shop
{
    using Microsoft.Reporting.WebForms;
    using PowerEasy.Controls;
    using PowerEasy.Shop;
    using PowerEasy.Web.UI;
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Web.UI.WebControls;

    public class Saleroom : AdminPage
    {
        protected Literal LtrDate;
        [CLSCompliant(false)]
        protected ReportViewer RpvSale;
        protected ExtendedSiteMapPath SmpNavigator;

        private void InitDataBind(int year)
        {
            Dictionary<int, decimal> sale = new Dictionary<int, decimal>();
            for (int i = 1; i <= 12; i++)
            {
                PowerEasy.Shop.Saleroom saleroom = new PowerEasy.Shop.Saleroom(year, i);
                decimal num2 = saleroom.Sale;
                sale.Add(i, num2);
            }
            this.ShowChart(sale);
        }

        private void InitDataBind(int year, int month)
        {
            int num = DateTime.DaysInMonth(year, month);
            Dictionary<int, decimal> sale = new Dictionary<int, decimal>();
            for (int i = 1; i <= num; i++)
            {
                PowerEasy.Shop.Saleroom saleroom = new PowerEasy.Shop.Saleroom(year, month, i);
                decimal num3 = saleroom.Sale;
                sale.Add(i, num3);
            }
            this.ShowChart(sale);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            int year = BasePage.RequestInt32("Year");
            if (year == 0)
            {
                year = DateTime.Today.Year;
            }
            int month = BasePage.RequestInt32("Month");
            if (month == 0)
            {
                month = DateTime.Today.Month;
            }
            int num3 = BasePage.RequestInt32("SaleroomType");
            if (!this.Page.IsPostBack)
            {
                if (num3 == 1)
                {
                    this.LtrDate.Text = year + "年销售额按月统计";
                    this.InitDataBind(year);
                }
                else
                {
                    this.LtrDate.Text = string.Concat(new object[] { year, "年", month, "月销售额按日统计" });
                    this.InitDataBind(year, month);
                }
            }
        }

        private void ShowChart(Dictionary<int, decimal> sale)
        {
            DataTable dataSourceValue = new DataTable();
            dataSourceValue.Columns.Add("Day", typeof(int));
            dataSourceValue.Columns.Add("Sale", typeof(decimal));
            foreach (KeyValuePair<int, decimal> pair in sale)
            {
                DataRow row = dataSourceValue.NewRow();
                row["Day"] = pair.Key;
                row["Sale"] = pair.Value;
                dataSourceValue.Rows.Add(row);
            }
            dataSourceValue.AcceptChanges();
            this.RpvSale.LocalReport.ReportPath = @"Admin\Shop\SaleStatistics.rdlc";
            this.RpvSale.LocalReport.DataSources.Add(new ReportDataSource("SaleDS", dataSourceValue));
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -