private void PrintPreview(bool Privew) { if (rbCityName.Checked == false && rbAll.Checked == false) { d.branch.BranchName = cbxbranches.Text.Trim(); } if (rbBranchName.Checked == false && rbAll.Checked == false) { d.City.CityName = cbxbranches.Text.Trim(); } if (rbCityName.Checked == false && rbBranchName.Checked == false) { rbAll.Checked = true; } ds = new DonorBLL().GetData(d, rbBranchName.Checked, rbCityName.Checked, rbAll.Checked); crp.SetDataSource(ds); FrmReportViewer frmViewer = new FrmReportViewer(); frmViewer.crystalReportViewer1.ReportSource = crp; if (Privew) { frmViewer.ShowDialog(); } else { frmViewer.crystalReportViewer1.RefreshReport(); frmViewer.crystalReportViewer1.PrintReport(); } }
private void PrintPreview(bool Privew) { string fromdate = ""; string todate = ""; if (rbCityName.Checked == true) { d.branch.BranchName = cbxbranches.Text.Trim(); } else if (rbBranchName.Checked == true) { d.City.CityName = cbxbranches.Text.Trim(); } else if (rbDonationtype.Checked == true) { d.FundType = cbxbranches.Text.Trim(); } else if (rbDateWise.Checked == true) { fromdate = dtpfromDate.Value.Date.ToString(); todate = dtpTodate.Value.Date.ToString(); } else { rbAll.Checked = true; } ds = new DonorBLL().GetData(d, rbBranchName.Checked, rbCityName.Checked, rbAll.Checked, rbDonationtype.Checked, fromdate, todate, rbDateWise.Checked); crp.SetDataSource(ds); string BranchName = ConfigurationManager.AppSettings["Name"].ToString(); string BranchAddress = ConfigurationManager.AppSettings["Address"].ToString(); crp.SetParameterValue("Name", BranchName); crp.SetParameterValue("Address", BranchAddress); FrmReportViewer frmViewer = new FrmReportViewer(); frmViewer.crystalReportViewer1.ReportSource = crp; if (Privew) { frmViewer.ShowDialog(); } else { frmViewer.crystalReportViewer1.RefreshReport(); frmViewer.crystalReportViewer1.PrintReport(); } }
public DSDonor GetData(Donor d, bool Branches, bool Cities, bool All) { DSDonor ds = new DSDonor(); try { string branches = "Select * from Donor Where BranchName='" + d.branch.BranchName + "'"; string all = "Select * from Donor"; string cities = "Select * from Donor Where City='" + d.City.CityName + "'"; con = new OleDbConnection(); this.readconfile = new ReadConfigFile(); con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile); con.Open(); if (con.State == ConnectionState.Open) { string select = ""; if (Branches == true) { select = branches; } else if (Cities == true) { select = cities; } else if (All == true) { select = all; } da = new OleDbDataAdapter(select, con); da.Fill(ds, ds.Tables[0].TableName); } return(ds); } catch (Exception ex) { throw ex; } finally { con.Close(); } }
public DSDonor GetData(Donor d, bool Branches, bool Cities, bool All, bool Donationtype, string fromdate, string todate, bool Datewise) { DSDonor ds = new DSDonor(); try { string branches = "Select * from Donor Where BranchName='" + d.branch.BranchName + "'"; string all = "Select * from Donor"; string cities = "Select * from Donor Where City='" + d.City.CityName + "'"; string donationtype = " Select * from Donor Where FundType='" + d.FundType + "'"; string datewise = " SELECT * from donor where CurrentDate>=#" + fromdate + "# and CurrentDate<=#" + todate + "#"; con = new OleDbConnection(); this.readconfile = new ReadConfigFile(); con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile); con.Open(); if (con.State == ConnectionState.Open) { string select = ""; if (Branches == true) { select = branches; } else if (Cities == true) { select = cities; } else if (All == true) { select = all; } else if (Donationtype == true) { select = donationtype; } else if (Datewise == true) { select = datewise; } da = new OleDbDataAdapter(select, con); da.Fill(ds, ds.Tables[0].TableName); } return(ds); } catch (Exception ex) { throw ex; } finally { con.Close(); } }