示例#1
0
        private void propertyGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            if (propertyGrid.SelectedObject != null)
            {
                ((SrePropertyGrid)propertyGrid.SelectedObject).HasChanged = true;

                int id = 0;
                SreAttributeProperty  aProp  = null;
                SreDataSourceProperty dsProp = null;
                if (propertyGrid.SelectedObject is SreAttributeProperty)
                {
                    aProp = ((SreAttributeProperty)propertyGrid.SelectedObject);
                    id    = aProp.Id;
                }
                else if (propertyGrid.SelectedObject is SreDataSourceProperty)
                {
                    dsProp = ((SreDataSourceProperty)propertyGrid.SelectedObject);
                    id     = dsProp.Id;
                }

                if (id != 0)
                {
                    errorProvider1.SetError(picIcon, "Property has been changed, will be auto saved when the property if unloaded! Click save button to save now.");
                }
                else if (dsProp != null)
                {
                    ValidateNewDataSource(dsProp);
                }
            }
        }
示例#2
0
        private string ShowFtpEditor(IWindowsFormsEditorService wfes, SreDataSourceProperty dsProperty)
        {
            frmFtpConfiguration ftpConfig = new frmFtpConfiguration();

            if (dsProperty.PusherTypeFullName.Contains("|"))
            {
                if (dsProperty.PusherTypeFullName.Split("|".ToCharArray()).Length == 3)
                {
                    ftpConfig.FtpRemoteLocation = dsProperty.PusherTypeFullName.Split("|".ToCharArray())[0];
                    ftpConfig.FtpUserName       = dsProperty.PusherTypeFullName.Split("|".ToCharArray())[1];
                    ftpConfig.FtpPassword       = dsProperty.PusherTypeFullName.Split("|".ToCharArray())[2];
                }
            }
            if (ftpConfig.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string updatedFtpDetails = string.Format("{0}|{1}|{2}",
                                                         ftpConfig.FtpRemoteLocation, ftpConfig.FtpUserName, ftpConfig.FtpPassword);

                if (dsProperty.PusherTypeFullName != updatedFtpDetails)
                {
                    dsProperty.PusherTypeFullName = updatedFtpDetails;
                }
                return(dsProperty.PusherTypeFullName);
            }
            return(string.Empty);
        }
示例#3
0
        private void OnRuleAddClick(object sender, EventArgs e)
        {
            ListViewItem  item             = null;
            List <String> doNotIncludeList = selectedRuleListView.ListView.Items.Cast <ListViewItem>().Select(i => i.Text).ToList();

            frmSelectRule frmSelectRuleSet = new frmSelectRule(doNotIncludeList);

            if (frmSelectRuleSet.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                item     = new ListViewItem(frmSelectRuleSet.SelectedRule.Name);
                item.Tag = frmSelectRuleSet.SelectedRule;
            }

            if (item == null)
            {
                return;
            }

            int priority = selectedRuleListView.ListView.Items.Count + 1;

            item.SubItems.Add(priority.ToString());
            selectedRuleListView.ListView.Items.Add(item);

            SreDataSourceProperty.KeepVersion(this.DataSource.Id);

            IdpeRuleDataSource idpeRuleDataSource = new IdpeRuleDataSource();

            idpeRuleDataSource.DataSourceId = DataSource.Id;
            idpeRuleDataSource.RuleId       = frmSelectRuleSet.SelectedRule.Id;
            idpeRuleDataSource.Priority     = priority;
            idpeRuleDataSource.RuleSetType  = (int)selectedRuleSetType;
            new DataManager.Manager().Save(idpeRuleDataSource);
        }
示例#4
0
        public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService wfes = provider.GetService(typeof(IWindowsFormsEditorService)) as
                                              IWindowsFormsEditorService;

            SreDataSourceProperty dsProperty = context.Instance as SreDataSourceProperty;

            if (wfes != null)
            {
                switch (dsProperty.PostEvent)
                {
                case PusherTypes.DosCommands:
                    value = ShowDOSCommandEditor(wfes, dsProperty);
                    break;

                case PusherTypes.Ftp:
                    return(ShowFtpEditor(wfes, dsProperty));

                    break;

                case PusherTypes.SqlQuery:
                    return(ShowSqlEditor(wfes, dsProperty));

                    break;

                case PusherTypes.Custom:
                    value = ShowCustomInterfaceEditor(wfes, dsProperty);
                    break;
                }
            }
            return(value);
        }
