Ejemplo n.º 1
0
        private void TestDestinationConnection(bool quietSuccessful = false)
        {
            // Save destination configuration so it can be loaded by Ninject
            this.Save_DestinationConfiguration();

            string version = "2005-DEST";

            // Get the version to get from the Factory
            if (this.cboDestVersion.SelectedIndex == 0)
            {
                version = "2005-DEST";
            }
            else
            {
                version = "2010-DEST";
            }

            try
            {
                IReportServerTester tester = this.mKernel.Get <IReportServerTester>(version);

                ConnectionTestStatus readStatus  = tester.ReadTest("/");
                ConnectionTestStatus writeStatus = tester.WriteTest("/", Guid.NewGuid().ToString("N"));

                string         msg  = "";
                MessageBoxIcon icon = MessageBoxIcon.None;

                string readMsg    = string.Format("Read test {0}", readStatus.Success == true ? "was successful." : string.Format("failed:\n{0}", readStatus.Error));
                string readLogMsg = string.Format("Read test {0}", readStatus.Success == true ? "was successful." : string.Format("failed: {0}", readStatus.Error));

                string writeMsg    = string.Format("Write test {0}", writeStatus.Success == true ? "was successful." : string.Format("failed:\n{0}", writeStatus.Error));
                string writeLogMsg = string.Format("Write test {0}", writeStatus.Success == true ? "was successful." : string.Format("failed: {0}", writeStatus.Error));

                msg = string.Format("{0}\n\r\n\r{1}", readMsg, writeMsg);

                if (readStatus.Success == false || writeStatus.Success == false)
                {
                    icon = MessageBoxIcon.Error;

                    this.mLogger.Warn(readLogMsg);
                    this.mLogger.Warn(writeLogMsg);
                }
                else
                {
                    this.mLogger.Info(readLogMsg);
                    this.mLogger.Info(writeLogMsg);
                }

                if (!quietSuccessful && (readStatus.Success && writeStatus.Success))
                {
                    MessageBox.Show(msg,
                                    "Destination Test",
                                    MessageBoxButtons.OK,
                                    icon);
                }
            }
            catch (Exception er)
            {
                this.mLogger.Error(er, "Source connection test error.");

                MessageBox.Show(string.Format("Error testing source connection:\n\n{0}", er.Message),
                                "Test Error",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        private void TestSourceConnection(bool quietSuccessful = false)
        {
            // Save source configuration so it can be loaded by Ninject
            this.Save_SourceConfiguration();

            string version = "2005-SRC";

            // Get the version to get from the Factory
            if (this.cboSrcVersion.SelectedIndex == 0)
            {
                version = "2005-SRC";
            }
            else
            {
                version = "2010-SRC";
            }

            try
            {
                IReportServerTester tester = this.mKernel.Get <IReportServerTester>(version);

                ConnectionTestStatus status = tester.ReadTest(this.txtSrcPath.Text);

                if (status.Success)
                {
                    string msg = string.Format("Testing source connection to '{0}' using path '{1}' was successful.",
                                               status.ServerAddress,
                                               status.Path);

                    this.mLogger.Info(msg);

                    if (!quietSuccessful)
                    {
                        MessageBox.Show("Read test was successful.",
                                        "Test Successful",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.None);
                    }
                }
                else
                {
                    string msg = string.Format("Testing source connection to '{0}' using path '{1}' failed: {2}",
                                               status.ServerAddress,
                                               status.Path,
                                               status.Error);

                    this.mLogger.Warn(msg);

                    MessageBox.Show(string.Format("Read test failed:\n\n{0}", status.Error),
                                    "Test Failed",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);
                }
            }
            catch (Exception er)
            {
                this.mLogger.Error(er, "Source connection test error.");

                MessageBox.Show(string.Format("Error testing source connection:\n\n{0}", er.Message),
                                "Test Error",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }