コード例 #1
0
        public static void Connect(ReportDocument cryRpt, string Server, string database, string uid, string pwd)
        {
            cryRpt = new ReportDocument();
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
            Tables          CrTables;

            //   cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt");
            //  Visit_Report1.SetDatabaseLogon(ini.IniReadValue("CONNECTIONSTRING", "Uid"), ini.IniReadValue("CONNECTIONSTRING", "Pwd"), ini.IniReadValue("CONNECTIONSTRING", "Server"), ini.IniReadValue("CONNECTIONSTRING", "Database"));
            IniFile ini = new IniFile(ClassSql.MMS_Path);

            crConnectionInfo.ServerName   = Server;
            crConnectionInfo.DatabaseName = database;
            crConnectionInfo.UserID       = uid;
            crConnectionInfo.Password     = pwd;

            CrTables = cryRpt.Database.Tables;
            foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
            {
                crtableLogoninfo = CrTable.LogOnInfo;
                crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crtableLogoninfo);
            }
        }
コード例 #2
0
        public ReportesPersonas()
        {
            InitializeComponent();
            ReportDocument  cryRpt            = new ReportDocument();
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
            Tables          CrTables;

            cryRpt.Load(@"D:\Usuario\TP2_Net\UI.Escritorio\crPersonas.rpt");

            crConnectionInfo.ServerName   = "Casa";
            crConnectionInfo.DatabaseName = "tp2_net";
            crConnectionInfo.UserID       = "net";
            crConnectionInfo.Password     = "******";

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

            crystalReportViewer2.ReportSource = cryRpt;
            crystalReportViewer2.RefreshReport();
        }
コード例 #3
0
        private void Generate_Reports()
        {
            BLL_Dml   _objbll = new BLL_Dml();
            _database _objdb  = new _database();

            _objdb.DBName = "DBCML";
            _clsproject _objcls1 = new _clsproject();

            _objcls1.prjcode = "CCAD";
            _objbll.Update_RPTLogo(_objcls1, _objdb);

            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
            Tables          CrTables;

            cryRpt.Load(Server.MapPath("sys_list.rpt"));
            crConnectionInfo.ServerName   = "37.61.235.103";
            crConnectionInfo.DatabaseName = "DBCML";
            crConnectionInfo.UserID       = "sa";
            crConnectionInfo.Password     = "******";
            CrTables = cryRpt.Database.Tables;
            foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
            {
                crtableLogoninfo = CrTable.LogOnInfo;
                crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crtableLogoninfo);
            }
            CrystalReportViewer1.ReportSource = cryRpt;
            CrystalReportViewer1.DataBind();
            Session["Report"] = cryRpt;
        }
コード例 #4
0
        public void Logon_To_Crystal()
        {
            List <string> cl_Lgoin = Comclass.Crystal_report_Login();

            crConnectionInfo.ServerName   = cl_Lgoin[0].ToString();
            crConnectionInfo.DatabaseName = cl_Lgoin[1].ToString();
            crConnectionInfo.UserID       = cl_Lgoin[2].ToString();
            crConnectionInfo.Password     = cl_Lgoin[3].ToString();
            CrTables = rptDoc.Database.Tables;

            foreach (Table CrTable in CrTables)
            {
                crtableLogoninfo = CrTable.LogOnInfo;
                crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crtableLogoninfo);
            }

            foreach (ReportDocument sr in rptDoc.Subreports)
            {
                foreach (Table CrTable in sr.Database.Tables)
                {
                    crtableLogoninfo = CrTable.LogOnInfo;
                    crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                    CrTable.ApplyLogOnInfo(crtableLogoninfo);
                }
            }
        }
