public int Add(ScriptStep item)
        {
            if (item == null)
                throw new ArgumentNullException("value");
            return InnerList.Add(item);

        }
 public int Add(ScriptStep item)
 {
     if (item == null)
     {
         throw new ArgumentNullException("value");
     }
     return(InnerList.Add(item));
 }
Esempio n. 3
0
 bool IScriptExecuteCallback.Progress(ScriptStep script, int step, int stepMax)
 {
     if (!canceled)
     {
         this.BeginInvoke(new UpdateUICallback(UpdateUI), new object[] { step });
     }
     return(!canceled);
 }
 public void Insert(int index, ScriptStep item)
 {
     if (item == null)
     {
         throw new ArgumentNullException("value");
     }
     InnerList.Insert(index, item);
 }
Esempio n. 5
0
        private bool ScriptError(ScriptStep step, Exception exception)
        {
            SqlException ex = exception as SqlException;

            if (ex == null)
            {
                MessageBox.Show("Unexpeced error");
                return(false);
            }

            for (int stepIndex = 0; stepIndex < executingScript.Count; stepIndex++)
            {
                if (object.ReferenceEquals(executingScript[stepIndex], step))
                {
                    UpdateUI(stepIndex + 1);
                    break;
                }
            }


            foreach (SqlError e in ex.Errors)
            {
                if (e.Class >= 11)
                {
                    feedbackL.SelectionColor = Color.Red;
                }
                else
                {
                    feedbackL.SelectionColor = Color.Black;
                }
                feedbackL.AppendText(string.Format("{0} - {1}", e.Number, e.Message));
                feedbackL.AppendText("\n");
            }

            if (ex.Class >= 11)
            {
                string commandText = step.CommandText;
                if (commandText.Length > 1000)
                {
                    commandText = commandText.Substring(0, 1000) + "......";
                }

                string message = string.Format("An error occured while executing the SQL Statement\n\n '{0}'\n\n{1}\n\nDo you which to continue running the script anyway?", commandText, ex.Message);
                if (!(MessageBox.Show(this, message, "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes))
                {
                    canceled = true;
                    feedbackL.SelectionColor = Color.Red;
                    feedbackL.AppendText("Canceled");
                    feedbackL.AppendText("\n");
                }
            }


            return(!canceled);
        }
Esempio n. 6
0
 bool IScriptExecuteCallback.Error(ScriptStep step, Exception exception)
 {
     return((bool)this.Invoke(new ScriptErrorCallback(ScriptError), new object [] { step, exception }));
 }
        bool IScriptExecuteCallback.Progress(ScriptStep script, int step, int stepMax)
        {
            if (!canceled)
				this.BeginInvoke(new UpdateUICallback(UpdateUI), new object[] {step});
            return !canceled;
        }
 public ScriptStepGenerateScript(ScriptStep basedOn)
     : base(basedOn.CommandText)
 {
 }
 public bool Contains(ScriptStep item)
 {
     return(InnerList.Contains(item));
 }
 public void CopyTo(ScriptStep[] array, int arrayIndex)
 {
     InnerList.CopyTo(array, arrayIndex);
 }
 public void Remove(ScriptStep item)
 {
     InnerList.Remove(item);
 }
 public bool Contains(ScriptStep item)
 {
     return InnerList.Contains(item);
 }
 public int IndexOf(ScriptStep item)
 {
     return InnerList.IndexOf(item);
 }
 public void Insert(int index, ScriptStep item)
 {
     if (item == null)
         throw new ArgumentNullException("value");
     InnerList.Insert(index, item);
 }
Esempio n. 15
0
        private bool ScriptError(ScriptStep step, Exception exception)
        {
            SqlException ex = exception as SqlException;
            if (ex == null)
            {
                MessageBox.Show("Unexpeced error");
                return false;
            }

            for (int stepIndex = 0; stepIndex < executingScript.Count; stepIndex++)
            {
                if (object.ReferenceEquals(executingScript[stepIndex], step))
                {
                    UpdateUI(stepIndex+1);
                    break;
                }
            }


            foreach (SqlError e in ex.Errors)
            {
                if (e.Class >= 11)
                {
                    feedbackL.SelectionColor = Color.Red;
                }
                else
                {
                    feedbackL.SelectionColor = Color.Black;
                }
                feedbackL.AppendText(string.Format("{0} - {1}", e.Number, e.Message));
                feedbackL.AppendText("\n");
            }

            if (ex.Class >= 11)
            {
                string commandText = step.CommandText;
                if (commandText.Length > 1000)
                    commandText = commandText.Substring(0, 1000) + "......";

                string message = string.Format("An error occured while executing the SQL Statement\n\n '{0}'\n\n{1}\n\nDo you which to continue running the script anyway?", commandText, ex.Message);
                if (!(MessageBox.Show(this,message, "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes))
                {
                    canceled = true;
                    feedbackL.SelectionColor = Color.Red;
                    feedbackL.AppendText("Canceled");
                    feedbackL.AppendText("\n");
                }
            }


            return !canceled;
        }
 public int IndexOf(ScriptStep item)
 {
     return(InnerList.IndexOf(item));
 }
Esempio n. 17
0
        bool IScriptExecuteCallback.Error(ScriptStep step, Exception exception)
        {
			return (bool) this.Invoke(new ScriptErrorCallback(ScriptError), new object [] {step, exception});
        }
 public void Remove(ScriptStep item)
 {
     InnerList.Remove(item);
 }
Esempio n. 19
0
 public ScriptStepGenerateScript(ScriptStep basedOn)
     : base(basedOn.CommandText)
 {
 }