Beispiel #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            CrystalReportSaleByItem rpt = new CrystalReportSaleByItem();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void buttonSearch_MouseClick(object sender, MouseEventArgs e)
        {
            try
            {
                if (comboBoxItemList.Text != "")
                {
                    CrystalReportSaleByItem ob = new CrystalReportSaleByItem();
                    ByPass(ob);
                    ob.SetParameterValue("startd", dateTimePicker1.Value);
                    ob.SetParameterValue("endd", dateTimePicker2.Value);
                    ob.SetParameterValue("name", comboBoxItemList.Text);

                    crystalReportViewer1.ReportSource = ob;
                    crystalReportViewer1.Refresh();
                    crystalReportViewer1.Show();
                }
                else
                {
                    MessageBox.Show("Please select Item First");
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, "Exception Error");
            }
        }
        private static void ByPass(CrystalReportSaleByItem ob)
        {
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
            Tables          CrTables;


            crConnectionInfo.ServerName   = ".";
            crConnectionInfo.DatabaseName = "RMSDB";
            crConnectionInfo.UserID       = "sa";
            crConnectionInfo.Password     = Variable.Class1.a;

            CrTables = ob.Database.Tables;
            foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
            {
                crtableLogoninfo = CrTable.LogOnInfo;
                crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crtableLogoninfo);
            }
        }