示例#5
0
        public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService wfes = provider.GetService(typeof(IWindowsFormsEditorService)) as
                                              IWindowsFormsEditorService;
            SreDataSourceProperty dsProperty = context.Instance as SreDataSourceProperty;

            if (wfes != null)
            {
                switch (dsProperty.DataFormatType)
                {
                case DataFormatTypes.Delimited:
                case DataFormatTypes.FixedLength:
                    frmConfig2 config = new frmConfig2(dsProperty.Id, dsProperty.Name, dsProperty.DataFormatType);
                    wfes.ShowDialog(config);
                    break;

                case DataFormatTypes.Xml:
                    frmConfigXml configXml = new frmConfigXml(dsProperty.Id);
                    wfes.ShowDialog(configXml);
                    //    this.DataSourceKeys = _Manager.GetKeys(DataSource.Id);
                    break;

                case DataFormatTypes.Zipped:
                    frmConfigZip configzip = new frmConfigZip(dsProperty.Id);
                    wfes.ShowDialog(configzip);
                    //this.DataSourceKeys = _Manager.GetKeys(DataSource.Id);
                    //this.DataSource = new Manager().GetApplicationDetails(DataSource.Id);

                    break;

                case DataFormatTypes.EDIX12:
                    frmConfigEDI ediConfig = new frmConfigEDI(dsProperty.Id);
                    wfes.ShowDialog(ediConfig);
                    break;

                case DataFormatTypes.MultiRecord:
                    ConfigCSharpInputGenerator cSharpConfig = new ConfigCSharpInputGenerator(dsProperty.Id, DataFormatTypes.MultiRecord);
                    wfes.ShowDialog(cSharpConfig);
                    break;

                case DataFormatTypes.CSharpCode:
                    cSharpConfig = new ConfigCSharpInputGenerator(dsProperty.Id, DataFormatTypes.CSharpCode);
                    wfes.ShowDialog(cSharpConfig);
                    break;

                case DataFormatTypes.Sql:
                    MessageBox.Show("No configuration required!", "Configuration Not Required", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    break;

                case DataFormatTypes.Custom:
                    return(ShowCustomInterfaceEditor(wfes, dsProperty));

                    break;
                }
            }
            return(value);
        }
示例#6
0
        private void DisassociateRuleFromDatabase(ListView listView, bool deleteRule)
        {
            SreDataSourceProperty.KeepVersion(this.DataSource.Id);

            IdpeRule rule = (IdpeRule)listView.SelectedItems[0].Tag;

            new Manager().DeleteRuleFromDataSource(DataSource.Id, rule.Id, selectedRuleSetType, deleteRule);
            listView.Items.Remove(listView.SelectedItems[0]);
            Bind();
        }
