Ejemplo n.º 1
0
 void Init(int?applicationId)
 {
     _DataManager = new Manager();
     if (applicationId != null)
     {
         _Application       = _DataManager.GetApplicationDetails((int)applicationId);
         lblFrom.Text       = _Application.Name;
         txtExportFile.Text = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), _Application.Name + ".srex");
     }
     if (_Exporting)
     {
         this.Text       = "Export Application";
         label1.Visible  = true;
         label3.Text     = "To";
         lblFrom.Visible = true;
     }
     else
     {
         this.Text          = "Import Application";
         label1.Visible     = false;
         label3.Text        = "From";
         lblFrom.Visible    = false;
         txtExportFile.Text = "";
     }
 }
Ejemplo n.º 2
0
        void Init(int?dataSourceId)
        {
            if ((dataSourceId != null) &&
                (dataSourceId != 0))
            {
                _DataSource        = new Manager().GetApplicationDetails((int)dataSourceId);
                lblFrom.Text       = _DataSource.Name;
                txtExportFile.Text = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), _DataSource.Name + ".srex");
            }
            if (_Exporting)
            {
                this.Text       = "Export Data Source";
                label1.Visible  = true;
                label3.Text     = "To";
                lblFrom.Visible = true;
            }
            else
            {
                this.Text          = "Import Data Source";
                label1.Visible     = false;
                label3.Text        = "From";
                lblFrom.Visible    = false;
                txtExportFile.Text = "";

                label3.Top        = label1.Top;
                txtExportFile.Top = label1.Top;
                btnBrowse.Top     = label1.Top;
                this.Height       = 125;
            }
        }
Ejemplo n.º 3
0
 public frmCopyApplication(int fromApplicationId)
 {
     InitializeComponent();
     _UtilDataManager  = new UtilDataManager();
     _AttributeManager = new Manager();
     _FromApplication  = _AttributeManager.GetApplicationDetails(fromApplicationId);
     lblFrom.Text      = _FromApplication.Name;
 }
Ejemplo n.º 4
0
        private void cbDataSources_SelectedIndexChanged(object sender, EventArgs e)
        {
            SreDataSource selectedDataSource = cbDataSources.SelectedItem as SreDataSource;

            DataSourceId       = selectedDataSource.Id;
            SystemDataSourceId = (int)selectedDataSource.SystemDataSourceId;

            BindData();
        }
Ejemplo n.º 5
0
        //private List<SreKey> Keys
        //{
        //    get
        //    {
        //        List<SreKey> keys = Cache.Instance.Bag[DataSourceId + ".keys"] as List<SreKey>;
        //        if (keys == null)
        //        {
        //            keys = new Manager().GetApplicationKeys(DataSourceId, true);
        //            Cache.Instance.Bag.Add(DataSourceId + ".keys", keys);
        //        }
        //        return keys;
        //    }
        //}
        #endregion Properties

        /// <summary>
        /// Keeps pulling from database (MS SQL, MS SQL CE, Oracle)
        /// </summary>
        /// <param name="dataSource">The data source object</param>
        public SqlWatcher(SreDataSource dataSource)
        {
            this.DataSource = new DataSource(dataSource.Id, string.Empty);
            //DataSourceName = dataSource.Name;
            ProcessingBy = dataSource.ProcessingBy;
            if (string.IsNullOrEmpty(ProcessingBy))
            {
                ProcessingBy = dataSource.Name;
            }

            string strinterval = DataSource.Keys.GetKeyValue(SreKeyTypes.SqlWatchInterval);
            int    interval    = 0;

            int.TryParse(strinterval, out interval);
            if (interval <= 0)
            {
                interval = 2;
            }
            this.Interval = interval;

            string appPullFolder   = SreConfigurationSection.CurrentConfig.LocalFileWatcher.DirectoryPull + "\\" + dataSource.Id;
            string appOutputFolder = SreConfigurationSection.CurrentConfig.LocalFileWatcher.DirectoryOutput + "\\" + dataSource.Id + "\\" + DateTime.Now.ToString("yyyyMMdd");

            this.DataSourceParameters = new Dictionary <string, object>();

            DataSourceParameters.Add("DataSourceId", dataSource.Id);
            DataSourceParameters.Add("PullFolder", appPullFolder);
            DataSourceParameters.Add("OutputFolder", appOutputFolder);
            DataSourceParameters.Add("ProcessingBy", dataSource.ProcessingBy);

            this.ReturnType = DataSource.Keys.GetKeyValue(SreKeyTypes.PullSqlReturnType);
            if (this.ReturnType == "I")
            {
                this.InterfaceName = DataSource.Keys.GetKeyValue(SreKeyTypes.PullSqlInterfaceName);
                if ((!string.IsNullOrEmpty(this.InterfaceName)) &&
                    (Type.GetType(this.InterfaceName) != null))
                {
                    object objInputFileGenerator = Activator.CreateInstance(Type.GetType(this.InterfaceName), this);
                    this.InputFileGenerator = (InputFileGenerator)objInputFileGenerator;
                }
            }
        }
Ejemplo n.º 6
0
        private void BindData()
        {
            Manager       manager = new Manager();
            SreDataSource ds      = manager.GetApplicationDetails(DataSourceId);

            if ((ds.Delimiter != null) &&
                (ds.Delimiter.ToLower() == "\t"))
            {
                cmbDelmiter.Text = "Tab";
            }
            else
            {
                cmbDelmiter.Text = ds.Delimiter;
            }

            List <SreKey> keys = manager.GetKeys(DataSourceId);

            rtbXslt.Text = keys.GetKeyValue(SreKeyTypes.EDIX12Xslt);
            SyntaxHighLighter.HighLight(rtbXslt, _blueKeyWords, _redKeyWords);

            string strHeader = keys.GetKeyValue(SreKeyTypes.IsFirstRowHeader);

            if (!string.IsNullOrEmpty(strHeader))
            {
                bool boolVal = false;
                bool.TryParse(strHeader, out boolVal);
                chkFileHasHeader.Checked = boolVal;
            }
            chkRenameHeaders.Enabled = chkFileHasHeader.Checked;

            string strRenCol = keys.GetKeyValue(SreKeyTypes.RenameColumnHeader);

            if (!string.IsNullOrEmpty(strRenCol))
            {
                bool boolVal = false;
                bool.TryParse(strRenCol, out boolVal);
                chkRenameHeaders.Checked = boolVal;
            }
        }
Ejemplo n.º 7
0
        private void CopyApplication()
        {
            _Copying = true;
            toolStripProgressBar1.Visible = true;
            toolStripProgressBar1.Increment(10);
            toolStripStatusLabel1.Text = "Copying application...";
            Application.DoEvents();
            SreDataSource newApp = new SreDataSource();

            newApp.Name                       = txtApplicationName.Text;
            newApp.Description                = txtApplicationName.Text;
            newApp.IsSystem                   = _FromApplication.IsSystem;
            newApp.DataFeederType             = _FromApplication.DataFeederType;
            newApp.DataFormatType             = _FromApplication.DataFormatType;
            newApp.Delimiter                  = _FromApplication.Delimiter;
            newApp.SystemDataSourceId         = _FromApplication.SystemDataSourceId;
            newApp.DataContainerValidatorType = _FromApplication.DataContainerValidatorType;
            newApp.OutputWriterType           = _FromApplication.OutputWriterType;
            newApp.PlugInsType                = _FromApplication.PlugInsType;
            newApp.ProcessingBy               = _FromApplication.ProcessingBy;
            newApp.PusherType                 = _FromApplication.PusherType;
            List <SreRuleDataSource> ruleSets = new List <SreRuleDataSource>();

            newApp.Id        = _AttributeManager.Save(newApp, ruleSets);
            NewApplicationId = newApp.Id;

            toolStripProgressBar1.Increment(20);
            toolStripStatusLabel1.Text = "Copying attributes...";
            Application.DoEvents();

            BindingList <Symplus.RuleEngine.Utilities.Data.Attribute> attributes = _UtilDataManager.GetAttributes(_FromApplication.Id);
            List <object> esAttributes = new List <object>();

            foreach (Symplus.RuleEngine.Utilities.Data.Attribute a in attributes)
            {
                a.AttributeExternalSystemId = 0;
                esAttributes.Add(a);
            }
            _UtilDataManager.SaveAssociations(newApp.Id, esAttributes);

            toolStripProgressBar1.Increment(20);
            toolStripStatusLabel1.Text = "Copying keys...";
            Application.DoEvents();

            List <SreKey> fromAppKeys = _AttributeManager.GetApplicationKeys(_FromApplication.Id, false);

            if (fromAppKeys != null)
            {
                for (int i = 0; i < fromAppKeys.Count; i++)
                {
                    SreKey newKey = new SreKey();

                    newKey.Name      = fromAppKeys[i].Name;
                    newKey.Value     = fromAppKeys[i].Value;
                    newKey.Type      = fromAppKeys[i].Type;
                    newKey.IsDefault = fromAppKeys[i].IsDefault;

                    _AttributeManager.Save(newApp.Id, newKey);
                }
            }

            toolStripProgressBar1.Increment(20);
            toolStripStatusLabel1.Text = "Copying rules...";
            Application.DoEvents();
            string         newRuleName  = string.Empty;
            int            newRuleId    = 0;
            List <SreRule> fromRuleSets = _AttributeManager.GetRules(_FromApplication.Id);

            foreach (SreRule sr in fromRuleSets)
            {
                newRuleName = (sr.Name).Replace(_FromApplication.Name, "");
                newRuleName = newRuleName + "_" + newApp.Name;
                sr.Id       = 0;
                newRuleId   = 0;
                newRuleId   = _AttributeManager.Save(sr);
                SreRuleDataSource ruleSetApp = new SreRuleDataSource();
                ruleSetApp.DataSourceId = 0;
                ruleSetApp.RuleId       = newRuleId;
                ruleSetApp.DataSourceId = newApp.Id;
                ruleSetApp.IsActive     = true;
                _AttributeManager.Save(null, null, null, ruleSetApp);
            }
            //for (int i = 0; i < fromRuleSets.Count; i++)
            //{


            //    fromRuleSets[i].Id = 0;
            //    if (fromRuleSets[i].Name.IndexOf("precontainer", StringComparison.OrdinalIgnoreCase) >= 0)
            //        fromRuleSets[i].Name = newApp.Name + "PreContainer";
            //    else if (fromRuleSets[i].Name.IndexOf("preparse", StringComparison.OrdinalIgnoreCase) >= 0)
            //        fromRuleSets[i].Name = newApp.Name + "PreParse";
            //    else if (fromRuleSets[i].Name.IndexOf("postparse", StringComparison.OrdinalIgnoreCase) >= 0)
            //        fromRuleSets[i].Name = newApp.Name + "PostParse";
            //    else if (fromRuleSets[i].Name.IndexOf("postcontainer", StringComparison.OrdinalIgnoreCase) >= 0)
            //        fromRuleSets[i].Name = newApp.Name + "PreContainer";
            //    else
            //    {
            //        newRuleName = (fromRuleSets[i].Name).Replace(_FromApplication.Name, "");

            //        fromRuleSets[i].Name = newRuleName.Replace("_","") + "_" + newApp.Name;
            //    }
            //}
            //_AttributeManager.Save(fromRuleSets);

            //ruleSets = _AttributeManager.GetRuleSetApplication(_FromApplication.Id);
            //foreach (SreRuleDataSource ruleSet in ruleSets)
            //{
            //    SreRuleDataSource ruleSetApp = new SreRuleDataSource();
            //    ruleSetApp.DataSourceId = 0;
            //    ruleSetApp.RuleId = 0;
            //    ruleSetApp.DataSourceId = newApp.Id;
            //    //ruleSetApp.RuleName = ruleSet.RulesetName + "_" + newApp.Id;
            //    //ruleSetApp.RulesetType = ruleSet.RulesetType;
            //    _AttributeManager.Save(null, null, null, ruleSetApp);
            //}

            toolStripProgressBar1.Increment(30);
            toolStripStatusLabel1.Text = "Done";
            txtApplicationName.Enabled = false;
            btnOK.Enabled = false;
            _Copying      = false;
            Application.DoEvents();

            toolStripProgressBar1.Value = toolStripProgressBar1.Maximum;
            Application.DoEvents();
        }