ReportForm.cs
资源名称:BookStore.rar [点击查看]
上传用户:xyl529207
上传日期:2022-08-03
资源大小:935k
文件大小:4k
源码类别:
行业应用
开发平台:
SQL
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.Data.SqlClient;
- namespace BookStoreMan
- {
- public partial class ReportForm : Form
- {
- public ReportForm()
- {
- InitializeComponent();
- }
- private void ReportForm_Load(object sender, EventArgs e)
- {
- try
- {
- this.V_BookSellTableAdapter.Fill(this.BookStoreDataSet.V_BookSell);
- this.reportViewer1.LocalReport.DataSources[0].Value = this.BookStoreDataSet.V_BookSell.DefaultView;
- this.reportViewer2.LocalReport.DataSources[0].Value = this.BookStoreDataSet.V_BookSell.DefaultView;
- this.reportViewer3.LocalReport.DataSources[0].Value = this.BookStoreDataSet.V_BookSell.DefaultView;
- this.RefreshReports();
- }
- catch (Exception exp)
- {
- MessageBox.Show(exp.Message + exp.StackTrace);
- }
- }
- private void radioButton1_CheckedChanged(object sender, EventArgs e)
- {
- if (radioButton1.Checked)
- {
- this.BookStoreDataSet.V_BookSell.DefaultView.RowFilter = "";
- this.RefreshReports();
- }
- }
- private void radioButton2_CheckedChanged(object sender, EventArgs e)
- {
- if (radioButton2.Checked)
- {
- string sFilter = string.Format("TIME>'1/1/{0}' AND TIME<'12/31/{0} 23:59:59'", DateTime.Now.Year);
- this.BookStoreDataSet.V_BookSell.DefaultView.RowFilter = sFilter;
- this.RefreshReports();
- }
- }
- private void radioButton3_CheckedChanged(object sender, EventArgs e)
- {
- if (radioButton3.Checked)
- {
- int iYear = DateTime.Now.Year;
- int iMonth = DateTime.Now.Month;
- int iLastDay = DateTime.DaysInMonth(iYear, iMonth);
- string sFilter = string.Format("TIME>'{0}/1/{1}' AND TIME<'{0}/{2}/{1} 23:59:59'", iMonth, iYear, iLastDay);
- this.BookStoreDataSet.V_BookSell.DefaultView.RowFilter = sFilter;
- this.RefreshReports();
- }
- }
- private void radioButton4_CheckedChanged(object sender, EventArgs e)
- {
- if (radioButton4.Checked)
- {
- string sFilter = string.Format("TIME>'{0}/{1}/{2} 00:00:00' AND TIME<'{0}/{1}/{2} 23:59:59'", DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Year);
- this.BookStoreDataSet.V_BookSell.DefaultView.RowFilter = sFilter;
- this.RefreshReports();
- }
- }
- private void radioButton5_CheckedChanged(object sender, EventArgs e)
- {
- button1.Enabled = radioButton5.Checked;
- }
- private void button1_Click(object sender, EventArgs e)
- {
- string sFilter = string.Format("TIME>'{0} 00:00:00' AND TIME<'{1} 23:59:59'", dateTimePicker1.Value.ToString("d"), dateTimePicker2.Value.ToString("d"));
- this.BookStoreDataSet.V_BookSell.DefaultView.RowFilter = sFilter;
- this.RefreshReports();
- }
- protected void RefreshReports()
- {
- this.reportViewer1.RefreshReport();
- this.reportViewer2.RefreshReport();
- this.reportViewer3.RefreshReport();
- }
- }
- }