示例#7
0
        public void DisassociateAttributeFromDataSource(ListViewControl sreListView1, bool isSystemDataSource = false)
        {
            int     dataSourceId = isSystemDataSource ? (int)SelectedDataSource.SystemDataSourceId : SelectedDataSource.Id;
            bool    saved        = false;
            Manager manager      = new Manager();

            SreDataSourceProperty.KeepVersion(dataSourceId);

            if (sreListView1.ListView.SelectedItems.Count > 0)
            {
                if ((sreListView1.ListView.SelectedItems.Count == 1) &&
                    (sreListView1.ListView.SelectedItems[0].Text != "IsValid"))
                {
                    if (MessageBox.Show(string.Format("You are about to disassociate {0} from {1}. Are you sure?", sreListView1.ListView.SelectedItems[0].Text, SelectedDataSource.Name),
                                        "Disassociate Attribute", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                    {
                        return;
                    }

                    if (manager.DisassociateAttributeFromDataSource(dataSourceId, (sreListView1.ListView.SelectedItems[0].Tag as IdpeAttribute).AttributeId) == true)
                    {
                        sreListView1.ListView.Items.Remove(sreListView1.ListView.SelectedItems[0]);
                        saved = true;
                    }
                }
                else
                {
                    foreach (ListViewItem selectedItem in sreListView1.ListView.SelectedItems)
                    {
                        if (selectedItem.Text != "IsValid")
                        {
                            if (manager.DisassociateAttributeFromDataSource(dataSourceId, (selectedItem.Tag as IdpeAttribute).AttributeId) == true)
                            {
                                sreListView1.ListView.Items.Remove(sreListView1.ListView.SelectedItems[0]);
                            }
                            saved = true;
                        }
                    }
                }
            }

            if (saved)
            {
                SaveAssociations(sreListView1.ListView, isSystemDataSource, false);
            }

            if (ServiceCommunicator.ClearDataSource(SelectedDataSource.Id, string.Empty))
            {
                SetToolStripStatusLabel("Ready");
            }
            else
            {
                SetToolStripStatusLabel("Failed to clear cache", true);
            }
        }
示例#8
0
        private string ShowCustomInterfaceEditor(IWindowsFormsEditorService wfes, SreDataSourceProperty dsProperty)
        {
            TypeSelectorDialog activitySelector = new TypeSelectorDialog(typeof(Pushers));

            if ((wfes.ShowDialog(activitySelector) == DialogResult.OK) &&
                (!String.IsNullOrEmpty(activitySelector.AssemblyPath) && activitySelector.Activity != null))
            {
                string strPostEvent = string.Format("{0}, {1}", activitySelector.Activity.FullName, Path.GetFileNameWithoutExtension(activitySelector.AssemblyPath));
                dsProperty.PostEventCustomInterfaceName = strPostEvent;
                return(strPostEvent);
            }

            return(string.Empty);
        }
示例#9
0
        private string ShowCustomInterfaceEditor(IWindowsFormsEditorService wfes, SreDataSourceProperty dsProperty)
        {
            TypeSelectorDialog activitySelector = new TypeSelectorDialog(typeof(InputFileGenerator));

            if ((wfes.ShowDialog(activitySelector) == DialogResult.OK) &&
                (!String.IsNullOrEmpty(activitySelector.AssemblyPath) && activitySelector.Activity != null))
            {
                string interfaceName = string.Format("{0}, {1}", activitySelector.Activity.FullName, Path.GetFileNameWithoutExtension(activitySelector.AssemblyPath));

                new Manager().SaveCustomConfig(dsProperty.Id, interfaceName, dsProperty.HasHeader);
                return(interfaceName);
            }

            return(string.Empty);
        }
示例#10
0
        private void tsbSave_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            switch (tabControl1.SelectedIndex)
            {
            case 2: SreDataSourceProperty.KeepVersion(this.DataSource.Id); this.idpeKeys1.Save(); break;

            case 3: SreDataSourceProperty.KeepVersion(this.DataSource.Id); this.sreEmails1.Save(); break;

            case 4: SreDataSourceProperty.KeepVersion(this.DataSource.Id); this.sreDatabases1.Save(); break;
            }

            if (propertyGrid.SelectedObject is SreAttributeProperty)
            {
                SreAttributeProperty aProp = propertyGrid.SelectedObject as SreAttributeProperty;
                if ((aProp != null) && (aProp.HasChanged == true))
                {
                    MainWindow.SetToolStripStatusLabel("Please wait...Saving...");
                    Application.DoEvents();
                    aProp.Save();
                    aProp.HasChanged = false;
                    errorProvider1.Clear();
                    DockPanelGlobalAttributes.RefreshData(aProp.Attribute.AttributeId);
                }
            }
            else if (propertyGrid.SelectedObject is SreDataSourceProperty)
            {
                SreDataSourceProperty dsProp = propertyGrid.SelectedObject as SreDataSourceProperty;

                if ((dsProp != null) && (dsProp.HasChanged == true))
                {
                    string errorMsg = errorProvider1.GetError(picIcon);
                    if ((errorMsg.StartsWith("Property has been changed, will be auto saved")) ||
                        (string.IsNullOrEmpty(errorProvider1.GetError(picIcon))))
                    {
                        MainWindow.SetToolStripStatusLabel("Please wait...Saving...");
                        Application.DoEvents();
                        dsProp.Save();
                        dsProp.HasChanged = false;
                        errorProvider1.Clear();
                        DockPanelDataSources.RefreshData(dsProp.DataSource.Id);
                    }
                }
            }

            tsbClearCache_Click(sender, e);
        }
示例#11
0
        public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService wfes = provider.GetService(typeof(IWindowsFormsEditorService)) as
                                              IWindowsFormsEditorService;
            SreDataSourceProperty dsProperty = context.Instance as SreDataSourceProperty;

            if (wfes != null)
            {
                switch (dsProperty.OutputDataFormatType)
                {
                case OutputTypes.CSharpCode:
                    IdpeKey          key              = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.CSharpCodeOutputWriter.ToString());
                    string           code             = key != null ? key.Value : string.Empty;
                    CSharpCodeEditor cSharpCodeEditor = new CSharpCodeEditor(code);
                    if (cSharpCodeEditor.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        new Manager().SaveOutputWriterCSharpCode(dsProperty.Id, cSharpCodeEditor.CSharpCodeInformation.RawString);
                        dsProperty.DataSourceKeys = new Manager().GetKeys(dsProperty.Id);
                    }
                    break;

                case OutputTypes.FixedLength:
                    frmOutputWriterFixedLength outputWriterFixedLength = new frmOutputWriterFixedLength(
                        dsProperty.Id, (int)dsProperty.SystemDataSourceId);
                    outputWriterFixedLength.ShowDialog();
                    break;

                case OutputTypes.Database:
                    ConfigDatabaseWriter configDatabaseWriter = new ConfigDatabaseWriter(dsProperty.Id, (int)dsProperty.SystemDataSourceId);
                    ElementHost.EnableModelessKeyboardInterop(configDatabaseWriter);
                    configDatabaseWriter.Show();
                    break;

                case OutputTypes.Custom:
                    return(ShowCustomInterfaceEditor(wfes, dsProperty));

                    break;
                }
            }
            return(value);
        }
示例#12
0
        private void ValidateNewDataSource(SreDataSourceProperty dsProp)
        {
            string errorMessage = string.Empty;

            if (string.IsNullOrEmpty(dsProp.Name))
            {
                errorMessage += "Name field is mandatory, it has to be unique!" + Environment.NewLine;
            }
            if (dsProp.SystemDataSourceId == 0)
            {
                errorMessage += "Select system name of the data source!" + Environment.NewLine;
            }
            if (!string.IsNullOrEmpty(dsProp.ValidationError))
            {
                errorMessage += dsProp.ValidationError;
            }

            errorProvider1.Clear();
            errorProvider1.SetError(picIcon, errorMessage);
        }
示例#13
0
        void SaveAssociations(ListView listView, bool isSystemDataSource = false, bool takeCareOfOldVersion = true)
        {
            int     dataSourceId = isSystemDataSource ? (int)SelectedDataSource.SystemDataSourceId : SelectedDataSource.Id;
            Manager manager      = new Manager();

            if (takeCareOfOldVersion)
            {
                SreDataSourceProperty.KeepVersion(dataSourceId);
            }

            int position = 1;

            foreach (ListViewItem item in listView.Items)
            {
                IdpeAttribute attribute = item.Tag as IdpeAttribute;
                if (attribute.Name == "IsValid")
                {
                    continue;
                }
                IdpeAttributeDataSource sds = new IdpeAttributeDataSource();
                sds.DataSourceId              = dataSourceId;
                sds.IsAcceptable              = (bool)attribute.IsAcceptable;
                sds.AttributeId               = attribute.AttributeId;
                sds.AttributePrintValueType   = attribute.AttributePrintValueType;
                sds.AttributePrintValueCustom = attribute.AttributePrintValueCustom;
                sds.Position = position;
                toolStripStatusLabel1.Text = "Please wait...Saving..." + attribute.Name;
                Application.DoEvents();
                try
                {
                    manager.Save(sds);
                }
                catch
                {
                    MessageBox.Show(string.Format("{0} could not be loaded!", attribute.Name), "Attribute Skipped", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                position++;
            }
        }
示例#14
0
        void SaveAssociations(ListView listView, bool isSystem)
        {
            Manager manager = new Manager();

            SreDataSourceProperty.KeepVersion(isSystem ? (int)SelectedDataSource.SystemDataSourceId: SelectedDataSource.Id);

            int position = 1;

            foreach (ListViewItem item in listView.Items)
            {
                IdpeAttribute           attribute = item.Tag as IdpeAttribute;
                IdpeAttributeDataSource sds       = new IdpeAttributeDataSource();
                sds.DataSourceId = isSystem ? (int)SelectedDataSource.SystemDataSourceId : SelectedDataSource.Id;
                sds.AttributeId  = attribute.AttributeId;
                if (isSystem == false)
                {
                    sds.IsAcceptable = true;
                }
                else
                {
                    sds.IsAcceptable = (bool)attribute.IsAcceptable;
                }

                sds.AttributePrintValueType   = attribute.AttributePrintValueType;
                sds.AttributePrintValueCustom = attribute.AttributePrintValueCustom;
                sds.Position = position;
                manager.Save(sds);
                position++;
            }
            if (!isSystem)
            {
                DockPanelDataSourceAttributes.DataSourceId = SelectedDataSource.Id;
            }
            else
            {
                DockPanelDataSourceSystemAttributes.SystemDataSourceId = (int)SelectedDataSource.SystemDataSourceId;
            }
        }
示例#15
0
        public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            SreDataSourceProperty dsProperty = context.Instance as SreDataSourceProperty;

            if (dsProperty.DataFeederType == DataFeederTypes.Push)
            {
                return(new StandardValuesCollection(new DataFormatTypes[] { DataFormatTypes.Delimited, DataFormatTypes.FixedLength, DataFormatTypes.Xml, DataFormatTypes.Custom }));
            }
            else if (dsProperty.DataFeederType == DataFeederTypes.PullSql)
            {
                return(new StandardValuesCollection(new DataFormatTypes[] { DataFormatTypes.Delimited, DataFormatTypes.Custom }));
            }
            else if (dsProperty.DataFeederType == DataFeederTypes.PullFtp)
            {
                return(new StandardValuesCollection(new DataFormatTypes[] { DataFormatTypes.Delimited, DataFormatTypes.FixedLength, DataFormatTypes.Xml, DataFormatTypes.SpreadSheet,
                                                                            DataFormatTypes.Zipped, DataFormatTypes.EDIX12, DataFormatTypes.MultiRecord, DataFormatTypes.CSharpCode, DataFormatTypes.Custom }));
            }
            else
            {
                return(new StandardValuesCollection(new DataFormatTypes[] { DataFormatTypes.Delimited, DataFormatTypes.FixedLength, DataFormatTypes.Xml, DataFormatTypes.SpreadSheet,
                                                                            DataFormatTypes.Sql, DataFormatTypes.Zipped, DataFormatTypes.EDIX12, DataFormatTypes.MultiRecord, DataFormatTypes.CSharpCode, DataFormatTypes.Custom }));
            }
        }
示例#16
0
        private string ShowSqlEditor(IWindowsFormsEditorService wfes, SreDataSourceProperty dsProperty)
        {
            frmConfigSql configSql = new frmConfigSql(dsProperty.Id, true, "Push Sql Configuration");

            if ((dsProperty.PusherTypeFullName != null) &&
                (dsProperty.PusherTypeFullName.Contains("|")))
            {
                string[] strInfo = dsProperty.PusherTypeFullName.Split("|".ToCharArray());
                configSql.pullSqlConfiguration1.ConnectionStringKeyNameDesign = strInfo[0];
                configSql.pullSqlConfiguration1.ConnectionStringKeyName       = strInfo[1];
                configSql.pullSqlConfiguration1.UpdateQuery = strInfo[2];
            }
            if (configSql.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                dsProperty.PusherTypeFullName = string.Format("{0}|{1}|{2}",
                                                              configSql.pullSqlConfiguration1.ConnectionStringKeyNameDesign,
                                                              configSql.pullSqlConfiguration1.ConnectionStringKeyName,
                                                              configSql.pullSqlConfiguration1.UpdateQuery);

                return(dsProperty.PusherTypeFullName);
            }
            return(string.Empty);
        }
示例#17
0
        public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService wfes = provider.GetService(typeof(IWindowsFormsEditorService)) as
                                              IWindowsFormsEditorService;

            SreDataSourceProperty dsProperty = context.Instance as SreDataSourceProperty;

            if (wfes != null)
            {
                SystemDataSources sds = new SystemDataSources(Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location), dsProperty.SystemDataSourceId);
                if (sds.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    if (sds.SelectedSystemDataSource != null)
                    {
                        value = sds.SelectedSystemDataSource.Name;
                        dsProperty.SystemName         = sds.SelectedSystemDataSource.Name;
                        dsProperty.SystemDataSourceId = sds.SelectedSystemDataSource.Id;
                    }
                }
            }
            return(value);
        }
