コード例 #1
0
 public Form1()
 {
     Error = new ErrorInfo();
     Error = ReportDeployment.Logic.Program.checkForSSRS();
     InitializeComponent();
     if (!Error.IsOk)
     {
         MessageBox.Show(Error.ErrMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Environment.Exit(1);
     }
 }
コード例 #2
0
        private void btnDeploy_Click(object sender, EventArgs e)
        {
            Error = new ErrorInfo();


            string scriptFileDS = "";
            string scriptDS     = "";

            scriptFileDS = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, _const.C_CreateDataSource);

            if (File.Exists(scriptFileDS))
            {
                // Read entire text file content in one string
                scriptDS = File.ReadAllText(scriptFileDS);
                Console.WriteLine(scriptDS);
            }
            bool folderOK = true;

            if (checkBox1.Checked == true)
            {
                Error = Program.CreateFolder(txtReportingServerURL.Text);
            }
            else
            {
                Error.IsOk = true;
            }

            if (Error.IsOk)
            {
                Regex urlFormat = new Regex("http://*|https://*");
                // run our script
                if (folderOK)
                {
                    if (urlFormat.IsMatch(txtReportingServerURL.Text))
                    {
                        Error = Program.checkURL(txtReportingServerURL.Text);

                        if (Error.IsOk)
                        {
                            if (txtERPDatabase.Text != "" && txtERPServer.Text != "" && txtReportingServerURL.Text != "" && txtERPUserName.Text != "" &&
                                txtERPPassword.Text != "" && txtLynqDatabase.Text != "" && txtLynqServer.Text != "")
                            {
                                Error = Program.checkDatabaseConnection(txtERPServer.Text, txtERPDatabase.Text, txtERPUserName.Text, txtERPPassword.Text, 1);
                                if (Error.IsOk)
                                {
                                    Error = Program.checkDatabaseConnection(txtLynqServer.Text, txtLynqDatabase.Text, txtERPUserName.Text, txtERPPassword.Text, 2);
                                    if (Error.IsOk)
                                    {
                                        Error = Program.RunScript(Program.LoadScript(scriptFileDS), 1, txtReportingServerURL.Text, txtERPServer.Text, txtERPDatabase.Text, txtERPUserName.Text, txtERPPassword.Text, txtSSRSUserName.Text, txtSSRSPassword.Text);
                                        if (Error.IsOk)
                                        {
                                            Error = Program.RunScript(Program.LoadScript(scriptFileDS), 2, txtReportingServerURL.Text, txtLynqServer.Text, txtLynqDatabase.Text, txtLYNQUserName.Text, txtLYNQPassword.Text, txtSSRSUserName.Text, txtSSRSPassword.Text);
                                            if (Error.IsOk)
                                            {
                                                Program.deployReports(txtReportingServerURL.Text);

                                                MessageBox.Show("Deployed Succesfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                MessageBox.Show("Please fill in all fields", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Invalid URL format\nExample: http://ServerName/ReportServer ", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }

            if (!Error.IsOk)
            {
                MessageBox.Show(Error.ErrMessage, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }