Inheritance: ViewContent, IViewContent
Beispiel #1
0
        public override void Run()
        {
            TaskManager mgr = ServiceManager.Instance.GetService<TaskManager>();
            string name = Workbench.Instance.ObjectExplorer.GetSelectedNode().Name;
            EtlProcess proc = mgr.GetTask(name);
            FdoBulkCopy bcp = proc as FdoBulkCopy;
            CancelEventHandler ch = new CancelEventHandler(OnBeforeExecuteBulkCopy);
            if (bcp != null)
            {   
                bcp.BeforeExecute += ch;
            }

            if (proc != null)
            {
                IFdoSpecializedEtlProcess spec = proc as IFdoSpecializedEtlProcess;
                if (spec != null)
                {
                    EtlProcessCtl ctl = new EtlProcessCtl(spec);
                    Workbench.Instance.ShowContent(ctl, ViewRegion.Dialog);
                    if (bcp != null)
                    {
                        bcp.BeforeExecute -= ch;
                    }
                }
                else
                {
                    MessageService.ShowError(ResourceService.GetString("ERR_CANNOT_EXECUTE_UNSPECIALIZED_ETL_PROCESS"));
                }
            }
        }
Beispiel #2
0
        private static void SaveQueryResult(FdoFeatureTable table, string file)
        {
            if (!string.IsNullOrEmpty(file))
            {
                //Ask for class name
                if (string.IsNullOrEmpty(table.TableName))
                {
                    string name = MessageService.ShowInputBox(ResourceService.GetString("TITLE_SAVE_QUERY_AS"), ResourceService.GetString("MSG_SAVE_QUERY_AS"), "QueryResult");
                    while (name != null && name.Trim() == string.Empty)
                    {
                        name = MessageService.ShowInputBox(ResourceService.GetString("TITLE_SAVE_QUERY_AS"), ResourceService.GetString("MSG_SAVE_QUERY_AS"), "QueryResult");
                    }

                    if (name == null)
                    {
                        return;
                    }

                    table.TableName = name;
                }

                using (TableToFlatFile proc = new TableToFlatFile(table, file))
                {
                    EtlProcessCtl ctl = new EtlProcessCtl(proc);
                    Workbench.Instance.ShowContent(ctl, ViewRegion.Dialog);
                }
            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtSavePath.Text))
            {
                MessageService.ShowError("Please specify a file name to save to");
                return;
            }
            string provider = rdSdf.Checked ? "OSGeo.SDF" : "OSGeo.SQLite";

            using (FdoBulkCopy bcp = ExpressUtility.CreateBulkCopy(_source, _schemaName, _className, provider, txtSavePath.Text))
            {
                EtlProcessCtl ctl = new EtlProcessCtl(bcp);
                Workbench.Instance.ShowContent(ctl, ViewRegion.Dialog);
                this.Close();
            }
        }
Beispiel #4
0
        private void btnExecute_Click(object sender, EventArgs e)
        {
            string source = txtSource.Text;
            string target = txtTarget.Text;
            
            if (FileService.FileExists(source) && !string.IsNullOrEmpty(target))
            {
                if (ExpressUtility.IsShp(target))
                {
                    if (File.Exists(target))
                    {
                        if (!DeleteRelated(target))
                            return;
                        else
                            DeleteRelatedFiles(target);
                    }
                    else if (Directory.Exists(target))
                    {
                        string shp = Path.Combine(target, Path.GetFileNameWithoutExtension(source) + ".shp");
                        if (File.Exists(shp) && !DeleteRelated(shp))
                            return;
                        else
                            DeleteRelatedFiles(shp);
                    }
                }

                using (FdoBulkCopy bcp = ExpressUtility.CreateBulkCopy(source, target, chkCopySpatialContexts.Checked, true, chkFlatten.Checked))
                {
                    EtlProcessCtl ctl = new EtlProcessCtl(bcp);
                    Workbench.Instance.ShowContent(ctl, ViewRegion.Dialog);
                    base.Close();
                }
            }
            else
            {
                this.ShowError("Source and Target fields are required");
            }
        }
        private static void SaveQueryResult(FdoFeatureTable table, string file)
        {
            if (!string.IsNullOrEmpty(file))
            {
                //Ask for class name
                if (string.IsNullOrEmpty(table.TableName))
                {
                    string name = MessageService.ShowInputBox(ResourceService.GetString("TITLE_SAVE_QUERY_AS"), ResourceService.GetString("MSG_SAVE_QUERY_AS"), "QueryResult");
                    while (name != null && name.Trim() == string.Empty)
                        name = MessageService.ShowInputBox(ResourceService.GetString("TITLE_SAVE_QUERY_AS"), ResourceService.GetString("MSG_SAVE_QUERY_AS"), "QueryResult");

                    if (name == null)
                        return;

                    table.TableName = name;
                }

                using (TableToFlatFile proc = new TableToFlatFile(table, file))
                {
                    EtlProcessCtl ctl = new EtlProcessCtl(proc);
                    Workbench.Instance.ShowContent(ctl, ViewRegion.Dialog);
                }
            }
        }