示例#18
0
        private string ShowDOSCommandEditor(IWindowsFormsEditorService wfes, SreDataSourceProperty dsProperty)
        {
            TextArea textArea = new TextArea("Configure Push DOS Commands");

            if ((dsProperty.PusherTypeFullName != null) &&
                (!dsProperty.PusherTypeFullName.StartsWith("ftp://")))
            {
                textArea.txtContent.Text = dsProperty.PusherTypeFullName;
            }

            string sreDosHelpCommands = string.Empty;

            using (Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("Eyedia.IDPE.Interface.EmbeddedResources.SreDosCommandsHelp.txt"))
                using (StreamReader reader = new StreamReader(stream))
                {
                    sreDosHelpCommands = reader.ReadToEnd();
                }

            textArea.HintContent1            = sreDosHelpCommands;
            textArea.HintContent1WindowTitle = "IDPE DOS Commands Help";

            if (textArea.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (dsProperty.PusherTypeFullName == null)
                {
                    dsProperty.PusherTypeFullName = textArea.txtContent.Text;
                    return(dsProperty.PusherTypeFullName);
                }
                else if (dsProperty.PusherTypeFullName != textArea.txtContent.Text)
                {
                    dsProperty.PusherTypeFullName = textArea.txtContent.Text;
                    return(dsProperty.PusherTypeFullName);
                }
            }
            return(string.Empty);
        }
示例#19
0
        public void runTestToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            if (m_dm_Property.propertyGrid.SelectedObject is SreDataSourceProperty)
            {
                SreDataSourceProperty dsProp = m_dm_Property.propertyGrid.SelectedObject as SreDataSourceProperty;
                if (string.IsNullOrEmpty(dsProp.TestFileName))
                {
                    MessageBox.Show("Cannot start test bed, please set a test file on property window!",
                                    "IDPE - Test Bed", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    {
                        this.Cursor = Cursors.Default;
                        return;
                    }
                }

                if (!File.Exists(dsProp.TestFileName))
                {
                    MessageBox.Show("Cannot start test bed, " + dsProp.TestFileName + "  does not exist!",
                                    "IDPE - Test Bed", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    {
                        this.Cursor = Cursors.Default;
                        return;
                    }
                }
                string traceFileName = string.Empty;
                bool   useWcf        = false; //todo
                if (useWcf)
                {
                    traceFileName = EnvironmentFiles.StartTestBed(true);
                    SreEnvironment local  = EnvironmentServiceDispatcherFactory.GetEnvironmentLocal();
                    string         result = EnvironmentServiceDispatcherFactory.GetInstance(true).ProcessFile(local.EnvironmentConfigsInstancesOnly[0],
                                                                                                              dsProp.DataSource.Id, dsProp.TestFileName);
                }
                else
                {
                    string pullFolder = DataSource.GetPullFolder(dsProp.DataSource.Id, dsProp.DataSourceKeys);
                    traceFileName = EnvironmentFiles.ProcessTestFile(pullFolder, dsProp.TestFileName);
                }

                if (!string.IsNullOrEmpty(traceFileName))
                {
                    System.Threading.Thread.Sleep(1000);//service needs time to start
                    if (Application.OpenForms.OfType <Log>().Count() == 1)
                    {
                        Application.OpenForms.OfType <Log>().First().Focus();
                    }
                    else
                    {
                        Log log = new Log("IDPE - Test Bed", traceFileName);
                        log.Show();
                    }
                }
                else
                {
                    MessageBox.Show("Cannot start test bed, please contact support or reinstall IDPE!",
                                    "IDPE - Test Bed", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
            }
            this.Cursor = Cursors.Default;
        }
示例#20
0
        public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService wfes = provider.GetService(typeof(IWindowsFormsEditorService)) as
                                              IWindowsFormsEditorService;

            SreDataSourceProperty dsProperty = context.Instance as SreDataSourceProperty;

            if (wfes != null)
            {
                switch (dsProperty.DataFeederType)
                {
                case DataFeederTypes.PullSql:

                    frmConfigSql configPullSql = new frmConfigSql(dsProperty.Id);
                    wfes.ShowDialog(configPullSql);
                    break;


                default:

                    DataFormatTypes selType = dsProperty.DataFormatType;
                    if ((selType == DataFormatTypes.Xml) ||
                        (selType == DataFormatTypes.Zipped))
                    {
                        selType = DataFormatTypes.Delimited;      //to prevent showing xml/zip UI when clicked from this button.
                    }
                    frmConfig configUI = new frmConfig(true, dsProperty.Id, dsProperty.DataFeederType, selType);

                    IdpeKey key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.FtpRemoteLocation.ToString());
                    configUI.FtpRemoteLocation = key != null ? key.Value : string.Empty;
                    key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.LocalLocation.ToString());
                    key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.FtpUserName.ToString());
                    configUI.FtpUserName = key != null ? key.Value : string.Empty;
                    key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.FtpPassword.ToString());
                    configUI.FtpPassword = key != null ? key.Value : string.Empty;
                    key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.FtpWatchInterval.ToString());
                    configUI.Interval = int.Parse(key != null ? key.Value : "2");
                    key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.WatchFilter.ToString());
                    configUI.WatchFilter = key != null ? key.Value : "All(No Filter)";

                    key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.FileInterfaceName.ToString());
                    if (key != null)
                    {
                        configUI.InterfaceName = key.Value;
                    }

                    key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.IsFirstRowHeader.ToString());
                    if (key != null)
                    {
                        configUI.IsFirstRowIsHeader = key.Value.ParseBool();
                    }


                    key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.LocalFileSystemFoldersOverriden.ToString());
                    configUI.LocalFileSystemFoldersOverriden = key != null?key.Value.ParseBool() : false;

                    key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.LocalFileSystemFolderArchiveAuto.ToString());
                    configUI.LocalFileSystemFolderArchiveAuto = key != null?key.Value.ParseBool() : false;

                    key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.LocalFileSystemFolderPull.ToString());
                    configUI.LocalFileSystemFolderPullFolder = key != null ? key.Value : string.Empty;

                    key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.LocalFileSystemFolderArchive.ToString());
                    configUI.LocalFileSystemFolderArchiveFolder = key != null ? key.Value : string.Empty;

                    key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.LocalFileSystemFolderOutput.ToString());
                    configUI.LocalFileSystemFolderOutputFolder = key != null ? key.Value : string.Empty;


                    wfes.ShowDialog(configUI);
                    //this.DataSourceKeys = _Manager.GetKeys(DataSource.Id);


                    break;
                }
            }
            return(value);
        }