/// <summary> /// 判断是否有数据可打印 /// </summary> private bool HaveData() { if (this.book.Checked) { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter(); SqlCommand select = new SqlCommand(); adapter.SelectCommand = select; adapter.SelectCommand.Connection = connect; adapter.SelectCommand.CommandText = "PrintBookSale"; adapter.SelectCommand.CommandType = CommandType.StoredProcedure; adapter.SelectCommand.Parameters.AddWithValue("@date1", DateTime.Parse(this.date1.Value.ToShortDateString()) > DateTime.Parse(this.date2.Value.ToShortDateString()) ? DateTime.Parse(this.date2.Value.ToShortDateString()) : DateTime.Parse(this.date1.Value.ToShortDateString())); adapter.SelectCommand.Parameters.AddWithValue("@date2", DateTime.Parse(this.date1.Value.ToShortDateString()) < DateTime.Parse(this.date2.Value.ToShortDateString()) ? DateTime.Parse(this.date2.Value.ToShortDateString()) : DateTime.Parse(this.date1.Value.ToShortDateString())); data.Clear(); adapter.Fill(data.book_sale); if (data.book_sale.DefaultView.Count != 0) { return(true); } else { return(false); } } else { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter(); SqlCommand select = new SqlCommand(); adapter.SelectCommand = select; adapter.SelectCommand.Connection = connect; adapter.SelectCommand.CommandText = "PrintCdSale"; adapter.SelectCommand.CommandType = CommandType.StoredProcedure; adapter.SelectCommand.Parameters.AddWithValue("@date1", DateTime.Parse(this.date1.Value.ToShortDateString()) > DateTime.Parse(this.date2.Value.ToShortDateString()) ? DateTime.Parse(this.date2.Value.ToShortDateString()) : DateTime.Parse(this.date1.Value.ToShortDateString())); adapter.SelectCommand.Parameters.AddWithValue("@date2", DateTime.Parse(this.date1.Value.ToShortDateString()) < DateTime.Parse(this.date2.Value.ToShortDateString()) ? DateTime.Parse(this.date2.Value.ToShortDateString()) : DateTime.Parse(this.date1.Value.ToShortDateString())); data.Clear(); adapter.Fill(data.cd_sale); if (data.cd_sale.DefaultView.Count != 0) { return(true); } else { return(false); } } }
/// <summary> /// 判断是否可打印光盘损坏 /// </summary> private bool HaveCdBadData() { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter("select * from cdbadme", connect); data.Clear(); adapter.Fill(data.cd_bad); if (data.cd_bad.DefaultView.Count != 0) { return(true); } else { return(false); } }
/// <summary> /// 判断是否可打印顾客退还图书信息 /// </summary> private bool HaveBookReturnData() { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter("select * from bookreturnme", connect); data.Clear(); adapter.Fill(data.book_return); if (data.book_return.DefaultView.Count != 0) { return(true); } else { return(false); } }
private void PrintWareSale_Load(object sender, EventArgs e)//初始化 { if (ware.Trim() == "图书") { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter(); SqlCommand select = new SqlCommand(); adapter.SelectCommand = select; adapter.SelectCommand.Connection = connect; adapter.SelectCommand.CommandText = "PrintBookSale"; adapter.SelectCommand.CommandType = CommandType.StoredProcedure; adapter.SelectCommand.Parameters.AddWithValue("@date1", begindate); adapter.SelectCommand.Parameters.AddWithValue("@date2", enddate); data.Clear(); adapter.Fill(data.book_sale); PrintBookSale booksale = new PrintBookSale(); booksale.SetDataSource(data); this.crystalReportViewer1.ReportSource = booksale; } else { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter(); SqlCommand select = new SqlCommand(); adapter.SelectCommand = select; adapter.SelectCommand.Connection = connect; adapter.SelectCommand.CommandText = "PrintCdSale"; adapter.SelectCommand.CommandType = CommandType.StoredProcedure; adapter.SelectCommand.Parameters.AddWithValue("@date1", begindate); adapter.SelectCommand.Parameters.AddWithValue("@date2", enddate); data.Clear(); adapter.Fill(data.cd_sale); PrintCdSale cdsale = new PrintCdSale(); cdsale.SetDataSource(data); this.crystalReportViewer1.ReportSource = cdsale; } }
private void FrmLookUpDown_Load(object sender, EventArgs e)//初始化 { if (flag == 1 && ware == "图书") { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter(); SqlCommand select = new SqlCommand(); adapter.SelectCommand = select; adapter.SelectCommand.Connection = connect; adapter.SelectCommand.CommandText = "WareUp"; adapter.SelectCommand.CommandType = CommandType.StoredProcedure; adapter.SelectCommand.Parameters.AddWithValue("@Flag", 1); data.Clear(); adapter.Fill(data.book_info); PrintBookUpDown bookup = new PrintBookUpDown(); bookup.SetDataSource(data); this.crystalReportViewer1.ReportSource = bookup; } else if (flag == 2 && ware == "光盘") { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter(); SqlCommand select = new SqlCommand(); adapter.SelectCommand = select; adapter.SelectCommand.Connection = connect; adapter.SelectCommand.CommandText = "WareUp"; adapter.SelectCommand.CommandType = CommandType.StoredProcedure; adapter.SelectCommand.Parameters.AddWithValue("@Flag", 2); data.Clear(); adapter.Fill(data.cd_info); PrintCdUpDown cdup = new PrintCdUpDown(); cdup.SetDataSource(data); this.crystalReportViewer1.ReportSource = cdup; } else if (flag == 3 && ware == "图书") { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter(); SqlCommand select = new SqlCommand(); adapter.SelectCommand = select; adapter.SelectCommand.Connection = connect; adapter.SelectCommand.CommandText = "WareDown"; adapter.SelectCommand.CommandType = CommandType.StoredProcedure; adapter.SelectCommand.Parameters.AddWithValue("@Flag", 1); data.Clear(); adapter.Fill(data.book_info); PrintBookUpDown bookdown = new PrintBookUpDown(); bookdown.SetDataSource(data); this.crystalReportViewer1.ReportSource = bookdown; } else if (flag == 4 && ware == "光盘") { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter(); SqlCommand select = new SqlCommand(); adapter.SelectCommand = select; adapter.SelectCommand.Connection = connect; adapter.SelectCommand.CommandText = "WareDown"; adapter.SelectCommand.CommandType = CommandType.StoredProcedure; adapter.SelectCommand.Parameters.AddWithValue("@Flag", 2); data.Clear(); adapter.Fill(data.cd_info); PrintCdUpDown cddown = new PrintCdUpDown(); cddown.SetDataSource(data); this.crystalReportViewer1.ReportSource = cddown; } }
private void PrintBackReturnBad_Load(object sender, EventArgs e) { if (flag == 1) { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter("select * from bookbackprovider", connect); data.Clear(); adapter.Fill(data.book_back); PrintBookBack bookback = new PrintBookBack(); bookback.SetDataSource(data); this.crystalReportViewer1.ReportSource = bookback; } else if (flag == 2) { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter("select * from cdbackprovider", connect); data.Clear(); adapter.Fill(data.cd_back); PrintCdBack cdback = new PrintCdBack(); cdback.SetDataSource(data); this.crystalReportViewer1.ReportSource = cdback; } else if (flag == 3) { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter("select * from bookreturnme", connect); data.Clear(); adapter.Fill(data.book_return); PrintBookReturn bookreturn = new PrintBookReturn(); bookreturn.SetDataSource(data); this.crystalReportViewer1.ReportSource = bookreturn; } else if (flag == 4) { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter("select * from cdreturnme", connect); data.Clear(); adapter.Fill(data.cd_return); PrintCdReturn cdreturn = new PrintCdReturn(); cdreturn.SetDataSource(data); this.crystalReportViewer1.ReportSource = cdreturn; } else if (flag == 5) { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter("select * from bookbadme", connect); data.Clear(); adapter.Fill(data.book_bad); PrintBookBad bookbad = new PrintBookBad(); bookbad.SetDataSource(data); this.crystalReportViewer1.ReportSource = bookbad; } else if (flag == 6) { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter("select * from cdbadme", connect); data.Clear(); adapter.Fill(data.cd_bad); PrintCdBad cdbad = new PrintCdBad(); cdbad.SetDataSource(data); this.crystalReportViewer1.ReportSource = cdbad; } }