Пример #1
0
        public FormDBIntegrationTask(DBIntegrationTask task)
        {
            InitializeComponent();

            this.task = (DBIntegrationTask)task.Clone();

            BindDatabases();

            showTask();
        }
Пример #2
0
        public void Log(DBIntegrationTask task, string message)
        {
            lbLog.Items.Insert(0, string.Format("{0} {1} : {2}", DateTime.Now.ToString("HH:mm:ss"), task.Name, message));

            if(lbLog.Items.Count>200)
            {
                using (StreamWriter sw = new StreamWriter(logPath, true, Encoding.UTF8))
                {
                    while (lbLog.Items.Count > 100)
                    {
                        sw.WriteLine(lbLog.Items[lbLog.Items.Count - 1].ToString());
                        lbLog.Items.RemoveAt(lbLog.Items.Count - 1);
                    }
                }
            }
        }
Пример #3
0
        private void executeTask(DBIntegrationTask task)
        {
            if (task.Name.StartsWith("[DISABLED]"))
                return;

            ConnectionSettings csSrc = Provider.GetConnection(task.SourceDB);
            ConnectionSettings csDst = Provider.GetConnection(task.DestDB);
            if(csSrc==null)
            {
                Log(task, task.SourceDB + " doesnt exist!");
                return;
            }
            if(csDst==null)
            {
                Log(task, task.DestDB + " doesnt exist!");
                return;
            }

            string code = integData.ScriptIncludeCode + Environment.NewLine + task.Code;

            Interpreter pret = new Interpreter(code, null);
            pret.AddAssembly(typeof(POP3.Pop3Client).Assembly);
            pret.SetAttribute("dbSrc", csSrc.Database);
            pret.SetAttribute("dbDst", csDst.Database);
            pret.SetAttribute("this", task);
            pret.SetAttribute("form", this);
            pret.Parse();
            pret.Execute();

            if (!pret.Successful)
                Log(task, "Error: " + pret.Output);
            else
                Log(task, pret.Output.Trim() + " in " + pret.ExecutingTime + " ms.");
        }
Пример #4
0
        private void btnAddNewTask_Click(object sender, EventArgs e)
        {
            DBIntegrationTask tmp = new DBIntegrationTask();
            tmp.Name = "New Task";
            tmp.Code = "Code...";

            FormDBIntegrationTask form = new FormDBIntegrationTask(tmp);
            if (form.ShowDialog() == DialogResult.OK)
            {
                integData.Tasks.Add(form.Task);
                showCategories(form.Task.Category);
                save();
            }
        }