예제 #1
0
        public override void Run()
        {
            TreeNode    taskNode = Workbench.Instance.ObjectExplorer.GetSelectedNode();
            TaskManager mgr      = ServiceManager.Instance.GetService <TaskManager>();
            //EtlProcess proc = mgr.GetTask(taskNode.Name);
            FdoSpecializedEtlProcess proc = mgr.GetTask(taskNode.Name) as FdoSpecializedEtlProcess;

            if (proc != null && proc.CanSave)
            {
                try
                {
                    string filter = string.Format("{0} (*{1})|*{1}", proc.GetDescription(), proc.GetFileExtension());
                    string file   = FileService.SaveFile(ResourceService.GetString("TITLE_SAVE_TASK"), filter);
                    if (file != null)
                    {
                        proc.Save(file, taskNode.Name);
                        MessageService.ShowMessage(ResourceService.GetStringFormatted("MSG_TASK_SAVED", file));
                    }
                }
                catch (Exception ex)
                {
                    MessageService.ShowError(ex.Message);
                }
            }
        }
예제 #2
0
        public void Save()
        {
            string path = Preferences.SessionDirectory;

            if (!System.IO.Directory.Exists(path))
            {
                System.IO.Directory.CreateDirectory(path);
            }
            else
            {
                string [] files = System.IO.Directory.GetFiles(path, "*" + TaskDefinitionHelper.BULKCOPYDEFINITION);
                foreach (string f in files)
                {
                    System.IO.File.Delete(f);
                }
                files = System.IO.Directory.GetFiles(path, "*" + TaskDefinitionHelper.JOINDEFINITION);
                foreach (string f in files)
                {
                    System.IO.File.Delete(f);
                }
                files = System.IO.Directory.GetFiles(path, "*" + TaskDefinitionHelper.SEQUENTIALPROCESS);
                foreach (string f in files)
                {
                    System.IO.File.Delete(f);
                }
            }

            foreach (string key in _taskDict.Keys)
            {
                FdoSpecializedEtlProcess proc = _taskDict[key] as FdoSpecializedEtlProcess;
                if (proc != null)
                {
                    string file = System.IO.Path.Combine(path, key + proc.GetFileExtension());
                    proc.Save(file, key);
                }
            }
        }