コード例 #1
0
        protected void StartRun()
        {
            if (ENV == Utility.ENV.LOCAL)
            {
                try
                {
                    string envMessage = BU.ToString() + " - " + ENV.ToString() + " - " + Period.ToString();

                    if (MessageBox.Show("Start run " + envMessage + " ?", "Start Run", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        string cs = Utility.GetConnectionString(ENV, BU, Period);

                        string startRunQuery = (BU == Utility.BU.ILVB ? SQLQueries.SQL_START_RUN_ILH : SQLQueries.SQL_START_RUN_ILSB);
                        startRunQuery = startRunQuery.Replace("<PERIOD>", Period == Utility.PERIOD.MAAND ? "MAAND" : "DAG");
                        startRunQuery = startRunQuery.Replace("<Kalenderdatum>", FormatDate4DB(CalendarDate));

                        int    rc      = this.SqlDA.ExecuteSQLCommand(cs, startRunQuery);
                        string message = "Run Started, " + envMessage;
                        _toolStripStatusLabel.Text = DateTime.Now.ToString() + ": " + message;
                        MessageBox.Show(message);
                        this.Close();
                    }
                }
                catch (Exception ex)
                {
                    string message = ex.Message;
                    if (message.Length > 100)
                    {
                        message = message.Substring(0, 100);
                    }
                    _toolStripStatusLabel.Text = DateTime.Now.ToString() + ": " + message;
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                _toolStripStatusLabel.Text = DateTime.Now.ToString() + ": Function only available on local machine";
            }
        }
コード例 #2
0
        protected void AbortRun()
        {
            if (ENV == Utility.ENV.LOCAL)
            {
                if (SsisRunID > 0)
                {
                    try
                    {
                        string envMessage = BU.ToString() + " - " + ENV.ToString() + " - " + Period.ToString();

                        if (MessageBox.Show("Abort run " + envMessage + " ?", "Abort Run", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            string cs = Utility.GetConnectionString(ENV, BU, Period);

                            string abortRunQuery = SQLQueries.SQL_ABORT_RUN.Replace("<RunID>", this.SsisRunID.ToString());
                            int    rc            = SqlDA.ExecuteSQLCommand(cs, abortRunQuery);
                            string message       = "Run Aborted, " + envMessage;
                            _toolStripStatusLabel.Text = DateTime.Now.ToString() + ": " + message;
                            MessageBox.Show(message);
                            this.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        ShowMessage(ex.Message);
                    }
                }
                else
                {
                    _toolStripStatusLabel.Text = DateTime.Now.ToString() + ": No valid SSIS Run ID available";
                }
            }
            else
            {
                _toolStripStatusLabel.Text = DateTime.Now.ToString() + ": Function only available on local machine";
            }
        }