コード例 #5
0
        private void Generate_Reports()
        {
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
            Tables          CrTables;

            cryRpt.Load(Server.MapPath("ServiceSummary.rpt"));
            //crConnectionInfo.ServerName = "213.171.197.149,49296";
            //crConnectionInfo.DatabaseName = "DBCML";
            //crConnectionInfo.UserID = "CMLT";
            //crConnectionInfo.Password = "******";
            crConnectionInfo.ServerName   = Constants.CMLTConstants.serverName;
            crConnectionInfo.DatabaseName = Constants.CMLTConstants.dbName;
            crConnectionInfo.UserID       = Constants.CMLTConstants.dbUserName;
            crConnectionInfo.Password     = Constants.CMLTConstants.dbPassword;
            CrTables = cryRpt.Database.Tables;
            foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
            {
                crtableLogoninfo = CrTable.LogOnInfo;
                crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crtableLogoninfo);
            }
            cryRpt.SetParameterValue("prj", lblprj.Text);
            cryRpt.SetParameterValue("BZONE", drbzone.SelectedItem.Text);
            cryRpt.SetParameterValue("FLVL", drflvl.SelectedItem.Text);
            CrystalReportViewer2.ReportSource = cryRpt;
            CrystalReportViewer2.DataBind();
            Session["Report"] = cryRpt;
        }
コード例 #6
0
        private void NonConformingTestingSheet_Load(object sender, EventArgs e)
        {
            Tables          CrTables;
            ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();

            crConnectionInfo.Type               = ConnectionInfoType.SQL;
            crConnectionInfo.ServerName         = "172.16.4.12";
            crConnectionInfo.DatabaseName       = "PTS";
            crConnectionInfo.IntegratedSecurity = false;
            crConnectionInfo.UserID             = "sa";
            crConnectionInfo.Password           = "******";
            crtableLogoninfo.ConnectionInfo     = crConnectionInfo;

            SqlConnection sqlcnn = PSSClass.DBConnection.PSSConnection();

            if (sqlcnn == null)
            {
                MessageBox.Show("Connection problems encountered." + Environment.NewLine + "Please contact your administrator.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            ReportDocument crDoc  = new ReportDocument();
            SqlCommand     sqlcmd = new SqlCommand();
            SqlDataReader  sqldr;

            string rpt = @"\\PSAPP01\IT Files\PTS\Crystal Reports\" + "NonConformingTestForm.rpt";

            crDoc.Load(rpt);

            CrTables = crDoc.Database.Tables;
            foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
            {
                crtableLogoninfo = CrTable.LogOnInfo;
                crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crtableLogoninfo);
            }
            sqlcmd             = new SqlCommand("spRptNonConformSheet", sqlcnn);
            sqlcmd.CommandType = CommandType.StoredProcedure;

            sqlcmd.Parameters.AddWithValue("@IndexNo", IndexNo);

            sqldr = sqlcmd.ExecuteReader();

            DataTable dTable = new DataTable();

            try
            {
                dTable.Load(sqldr);
                sqlcnn.Dispose();
            }
            catch
            {
                sqlcnn.Dispose();
            }
            crDoc.SetDataSource(dTable);
            crReport.ReportSource = crDoc;
            crReport.Refresh();
        }
コード例 #7
0
        private void PrintReport()
        {
            ReportDocument  cryRpt            = new ReportDocument();
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
            string          rPath             = @"C:\IFAD-Reports\CrystalReportAllCustomerList.rpt";

            //string rPath = ReportPaths + "CrystalReportAllCustomerList";
            cryRpt.Load(rPath);
            crConnectionInfo.ServerName   = ConfigurationManager.ConnectionStrings["cryServer"].ToString();
            crConnectionInfo.DatabaseName = ConfigurationManager.ConnectionStrings["cryDatabase"].ToString();
            crConnectionInfo.UserID       = ConfigurationManager.ConnectionStrings["cryUserID"].ToString();
            crConnectionInfo.Password     = ConfigurationManager.ConnectionStrings["cryPass"].ToString();

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

            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.RefreshReport();
        }
コード例 #8
0
        protected override void CargarPagina()
        {
            if ((string)Session["privilegio"] != "admin")
            {
                Response.Redirect("noCorrespondeSeccion.aspx");
            }
            else
            {
                ReportDocument  cryRpt            = new ReportDocument();
                TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
                TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
                ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
                Tables          CrTables;

                cryRpt.Load(@"D:\Usuario\TP2_Net\UI.Web\ReportePersona.rpt");

                crConnectionInfo.ServerName   = "Casa";
                crConnectionInfo.DatabaseName = "tp2_net";
                crConnectionInfo.UserID       = "net";
                crConnectionInfo.Password     = "******";

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

                CrystalReportViewer1.ReportSource = cryRpt;
                CrystalReportViewer1.RefreshReport();
            }
        }
コード例 #9
0
        private void frmRMovimientoAlmacen_Load(object sender, EventArgs e)
        {
            try
            {
                string fechaInicio = frmMostrarMovimientoAlmacen.f1.dtpFechaInicio.Value.ToString("yyyy-MM-dd");
                string fechaFin    = frmMostrarMovimientoAlmacen.f1.dtpFechaFin.Value.ToString("yyyy-MM-dd");

                ReportDocument repdoc = new ReportDocument();
                //repdoc.Load(@"C:\Users\vioma\OneDrive\Documentos\Visual Studio 2017\Projects\SisVentas_ResAlm\CapaPresentacion\Reportes/RMovAlmacen.rpt");
                repdoc.Load(@"D:\Reportes\RMovAlmacen.rpt");
                ParameterFieldDefinitions pfds;
                ParameterFieldDefinition  pfd;

                ParameterValues        pvs = new ParameterValues();
                ParameterDiscreteValue pdv = new ParameterDiscreteValue();

                pdv.Value = Convert.ToDateTime(fechaInicio + " 00:00:00");
                pfds      = repdoc.DataDefinition.ParameterFields;
                pfd       = pfds["@fechaInicio"];
                pvs.Add(pdv);
                pfd.ApplyCurrentValues(pvs);


                pdv.Value = Convert.ToDateTime(fechaFin + " 23:59:59");
                pfds      = repdoc.DataDefinition.ParameterFields;
                pfd       = pfds["@fechaFin"];
                pvs.Add(pdv);
                pfd.ApplyCurrentValues(pvs);

                TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
                TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
                ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
                Tables          CrTables;

                /*
                 * crConnectionInfo.ServerName = @"EQUIPO\SQLEXPRESS";
                 * crConnectionInfo.DatabaseName = "db_restauranteAlmacen";
                 * crConnectionInfo.UserID = "martin";
                 * crConnectionInfo.Password = "******";*/
                crConnectionInfo.ServerName   = @"EQUIPO\SQLEXPRESS";
                crConnectionInfo.DatabaseName = "SISVENTAS_CA";
                crConnectionInfo.UserID       = "admin";
                crConnectionInfo.Password     = "******";
                CrTables = repdoc.Database.Tables;
                foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
                {
                    crtableLogoninfo = CrTable.LogOnInfo;
                    crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                    CrTable.ApplyLogOnInfo(crtableLogoninfo);
                }

                cvMovAlmacen.ReportSource = repdoc;
                cvMovAlmacen.Refresh();
            }

            catch (Exception ex)
            {
                MessageBox.Show("ERROR" + ex);
            }
        }
コード例 #10
0
ファイル: Profit.cs プロジェクト: TanzidKaiser/DesktopPos
        private void PrintReport()
        {
            Temp_Profit_Stock_Truncket();
            Temp_Profit_Stock();
            double income    = Get_Income();
            double expensive = Get_Expensive();

            Temp_Income_Expensive_Stock(income, expensive);

            ReportDocument  cryRpt            = new ReportDocument();
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
            string          rPath             = @"C:\Reports\CrystalReportProfit.rpt";

            cryRpt.Load(rPath);
            crConnectionInfo.ServerName   = ConfigurationManager.ConnectionStrings["cryServer"].ToString();
            crConnectionInfo.DatabaseName = ConfigurationManager.ConnectionStrings["cryDatabase"].ToString();
            crConnectionInfo.UserID       = ConfigurationManager.ConnectionStrings["cryUserID"].ToString();
            crConnectionInfo.Password     = ConfigurationManager.ConnectionStrings["cryPass"].ToString();


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

            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.RefreshReport();
        }
コード例 #11
0
        private void MostrarReport(object sender, EventArgs e)
        {
            try
            {
                errorLabel.Visible = false;
                cryRpt             = new ReportDocument();
                ConnectionInfo crConnectionInfo = new ConnectionInfo();
                TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();

                cryRpt.Load("../Users/UserReport.rpt");
                crConnectionInfo.ServerName         = "34.77.100.91";
                crConnectionInfo.IntegratedSecurity = false;
                crConnectionInfo.UserID             = "sqlserver";
                crConnectionInfo.Password           = "******";
                crConnectionInfo.DatabaseName       = "securecode";
                Tables CrTables = cryRpt.Database.Tables;

                foreach (Table CrTable in CrTables)
                {
                    crtableLogoninfo = CrTable.LogOnInfo;
                    crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                    CrTable.ApplyLogOnInfo(crtableLogoninfo);
                }

                cryRpt.RecordSelectionFormula = "{Comando.CodeUser} = '" + textBox1.Text + "'";

                crystalReportViewer1.ReportSource = cryRpt;
                saveButton.Enabled = true;
            }
            catch
            {
                errorLabel.Text    = @"Error mostrant report";
                errorLabel.Visible = true;
            }
        }
コード例 #12
0
        private void BarcodeGenerate_Load(object sender, EventArgs e)
        {
            Auto_Complete();
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
            // string rPath = @"C:\Reports\CrystalReportBarcodeGenerate.rpt";
            string rPath = ReportPaths + "CrystalReportBarcodeGenerateA4.rpt";

            crystal.Load(rPath);
            crConnectionInfo.ServerName   = ConfigurationManager.ConnectionStrings["cryServer"].ToString();
            crConnectionInfo.DatabaseName = ConfigurationManager.ConnectionStrings["cryDatabase"].ToString();
            crConnectionInfo.UserID       = ConfigurationManager.ConnectionStrings["cryUserID"].ToString();
            crConnectionInfo.Password     = ConfigurationManager.ConnectionStrings["cryPass"].ToString();

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

            //crystalReportViewer1.ReportSource = cryRpt;
            //crystalReportViewer1.RefreshReport();
            //crystal.Load(@"C:\Reports\CrystalReportBarcodeGenerate.rpt");
        }
コード例 #13
0
        public LoadRPT(int TypeDocument)
        {
            using (SqlConnection connection = new SqlConnection(Datos.Clases.Constantes.conectionLog))
            {
                using (SqlCommand command = new SqlCommand("sp_SDKDocuments", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@TipoConsulta", 1);
                    command.Parameters.AddWithValue("@idDocumento", TypeDocument);

                    DataTable      tbl = new DataTable();
                    SqlDataAdapter da  = new SqlDataAdapter();
                    da.SelectCommand = command;
                    da.Fill(tbl);
                    docRPT      = new ReportDocument();
                    pathCrystal = tbl.Rows[0].Field <string>("pathRPT");;
                    docRPT.Load(pathCrystal);
                    crConnectionInfo.ServerName   = tbl.Rows[0].Field <string>("IPServer");;
                    crConnectionInfo.DatabaseName = tbl.Rows[0].Field <string>("CompanyDB");;
                    crConnectionInfo.UserID       = tbl.Rows[0].Field <string>("DbUserName");;
                    crConnectionInfo.Password     = tbl.Rows[0].Field <string>("DbPassword");;
                    CrTables = docRPT.Database.Tables;
                }
            }

            foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
            {
                crtableLogoninfo = CrTable.LogOnInfo;
                crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crtableLogoninfo);
            }
        }
コード例 #14
0
        private void buttonPrint_Click(object sender, EventArgs e)
        {
            Temp_Purchase_Report_Truncket();
            Temp_Purchase_Report();


            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
            //string rPath = @"C:\Reports\CrystalReportTempCustomerLedger.rpt";
            string rPath = ReportPaths + "CrystalReportCustomerLedger.rpt";

            cryRpt.Load(rPath);
            crConnectionInfo.ServerName   = ConfigurationManager.ConnectionStrings["cryServer"].ToString();
            crConnectionInfo.DatabaseName = ConfigurationManager.ConnectionStrings["cryDatabase"].ToString();
            crConnectionInfo.UserID       = ConfigurationManager.ConnectionStrings["cryUserID"].ToString();
            crConnectionInfo.Password     = ConfigurationManager.ConnectionStrings["cryPass"].ToString();

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

            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.RefreshReport();
        }
コード例 #15
0
        public void SetConnection(ref ReportDocument rpt)
        {
            // MessageBox.Show(DSN + " " + HOST + " " + database + " " + username + " " + password);
            try
            {
                //create connection info
                TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
                ConnectionInfo crConnectionInfo = new ConnectionInfo();
                Tables         CrTables;

                //update connection string base on  database config
                crConnectionInfo.ServerName   = DSN;
                crConnectionInfo.DatabaseName = database;
                crConnectionInfo.UserID       = username;
                crConnectionInfo.Password     = password;
                CrTables = rpt.Database.Tables;

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

            catch (CrystalReportsException ex)
            {
                MessageBox.Show("Error: Cannot connect to server" + ex.Message.ToString(), "System Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #16
0
 //Begin
 public static void ShowRp(ReportClass rc, object objDataSource, Window parentWindow, string database, string server, string use, string pass)
 {
     try
     {
         rc.SetDataSource(objDataSource);
         ReportViewUI Viewer = new ReportViewUI();
         //log on
         TableLogOnInfos logonInfos     = new TableLogOnInfos();
         TableLogOnInfo  logonInfo      = new TableLogOnInfo();
         ConnectionInfo  connectioninfo = new ConnectionInfo();
         Tables          CrTables;
         // tham so server
         connectioninfo.DatabaseName = database;
         connectioninfo.ServerName   = server;
         connectioninfo.Password     = pass;
         connectioninfo.UserID       = use;
         CrTables = rc.Database.Tables;
         foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
         {
             logonInfo = CrTable.LogOnInfo;
             logonInfo.ConnectionInfo = connectioninfo;
             CrTable.ApplyLogOnInfo(logonInfo);
         }
         //
         Viewer.setReportSource(rc);
         Viewer.ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
コード例 #17
0
        private void PrintReport_Challan()
        {
            ReportDocument  cryRpt            = new ReportDocument();
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo  crConnectionInfo  = new ConnectionInfo();

            ParameterFields myParameterFields = new ParameterFields();

            ParameterField         myParameterField1 = new ParameterField();
            ParameterDiscreteValue myDiscreteValue1  = new ParameterDiscreteValue();


            string rPath = ReportPaths + "CrystalReportSalesInvoiceChallanA4.rpt";

            cryRpt.Load(rPath);
            crConnectionInfo.ServerName   = ConfigurationManager.ConnectionStrings["cryServer"].ToString();
            crConnectionInfo.DatabaseName = ConfigurationManager.ConnectionStrings["cryDatabase"].ToString();
            crConnectionInfo.UserID       = ConfigurationManager.ConnectionStrings["cryUserID"].ToString();
            crConnectionInfo.Password     = ConfigurationManager.ConnectionStrings["cryPass"].ToString();

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

            TextboxValue("CompanyID", CompanyIDs, myParameterField1, myDiscreteValue1, myParameterFields);

            crystalReportViewer1.ParameterFieldInfo = myParameterFields;
            crystalReportViewer1.Refresh();
            crystalReportViewer1.ReportSource = cryRpt;
        }
コード例 #18
0
        private void ReportViewer_Shown(object sender, EventArgs e)
        {
            ConnectionInfo crConnectionInfo = new ConnectionInfo();

            crConnectionInfo.ServerName   = CMCMS.Properties.Resources.server + " DRIVER={MySQL ODBC 5.3 Unicode Driver};";
            crConnectionInfo.DatabaseName = "cmcms";
            crConnectionInfo.UserID       = "cmcms";
            crConnectionInfo.Password     = "******";
            TableLogOnInfo crTableLogoninfo = new TableLogOnInfo();

            foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in crRpt.Database.Tables)
            {
                crTableLogoninfo = CrTable.LogOnInfo;
                crTableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crTableLogoninfo);
            }
            foreach (ReportDocument subreport in crRpt.Subreports)
            {
                foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in subreport.Database.Tables)
                {
                    crTableLogoninfo = CrTable.LogOnInfo;
                    crTableLogoninfo.ConnectionInfo = crConnectionInfo;
                    CrTable.ApplyLogOnInfo(crTableLogoninfo);
                }
            }

            crystalReportViewer1.ReportSource = crRpt;
            crystalReportViewer1.Refresh();
        }
コード例 #19
0
        private void btnAllReport_Click(object sender, EventArgs e)
        {
            string id = comboBoxInvoiceNo.SelectedValue.ToString();

            ReportDocument  cryRpt            = new ReportDocument();
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo  crConnectionInfo  = new ConnectionInfo();

            string rPath = ReportPaths + "CrystalReportAllStockTransferReturnReport.rpt";

            cryRpt.Load(rPath);

            crConnectionInfo.ServerName   = ConfigurationManager.ConnectionStrings["cryServer"].ToString();
            crConnectionInfo.DatabaseName = ConfigurationManager.ConnectionStrings["cryDatabase"].ToString();
            crConnectionInfo.UserID       = ConfigurationManager.ConnectionStrings["cryUserID"].ToString();
            crConnectionInfo.Password     = ConfigurationManager.ConnectionStrings["cryPass"].ToString();

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

            crystalReportViewer1.Refresh();
            crystalReportViewer1.ReportSource = cryRpt;
        }
コード例 #20
0
        private void bttShow_Click(object sender, EventArgs e)
        {
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
            Tables          CrTables;

            ReportDocument cryRpt = new ReportDocument();

            cryRpt.Load(@"\\192.168.4.7\mis\Program\ProgramEXE\ReportComputerLeasing.rpt");
            crConnectionInfo.ServerName   = "...";
            crConnectionInfo.DatabaseName = "...";
            crConnectionInfo.UserID       = "...";
            crConnectionInfo.Password     = "******";

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

            ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

            crParameterDiscreteValue.Value = txtShowSerailNo.Text;
            cryRpt.DataDefinition.ParameterFields["PSerialNo"].CurrentValues.Clear();
            cryRpt.DataDefinition.ParameterFields["PSerialNo"].CurrentValues.Add(crParameterDiscreteValue);
            cryRpt.DataDefinition.ParameterFields["PSerialNo"].ApplyCurrentValues(cryRpt.DataDefinition.ParameterFields["PSerialNo"].CurrentValues);

            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.Refresh();
        }
コード例 #21
0
        public void Logon_To_Crystal()
        {
            crConnectionInfo.ServerName   = server;
            crConnectionInfo.DatabaseName = database;
            crConnectionInfo.UserID       = UserID;
            crConnectionInfo.Password     = password;
            CrTables = rptDoc.Database.Tables;

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

            foreach (ReportDocument sr in rptDoc.Subreports)
            {
                foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in sr.Database.Tables)
                {
                    crtableLogoninfo = CrTable.LogOnInfo;
                    crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                    CrTable.ApplyLogOnInfo(crtableLogoninfo);
                }
            }
        }
コード例 #22
0
        private void Generate_Reports()
        {
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
            Tables          CrTables;

            cryRpt.Load(Server.MapPath("dbms_summary.rpt"));
            crConnectionInfo.ServerName   = "37.61.235.103";
            crConnectionInfo.DatabaseName = "DBCML";
            crConnectionInfo.UserID       = "sa";
            crConnectionInfo.Password     = "******";
            CrTables = cryRpt.Database.Tables;
            foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
            {
                crtableLogoninfo = CrTable.LogOnInfo;
                crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crtableLogoninfo);
            }
            //string _parm = Request.QueryString[0].ToString();
            string _parm = "ms_" + GetDocNo_All();

            string _nos  = _parm.Substring(3);
            string _type = _parm.Substring(0, 2);

            cryRpt.SetParameterValue("srv", (string)Session["srv"]);
            cryRpt.SetParameterValue("project", (string)Session["projectname"]);
            cryRpt.SetParameterValue("total", _nos);
            cryRpt.SetParameterValue("type", _type);
            CrystalReportViewer1.ReportSource = cryRpt;
            CrystalReportViewer1.DataBind();
            Session["Report"] = cryRpt;
        }
コード例 #23
0
        private void PrintReport()
        {
            TempDamageProductReceiveReport_Truncket();
            TempDamageProductReceiveReport_Stock();
            ReportDocument  cryRpt            = new ReportDocument();
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
            //string rPath = @"C:\Reports\CrystalReportPurchaseReturnReport.rpt";
            string rPath = ReportPaths + "CrystalReportDamageProductReceiveReport.rpt";

            cryRpt.Load(rPath);
            crConnectionInfo.ServerName   = ConfigurationManager.ConnectionStrings["cryServer"].ToString();
            crConnectionInfo.DatabaseName = ConfigurationManager.ConnectionStrings["cryDatabase"].ToString();
            crConnectionInfo.UserID       = ConfigurationManager.ConnectionStrings["cryUserID"].ToString();
            crConnectionInfo.Password     = ConfigurationManager.ConnectionStrings["cryPass"].ToString();

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

            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.RefreshReport();
        }
コード例 #24
0
        private void button1_Click(object sender, EventArgs e)
        {
            ReportDocument  cryRpt            = new ReportDocument();
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
            Tables          CrTables;

            cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt");

            crConnectionInfo.ServerName   = "YOUR SERVER NAME";
            crConnectionInfo.DatabaseName = "YOUR DATABASE NAME";
            crConnectionInfo.UserID       = "YOUR DATABASE USERNAME";
            crConnectionInfo.Password     = "******";

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

            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.Refresh();
        }
コード例 #25
0
        public Form3(int _faktuurno)
        {
            InitializeComponent();
            FaktuurNo = _faktuurno;

            ReportDocument  cryRpt            = new ReportDocument();
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
            Tables          CrTables;

            string path = AppDomain.CurrentDomain.BaseDirectory + "FaktuurPrintOut.rpt";

            cryRpt.Load(path);

            cryRpt.SetParameterValue("FId", FaktuurNo.ToString());

            crConnectionInfo.ServerName   = database.server;
            crConnectionInfo.DatabaseName = database.dbName;
            crConnectionInfo.UserID       = database.username;
            crConnectionInfo.Password     = database.password;

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

            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.Refresh();
        }
コード例 #26
0
        public static void seteazaConexiuneRaport(ReportDocument pRaport)
        {
            string cheie = CInterfataSQLServer.GetConnectionString();// getCheieConfigurare("SQLConnection");

            string[] strConnection = cheie.Split(new char[] { ';' });
            //ConfigurationManager.ConnectionStrings[("SQLConnection")].ConnectionString.Split(new char[] { ';' });

            ConnectionInfo crConnectionInfo = new ConnectionInfo();

            crConnectionInfo.ServerName   = strConnection[0].Split(new char[] { '=' }).GetValue(1).ToString();
            crConnectionInfo.DatabaseName = strConnection[1].Split(new char[] { '=' }).GetValue(1).ToString();
            crConnectionInfo.UserID       = strConnection[2].Split(new char[] { '=' }).GetValue(1).ToString();
            crConnectionInfo.Password     = strConnection[3].Split(new char[] { '=' }).GetValue(1).ToString();

            Tables         CrTables;
            TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();

            CrTables = pRaport.Database.Tables;
            foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
            {
                crtableLogoninfo = CrTable.LogOnInfo;
                crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crtableLogoninfo);
            }
        }
コード例 #27
0
    public void loadcry(string DCNO, string VID)
    {
        TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
        TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
        ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
        Tables          CrTables;
        string          q2 = "SELECT * FROM Quotation WHERE QUTNO=" + DCNO + "  AND VID=" + VID + "";

        Ds  = SqlObj.GetData_DS(q2);
        rep = new ReportDocument();
        rep.Load(Server.MapPath("~/CryQuotation.rpt"));
        rep.SetDataSource(Ds.Tables[0]);
        CrTables = rep.Database.Tables;

        foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
        {
            crtableLogoninfo = CrTable.LogOnInfo;

            crtableLogoninfo.ConnectionInfo = crConnectionInfo;

            CrTable.ApplyLogOnInfo(crtableLogoninfo);
        }
        rep.Refresh();

        CrystalReportViewer1.ReportSource = rep;
        Session["Report"] = rep;

        CrystalReportViewer1.DataBind();
        CrystalReportViewer1.RefreshReport();
    }
コード例 #28
0
        private void loadReport()
        {
            ReportDocument  cryRpt            = new ReportDocument();
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
            Tables          CrTables;

            //SQL Server Connection
            cryRpt.Load("../../Addons/ReportOutstanding/Reports/UXReportOutstanding.rpt");
            crConnectionInfo.ServerName   = DB.Server;
            crConnectionInfo.DatabaseName = DB.Database;
            crConnectionInfo.UserID       = DB.Username;
            crConnectionInfo.Password     = DB.Password;

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

            //Parameter Stored Procedured
            cryRpt.SetParameterValue("@DateTo", Models.ReportOutstanding.DateTo);
            cryRpt.SetParameterValue("@NAMA_PARTNER", Models.ReportOutstanding.Name);
            cryRpt.SetParameterValue("CRDateTo", Models.ReportOutstanding.DateTo);

            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.Refresh();
        }
コード例 #29
0
    public void loadcry(string InvoiceNo)
    {
        TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
        TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
        ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
        Tables          CrTables;
        string          q2 = "SELECT * FROM IncNReport WHERE TAXPREFIX='E' AND INVOICENO='" + InvoiceNo + "'";

        Ds  = SqlObj.GetData_DS(q2);
        rep = new ReportDocument();
        rep.Load(Server.MapPath("~/IncSalesRptwidTAX.rpt"));
        rep.SetDataSource(Ds.Tables[0]);
        CrTables = rep.Database.Tables;

        foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
        {
            crtableLogoninfo = CrTable.LogOnInfo;

            crtableLogoninfo.ConnectionInfo = crConnectionInfo;

            CrTable.ApplyLogOnInfo(crtableLogoninfo);
        }
        rep.Refresh();

        CrystalReportViewer1.ReportSource = rep;
        Session["Report"] = rep;

        CrystalReportViewer1.DataBind();
        CrystalReportViewer1.RefreshReport();
    }
コード例 #30
0
        private void comandaCrystalReports()
        {
            //Crea la comanda i s'envia al viewer
            ReportDocument  comanda           = new ReportDocument();
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
            Tables          CrTables;

            comanda.Load("../gestioComandes/Comanda.rpt");

            crConnectionInfo.ServerName   = "farmaDAM";
            crConnectionInfo.DatabaseName = "g2s2am_FarmaDAM";
            crConnectionInfo.UserID       = "g2s2am";
            crConnectionInfo.Password     = "******";

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

            String dataDeVendes  = dataComanda.Value.ToString();
            String dataFormatada = Convert.ToDateTime(dataDeVendes).ToString("yyyy-MM-dd");

            comanda.RecordSelectionFormula    = "{vendes1.data} = #" + dataFormatada + "#";
            crystalReportViewer1.ReportSource = comanda;
            crystalReportViewer1.Refresh();
        }