private void PrintPreview(bool Privew) { if (rbCityName.Checked == false && rbAll.Checked == false) { mem.branch.BranchName = cbxbranches.Text.Trim(); } if (rbBranchName.Checked == false && rbAll.Checked == false) { mem.City.CityName = cbxbranches.Text.Trim(); } if (rbCityName.Checked == false && rbBranchName.Checked == false) { rbAll.Checked = true; } ds = new MembershipBLL().GetData(mem, 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(); } }
public DSMembership GetData(Membership mem, bool Branches, bool Cities, bool All) { DSMembership ds = new DSMembership(); try { string branches = "Select * from MembershipData Where BranchName='" + mem.branch.BranchName + "'"; string all = "Select * from MembershipData"; string cities = "Select * from MembershipData Where City='" + mem.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(); } }
private void PrintPreview(bool Privew) { if (rbBranchName.Checked == true) { mem.branch.BranchName = cbxbranches.Text.Trim(); } else if (rbCityName.Checked == true) { mem.City.CityName = cbxbranches.Text.Trim(); } else if (rbAll.Checked == true) { rbAll.Checked = true; } else if (rbCounsil.Checked == true) { mem.Counsil.Add((Counsil)cbxbranches.SelectedItem); } else if (rbcommitte.Checked == true) { mem.Committe.Add((Committe)this.cbxbranches.SelectedItem); } else if (rbBloodgroup.Checked == true) { mem.BloodGroup = this.cbxbranches.Text.Trim(); } ds = new MembershipBLL().GetData(mem, rbBranchName.Checked, rbCityName.Checked, rbAll.Checked, rbBloodgroup.Checked, rbCounsil.Checked, rbcommitte.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 DSMembership GetData(Membership mem, bool Branches, bool Cities, bool All, bool bloodGroup, bool Counsil, bool Committe) { DSMembership ds = new DSMembership(); try { string branches = "Select * from MembershipData Where BranchName='" + mem.branch.BranchName + "'"; string all = "Select * from MembershipData"; string cities = "Select * from MembershipData Where City='" + mem.City.CityName + "'"; string blodgroup = "Select * from MembershipData Where Bloodgroup='" + mem.BloodGroup + "'"; 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 (bloodGroup == true) { select = blodgroup; } else if (Committe == true) { select = "Select *,'" + mem.Committe[0].CommitteName + "' as Committe from MembershipData md,MemberComittee mc where mc.MID = md.MID and mc.CommitteeId=" + mem.Committe[0].CommitteID; } else if (Counsil == true) { select = "Select *,'" + mem.Counsil[0].CounsilName + "' as Counsil from MembershipData md,MemberCouncil mc where mc.MID = md.MID and mc.CounsilId=" + mem.Counsil[0].CounsilID; } da = new OleDbDataAdapter(select, con); da.Fill(ds, ds.Tables[0].TableName); } return(ds); } catch (Exception ex) { throw ex; } finally { con.Close(); } }