예제 #1
0
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
 {
     Memberwisrrptfile rpt = new Memberwisrrptfile();
     rpt.Site = this.Site;
     return rpt;
 }
예제 #2
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            using (SqlConnection sqlCon = new SqlConnection(ConnectionString))
                try
                {
                    #region

                    SqlCommand cmd = new SqlCommand("Usp_SearchMemberwiseReport", sqlCon);
                    cmd.Parameters.AddWithValue("@GroupId", Convert.ToInt32(cbgroupNames.SelectedValue.ToString()));
                    cmd.Parameters.AddWithValue("@CustomerId", Convert.ToInt32(cbMemberName.SelectedValue.ToString()));
                    cmd.CommandType = CommandType.StoredProcedure;
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    DataTable dt = new DataTable();
                    da.Fill(dt);

                    try
                    {
                        if (dt.Rows.Count > 0)
                        {
                            // dataset file name
                             DataSet1 dset = new DataSet1();
                             dset.Tables["Installment"].Merge(dt);
                            Memberwisrrptfile crpt = new Memberwisrrptfile();// .rpt file name
                            crpt.SetDataSource(dset.Tables["Installment"]);
                            crystalReportViewer1.ReportSource = crpt;
                            crystalReportViewer1.Refresh();
                        }
                        else
                        {
                            MessageBox.Show("Record does not available");
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message.ToString());
                    }
                    #endregion
            #region------try code
                    //    Memberwisrrptfile reportDocument = new Memberwisrrptfile();
                    //    ParameterField paramField = new ParameterField();
                    //    ParameterFields paramFields = new ParameterFields();
                    //    ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();

                    //    paramField.Name = "@GroupId";
                    //    paramDiscreteValue.Value = cbgroupNames.SelectedValue.ToString();

                    //    paramField.CurrentValues.Add(paramDiscreteValue);
                    //    paramFields.Add(paramField);
                    //    paramFields.Add(paramField);

                    //    crystalReportViewer1.ParameterFieldInfo = paramFields;

                    //    //string reportPath = Server.MapPath("~/Memberwisrrptfile.rpt");
                    //    reportDocument.Load("~/Memberwisrrptfile.rpt");
                    //    reportDocument.SetParameterValue("@GroupId", cbgroupNames.SelectedValue.ToString());

                    //    crystalReportViewer1.ReportSource = reportDocument;
                    //}
                    //catch (Exception ex)
                    //{
                    //    MessageBox.Show(ex.Message.ToString());
                    //}
            #endregion
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
            finally
            {
            }
        }
예제 #3
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (lblCustMsg.Text != "")
            {
                using (SqlConnection sqlCon = new SqlConnection(ConnectionString))

                    try
                    {
                        #region
                        //SqlCommand cmd = new SqlCommand("Usp_SearchMemberwiseReport", sqlCon);
                        //cmd.Parameters.AddWithValue("@GroupId", Convert.ToInt32(cbgroupNames.SelectedValue.ToString()));
                        //cmd.Parameters.AddWithValue("@CustomerId", Convert.ToInt32(cbMemberName.SelectedValue.ToString()));
                        //cmd.CommandType = CommandType.StoredProcedure;
                        //SqlDataAdapter da = new SqlDataAdapter(cmd);
                        //DataTable dt = new DataTable();
                        //da.Fill(dt);
                        //try
                        //{
                        //    if (dt.Rows.Count > 0)
                        //    {
                                                Memberwisrrptfile reportDocument = new Memberwisrrptfile();
                                                ParameterField paramField = new ParameterField();
                                                ParameterFields paramFields = new ParameterFields();
                                                ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();

                                                paramField.Name = "@GroupId";
                                                paramDiscreteValue.Value =cbgroupNames.SelectedValue.ToString();
                                                paramField.Name = "@CustomerId";
                                                paramDiscreteValue.Value = cbMemberName.SelectedValue.ToString();

                                                paramField.CurrentValues.Add(paramDiscreteValue);
                                                paramFields.Add(paramField);
                                                paramFields.Add(paramField);
                                                crystalReportViewer1.ParameterFieldInfo = paramFields;

                                                //string reportPath = Server.MapPath("~/Memberwisrrptfile.rpt");
                                                reportDocument.Load("~/Memberwisrrptfile.rpt");
                                                //reportDocument.Load(@"D:\New folder\Loanapp11sep\10092015 Loan\Loan-25-07-2015\source\LoanApplication\LoanApplication\Memberwisrrptfile.rpt");
                                                reportDocument.SetParameterValue("@GroupId", cbgroupNames.SelectedValue.ToString());
                                                reportDocument.SetParameterValue("@CustomerId", cbMemberName.SelectedValue.ToString());
                                                crystalReportViewer1.ReportSource = reportDocument;
                                               // crystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
                                               // Session["ReportDocument"] = reportDocument;

                                //DataSet1 dset = new DataSet1(); // dataset file name
                                //dset.Tables["Installment"].Merge(dt);
                                //Memberwisrrptfile crpt = new Memberwisrrptfile(); // .rpt file name
                                //crpt.SetDataSource(dset.Tables["Installment"]);
                                //crystalReportViewer1.ReportSource = crpt;
                                //crystalReportViewer1.Refresh();
                            //}
                            //else
                            //{
                            //    MessageBox.Show("Record does not available");
                            //}
                        //}
                        //catch (Exception ex)
                        //{
                        //    MessageBox.Show(ex.Message.ToString());
                        //}

                        #endregion
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message.ToString());
                    }
                    finally
                    {

                    }
            }
            else
            {
                MessageBox.Show("Please Select Group For Search");
            }
        }