예제 #1
0
        public List <IdpeRule> GetApplicationRuleSets(int dataSourceId)
        {
            List <IdpeRule> idpeRules   = new List <IdpeRule>();
            string          commandText = "select rs.[Id],rs.[Name],rs.[Description],rs.[Xaml],rsa.[Priority],rsa.[RuleSetType],rs.[CreatedTS],rs.[CreatedBy] from [IdpeRule] rs " +
                                          " inner join IdpeRuleDataSource rsa on rs.Id = rsa.RuleId  and DataSourceId = " + dataSourceId;

            DataTable table = CoreDatabaseObjects.Instance.ExecuteCommand(commandText);

            if (table == null || table.Rows.Count == 0)
            {
                return(idpeRules);
            }

            foreach (DataRow row in table.Rows)
            {
                IdpeRule rule = new IdpeRule();
                rule.Id          = (int)row["Id"].ToString().ParseInt();
                rule.Name        = row["Name"].ToString();
                rule.Description = row["Description"] != DBNull.Value ? row["Description"].ToString() : null;
                rule.Xaml        = row["Xaml"] != DBNull.Value ? row["Xaml"].ToString() : null;
                rule.Priority    = row["Priority"] != DBNull.Value ? row["Priority"].ToString().ParseInt() : null;
                rule.RuleSetType = row["RuleSetType"] != DBNull.Value ? row["RuleSetType"].ToString().ParseInt() : null;
                rule.CreatedTS   = (DateTime)(row["CreatedTS"] != DBNull.Value ? row["CreatedTS"].ToString().ParseDateTime() : DateTime.MinValue);
                rule.CreatedBy   = row["CreatedBy"] != DBNull.Value ? row["CreatedBy"].ToString() : null;
                idpeRules.Add(rule);
            }
            return(idpeRules);
        }
예제 #2
0
        void ExportRuleNames(int dataSourceId)
        {
            string sqlStatement = "select r.Name, rds.Priority, rds.RuleSetType ";

            sqlStatement += "from IdpeRule r ";
            sqlStatement += "inner join IdpeRuleDataSource rds on r.Id = rds.RuleId ";
            sqlStatement += "where rds.DataSourceId = " + dataSourceId;
            DataTable table = CoreDatabaseObjects.Instance.ExecuteCommand(sqlStatement);

            List <IdpeRule> rules = new List <IdpeRule>();

            foreach (DataRow row in table.Rows)
            {
                IdpeRule rule = new IdpeRule();
                rule.Name        = row["Name"].ToString();
                rule.Priority    = row["Priority"] != DBNull.Value ? row["Priority"].ToString().ParseInt() : null;
                rule.RuleSetType = row["RuleSetType"] != DBNull.Value ? row["RuleSetType"].ToString().ParseInt() : null;
                rules.Add(rule);
            }
            //following logic implemented to have rule names sequentially
            ExportRuleNames(rules, RuleSetTypes.PreValidate);
            ExportRuleNames(rules, RuleSetTypes.RowPreparing);
            ExportRuleNames(rules, RuleSetTypes.RowPrepared);
            ExportRuleNames(rules, RuleSetTypes.RowValidate);
            ExportRuleNames(rules, RuleSetTypes.PostValidate);
        }
예제 #3
0
        public List <IdpeRule> GetRules(int dataSourceId)
        {
            List <IdpeRule> rules = new List <IdpeRule>();

            string qry = "select r.Id,name,description,xaml,rds.[priority],rds.rulesettype from IdpeRule r ";

            qry += "inner join IdpeRuleDataSource rds on rds.ruleId = r.id ";
            qry += "where datasourceId = " + dataSourceId;
            DataTable table = Core.Data.CoreDatabaseObjects.Instance.ExecuteCommand(qry);

            foreach (DataRow row in table.Rows)
            {
                IdpeRule rule = new IdpeRule();
                rule.Id          = (int)row["Id"].ToString().ParseInt();
                rule.Name        = row["name"].ToString();
                rule.Description = row["description"].ToString();
                rule.Xaml        = row["xaml"].ToString();
                rule.Priority    = row["priority"].ToString().ParseInt();
                rule.RuleSetType = row["rulesettype"].ToString().ParseInt();

                rules.Add(rule);
            }

            return(rules);
        }
예제 #4
0
파일: Rules.cs 프로젝트: eyedia/idpe
        private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
        {
            bool itemSelected = listView.SelectedItems.Count > 0 ? true : false;

            copyToToolStripMenuItem.Enabled = itemSelected;
            deleteToolStripMenuItem.Enabled = itemSelected;
            btnDelete.Enabled = itemSelected;
            exportToolStripMenuItem.Enabled = itemSelected;
            renameToolStripMenuItem.Enabled = itemSelected;

            if (itemSelected)
            {
                if (Information.IsInternalRule(listView.SelectedItems[0].Text))
                {
                    deleteToolStripMenuItem.Enabled = false;
                    btnDelete.Enabled = false;
                }
                else
                {
                    deleteToolStripMenuItem.Enabled = true;
                    btnDelete.Enabled = true;
                }
            }

            if (listView.SelectedItems.Count == 1)
            {
                IdpeRule rule = listView.SelectedItems[0].Tag as IdpeRule;
                versionsToolStripMenuItem.Enabled = new Data.UtilDataManager().IsHavingVersion(VersionObjectTypes.Rule, rule.Id);
                compareWithPreviousVersionToolStripMenuItem.Enabled = versionsToolStripMenuItem.Enabled;
            }
        }
예제 #5
0
        public IdpeRule GetRule(int ruleId)
        {
            string commandText = "select TOP 1 [Id],[Name],[Description],[Xaml],[Priority],[RuleSetType],[CreatedTS],[CreatedBy] from [IdpeRule] where [Id] = " + ruleId;

            DataTable table = CoreDatabaseObjects.Instance.ExecuteCommand(commandText);

            if (table == null || table.Rows.Count == 0)
            {
                return(null);
            }

            foreach (DataRow row in table.Rows)
            {
                IdpeRule rule = new IdpeRule();
                rule.Id          = (int)row["Id"].ToString().ParseInt();
                rule.Name        = row["Name"].ToString();
                rule.Description = row["Description"] != DBNull.Value ? row["Description"].ToString() : null;
                rule.Xaml        = row["Xaml"] != DBNull.Value ? row["Xaml"].ToString() : null;
                rule.Priority    = row["Priority"] != DBNull.Value ? row["Priority"].ToString().ParseInt() : null;
                rule.RuleSetType = row["RuleSetType"] != DBNull.Value ? row["RuleSetType"].ToString().ParseInt() : null;
                rule.CreatedTS   = (DateTime)(row["CreatedTS"] != DBNull.Value ? row["CreatedTS"].ToString().ParseDateTime() : DateTime.MinValue);
                rule.CreatedBy   = row["CreatedBy"] != DBNull.Value ? row["CreatedBy"].ToString() : null;
                return(rule);
            }
            return(null);
        }
예제 #6
0
        public List <IdpeRule> GetRules()
        {
            List <IdpeRule> idpeRules   = new List <IdpeRule>();
            string          commandText = "select [Id],[Name],[Description],[Xaml],[Priority],[RuleSetType],[CreatedTS],[CreatedBy] from [IdpeRule] order by [Name]";

            DataTable table = CoreDatabaseObjects.Instance.ExecuteCommand(commandText);

            if (table == null)
            {
                return(idpeRules);
            }

            foreach (DataRow row in table.Rows)
            {
                IdpeRule rule = new IdpeRule();
                rule.Id          = (int)row["Id"].ToString().ParseInt();
                rule.Name        = row["Name"].ToString();
                rule.Description = row["Description"] != DBNull.Value ? row["Description"].ToString() : null;
                rule.Xaml        = row["Xaml"] != DBNull.Value ? row["Xaml"].ToString() : null;
                rule.Priority    = row["Priority"] != DBNull.Value ? row["Priority"].ToString().ParseInt() : null;
                rule.RuleSetType = row["RuleSetType"] != DBNull.Value ? row["RuleSetType"].ToString().ParseInt() : null;
                rule.CreatedTS   = (DateTime)(row["CreatedTS"] != DBNull.Value ? row["CreatedTS"].ToString().ParseDateTime() : DateTime.MinValue);
                rule.CreatedBy   = row["CreatedBy"] != DBNull.Value ? row["CreatedBy"].ToString() : null;

                idpeRules.Add(rule);
            }
            return(idpeRules);
        }
예제 #7
0
파일: Rules.cs 프로젝트: eyedia/idpe
        private bool FormAlreadyOpened(IdpeRule idperule)
        {
            bool IsAlreadyOpened = false;



            return(IsAlreadyOpened);
        }
예제 #8
0
        public void CopyRule(int fromRuleId, string newRuleName)
        {
            IdpeRule rule = GetRule(fromRuleId);

            rule.Id   = 0;
            rule.Name = newRuleName;
            Save(rule);
        }
예제 #9
0
        public RulesExtraInformation(IdpeRule idpeRule)
        {
            InitializeComponent();
            this.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);

            txtName.Text        = idpeRule.Name;
            txtDescription.Text = idpeRule.Description;
            //txtDescription.SelectedText = idpeRule.Description;
        }
예제 #10
0
파일: Rules.cs 프로젝트: eyedia/idpe
 private void versionsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (listView.SelectedItems.Count > 0)
     {
         IdpeRule    rule     = listView.SelectedItems[0].Tag as IdpeRule;
         frmVersions versions = new frmVersions(rule.Id, VersionObjectTypes.Rule);
         versions.ShowDialog();
     }
 }
예제 #11
0
파일: Rules.cs 프로젝트: eyedia/idpe
 private void validateToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (listView.SelectedItems.Count > 0)
     {
         IdpeRule            rule = listView.SelectedItems[0].Tag as IdpeRule;
         DataSourceValidator dataSourceValidator = new DataSourceValidator(false, rule.Id,
                                                                           "Attributes & Process Variables Referenced in " + rule.Name, this.Icon);
         dataSourceValidator.Show();
     }
 }
예제 #12
0
 private void miShowDependencies_Click(object sender, EventArgs e)
 {
     if ((selectedRuleListView != null) &&
         (selectedRuleListView.ListView.SelectedItems.Count > 0))
     {
         IdpeRule         rule             = selectedRuleListView.ListView.SelectedItems[0].Tag as IdpeRule;
         RuleDependencies ruleDependencies = new RuleDependencies(rule.Id);
         ruleDependencies.ShowDialog();
     }
 }
예제 #13
0
파일: Rules.cs 프로젝트: eyedia/idpe
 private void showDependenciesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if ((listView != null) &&
         (listView.SelectedItems.Count > 0))
     {
         IdpeRule         rule             = listView.SelectedItems[0].Tag as IdpeRule;
         RuleDependencies ruleDependencies = new RuleDependencies(rule.Id);
         ruleDependencies.ShowDialog();
     }
 }
예제 #14
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();
        }
예제 #15
0
파일: Rules.cs 프로젝트: eyedia/idpe
        private void btnAdd_Click(object sender, EventArgs e)
        {
            IdpeRule idpeRule = new IdpeRule();

            this.Cursor = Cursors.WaitCursor;
            FormAlreadyOpened(idpeRule);
            RuleEditor.MainWindow ruleEditor = new RuleEditor.MainWindow(idpeRule, Common.RuleSetTypes.RowPrepared);
            ElementHost.EnableModelessKeyboardInterop(ruleEditor);
            ruleEditor.RuleForm = this;
            this.Cursor         = Cursors.Default;
            ruleEditor.Show();
        }
예제 #16
0
파일: Rules.cs 프로젝트: eyedia/idpe
 private void renameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (listView.SelectedItems.Count > 0)
     {
         IdpeRule rule     = listView.SelectedItems[0].Tag as IdpeRule;
         InputBox inputBox = new InputBox(rule.Name, "New Name", "Rename Rule", this.Icon);
         if (inputBox.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             new Manager().RenameRule(rule.Id, inputBox.TheInput);
             RefreshRules();
         }
     }
 }
예제 #17
0
 private void miRename_Click(object sender, EventArgs e)
 {
     if ((selectedRuleListView.ListView != null) &&
         (selectedRuleListView.ListView.SelectedItems.Count > 0))
     {
         IdpeRule rule     = selectedRuleListView.ListView.SelectedItems[0].Tag as IdpeRule;
         InputBox inputBox = new InputBox(rule.Name, "New Name", "Rename Rule");
         inputBox.txtInput.TextChanged += new EventHandler(txtInput_TextChanged);
         if (inputBox.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             new Manager().RenameRule(rule.Id, inputBox.TheInput);
             Bind();
         }
     }
 }
예제 #18
0
        private void ValidateVersion(IdpeVersion version)
        {
            string allErrors = string.Empty;

            if (version.Type == (int)VersionObjectTypes.Unknown)
            {
                allErrors += "Version type cannot be unknown!" + Environment.NewLine;
            }

            if (version.ReferenceId == 0)
            {
                allErrors += "Version must have a reference Id!" + Environment.NewLine;
            }
            else
            {
                switch ((VersionObjectTypes)version.Type)
                {
                case VersionObjectTypes.Attribute:
                    IdpeAttribute attribute = GetAttribute(version.ReferenceId);
                    if (attribute.AttributeId == 0)
                    {
                        allErrors += "The INSERT statement conflicted with the FOREIGN KEY constraint. The conflict occurred in database, table IdpeAttribute, column 'Id'." + Environment.NewLine;
                    }
                    break;

                case VersionObjectTypes.DataSource:
                    string dataSourceName = GetApplicationName(version.ReferenceId);
                    if (string.IsNullOrEmpty(dataSourceName))
                    {
                        allErrors += "The INSERT statement conflicted with the FOREIGN KEY constraint. The conflict occurred in database, table IdpeDataSource, column 'Id'." + Environment.NewLine;
                    }
                    break;

                case VersionObjectTypes.Rule:
                    IdpeRule rule = GetRule(version.ReferenceId);
                    if (rule.Id == 0)
                    {
                        allErrors += "The INSERT statement conflicted with the FOREIGN KEY constraint. The conflict occurred in database, table IdpeRule, column 'Id'." + Environment.NewLine;
                    }
                    break;
                }
            }

            if (!string.IsNullOrEmpty(allErrors))
            {
                throw new Exception(allErrors);
            }
        }
예제 #19
0
파일: Rules.cs 프로젝트: eyedia/idpe
        private void compareWithPreviousVersionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listView.SelectedItems.Count > 0)
            {
                IdpeRule           rule         = listView.SelectedItems[0].Tag as IdpeRule;
                List <IdpeVersion> lastVersions = new Manager().GetVersions(VersionObjectTypes.Rule, rule.Id);

                if (lastVersions.Count >= 2)
                {
                    VersionComparer.Compare(VersionObjectTypes.Rule, rule.Name, lastVersions[0], lastVersions[1]);
                }
                else
                {
                    MessageBox.Show("Could not retrieve last 2 versions!", "Comparison Tool", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
            }
        }
예제 #20
0
파일: ExecuteRule.cs 프로젝트: eyedia/idpe
        protected override void Execute(CodeActivityContext context)
        {
            Job        job  = context.GetValue(this.Job);
            WorkerData data = context.GetValue(this.Data);

            IdpeRule rule     = null;
            int      ruleId   = context.GetValue(this.RuleId);
            string   ruleName = context.GetValue(this.RuleName);

            if (ruleId > 0)
            {
                rule = new Manager().GetRule(ruleId);
            }
            else if (!string.IsNullOrEmpty(ruleName))
            {
                rule = new Manager().GetRule(ruleName);
            }

            if (rule != null)
            {
                Stream          stream   = new MemoryStream(ASCIIEncoding.Default.GetBytes(rule.Xaml));
                DynamicActivity activity = ActivityXamlServices.Load(stream) as DynamicActivity;

                IDictionary <string, object> outArgs = null;
                Dictionary <string, object>  inArgs  = context.GetValue(this.InArgs);

                if (job != null)
                {
                    inArgs.Add("Job", job);
                }
                else
                {
                    inArgs.Add("Data", data);
                }

                WorkflowInvoker invoker = new WorkflowInvoker(activity);
                //outArgs = invoker.Invoke(inArgs);
                invoker.Invoke(inArgs);
                //context.SetValue(OutArgs, outArgs);
            }
            else
            {
                job.TraceError("Could not execute rule {0}, as it is not defined yet!", ruleName);
            }
        }
예제 #21
0
        void ExportRules(int dataSourceId)
        {
            string sqlStatement = "select r.Name, r.Description, r.Xaml, rds.Priority, rds.RuleSetType ";

            sqlStatement += "from IdpeRule r ";
            sqlStatement += "inner join IdpeRuleDataSource rds on r.Id = rds.RuleId ";
            sqlStatement += "where rds.DataSourceId = " + dataSourceId;
            DataTable table = CoreDatabaseObjects.Instance.ExecuteCommand(sqlStatement);

            foreach (DataRow row in table.Rows)
            {
                IdpeRule rule = new IdpeRule();
                rule.Name        = row["Name"].ToString();
                rule.Description = row["Description"] != DBNull.Value ? row["Description"].ToString() : null;
                rule.Xaml        = row["Xaml"] != DBNull.Value ? row["Xaml"].ToString() : null;
                rule.Priority    = row["Priority"] != DBNull.Value ? row["Priority"].ToString().ParseInt() : null;
                rule.RuleSetType = row["RuleSetType"] != DBNull.Value ? row["RuleSetType"].ToString().ParseInt() : null;
                Rules.Add(rule);
            }
        }
예제 #22
0
        public bool Save(string dataSourceName)
        {
            string dynamicXamlBody = string.Empty;
            bool   allGood         = true;

            List <Control> mappers = new List <Control>(pnlMain.Controls.Cast <Control>());

            mappers.Reverse();

            foreach (Control ctl in mappers)
            {
                if (ctl is AttributeMapper)
                {
                    AttributeMapper attributeMapper = (AttributeMapper)ctl;
                    if (attributeMapper.ValidateData() == false)
                    {
                        attributeMapper.Focus();
                        allGood = false;
                    }
                    else
                    {
                        dynamicXamlBody += attributeMapper.XamlString + Environment.NewLine;
                    }
                }
            }

            if (allGood)
            {
                InputBox inputBox = new InputBox(dataSourceName + " - Map", "Enter Rule Name", "Save Rule", this.ParentForm.Icon);
                if (inputBox.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    IdpeRule rule = new IdpeRule();
                    rule.Name        = inputBox.TheInput;
                    rule.Description = inputBox.TheInput + " was created by wizard";
                    rule.Xaml        = string.Format(XamlBody, rule.Name, dynamicXamlBody);
                    new Manager().Save(rule);
                }
            }
            return(allGood);
        }
예제 #23
0
        void OnRepositioned(object sender, EventArgs e)
        {
            Manager manager = new Manager();

            for (int i = 0; i < selectedRuleListView.ListView.Items.Count; i++)
            {
                IdpeRuleDataSource idpeRuleDataSource = new IdpeRuleDataSource();
                IdpeRule           rule = selectedRuleListView.ListView.Items[i].Tag as IdpeRule;
                if (rule == null)
                {
                    rule = manager.GetRule(selectedRuleListView.ListView.Items[i].Text);
                }

                idpeRuleDataSource.DataSourceId = this.DataSource.Id;
                idpeRuleDataSource.RuleId       = rule.Id;
                idpeRuleDataSource.RuleSetType  = (int)selectedRuleSetType;
                idpeRuleDataSource.Priority     = i + 1;
                manager.Save(idpeRuleDataSource);

                selectedRuleListView.ListView.Items[i].SubItems[1].Text = (i + 1).ToString();
            }
        }
예제 #24
0
        private void sdInsertRule(IDal dal = null, IDbConnection connection = null, IDbTransaction transaction = null)
        {
            IdpeRule rule = new IdpeRule();

            rule.Name        = "System Data Source - Map";
            rule.Description = "System data source rule mapping rule used by system. This rule cannot be deleted.";

            using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Eyedia.IDPE.DataManager." + rule.Name + ".xml"))
                using (StreamReader reader = new StreamReader(stream))
                {
                    rule.Xaml = reader.ReadToEnd();
                }

            rule.Id = Save(rule);

            IdpeRuleDataSource idpeRuleDataSource = new IdpeRuleDataSource();

            idpeRuleDataSource.DataSourceId = 100;
            idpeRuleDataSource.RuleId       = rule.Id;
            idpeRuleDataSource.Priority     = 1;
            idpeRuleDataSource.RuleSetType  = 3;
            Save(idpeRuleDataSource, dal, connection, transaction);
        }
예제 #25
0
        public void KeepVersionInternal(Manager manager, VersionObjectTypes versionObjectType, int referenceId)
        {
            if (referenceId == 0)
            {
                return;
            }

            IdpeVersion version = GetCurrentVersion(versionObjectType, referenceId);

            if (version == null)
            {
                return;
            }

            version.Version     = manager.GetLatestVersionNumber(versionObjectType, referenceId) + 1;
            version.Type        = (int)versionObjectType;
            version.ReferenceId = referenceId;

            switch (versionObjectType)
            {
            case VersionObjectTypes.DataSource:
                IdpeDataSource ds = manager.GetDataSourceDetails(referenceId);
                version.Data      = new Binary(GZipArchive.Compress(new DataSourceBundle().Export(referenceId, false).GetByteArray()));
                version.CreatedTS = ds.CreatedTS;
                break;

            case VersionObjectTypes.Rule:
                IdpeRule        rule  = manager.GetRule(referenceId);
                DataSourcePatch patch = new DataSourcePatch();
                patch.Rules.Add(rule);
                version.Data      = new Binary(GZipArchive.Compress(patch.Export().GetByteArray()));
                version.CreatedTS = rule.CreatedTS;
                break;
            }
            manager.Save(version);
        }
예제 #26
0
 public virtual string DeployRule(SreEnvironmentConfig toEnvironment, IdpeRule rule)
 {
     Packet.DataSourceBundle = new DataSourceBundle();
     Packet.DataSourceBundle.Rules.Add(rule);
     return(Constants.success);
 }
예제 #27
0
        public MainWindow(IdpeRule idpeRule, RuleSetTypes ruleSetType)
        {
            if (!String.IsNullOrEmpty(idpeRule.Name))
            {
                string sname = idpeRule.Name.Replace("-", "").Replace(" ", "");
                this.WindowName = sname;
            }

            this._TemplateWithJob  = System.IO.Path.Combine(Information.TempDirectoryIdpe, "WithJob.xml");
            this._TemplateWithData = System.IO.Path.Combine(Information.TempDirectoryIdpe, "WithData.xml");

            if (!File.Exists(_TemplateWithJob))
            {
                using (Stream stream = Assembly.GetExecutingAssembly()
                                       .GetManifestResourceStream("Eyedia.IDPE.Interface.RuleEditor.Templates.WithJob.xml"))
                {
                    using (StreamReader reader = new StreamReader(stream))
                    {
                        using (StreamWriter sw = new StreamWriter(_TemplateWithJob))
                        {
                            sw.Write(reader.ReadToEnd());
                            sw.Close();
                        }
                    }
                }
            }
            if (!File.Exists(_TemplateWithData))
            {
                using (Stream stream = Assembly.GetExecutingAssembly()
                                       .GetManifestResourceStream("Eyedia.IDPE.Interface.RuleEditor.Templates.WithData.xml"))
                {
                    using (StreamReader reader = new StreamReader(stream))
                    {
                        using (StreamWriter sw = new StreamWriter(_TemplateWithData))
                        {
                            sw.Write(reader.ReadToEnd());
                            sw.Close();
                        }
                    }
                }
            }

            //when new reference added, .new file will be created
            if (File.Exists(_TemplateWithJob + ".New"))
            {
                if (File.Exists(_TemplateWithJob))
                {
                    File.Delete(_TemplateWithJob);
                }

                File.Copy(_TemplateWithJob + ".New", _TemplateWithJob);
                File.Delete(_TemplateWithJob + ".New");
            }

            if (File.Exists(_TemplateWithData + ".New"))
            {
                if (File.Exists(_TemplateWithData))
                {
                    File.Delete(_TemplateWithData);
                }

                File.Copy(_TemplateWithData + ".New", _TemplateWithData);
                File.Delete(_TemplateWithData + ".New");
            }

            _idpeRule        = idpeRule;
            _ruleSetTemplate = ruleSetType;
            TransactionMode  = idpeRule.Id == 0 ? "INSERT" : "UPDATE";
            InitializeComponent();
            LoadDocument();
        }
예제 #28
0
 public bool SaveSreRule(IdpeRule idpeRule)
 {
     new Manager().Save(idpeRule);
     ServiceCommunicator.ClearRule(idpeRule.Id, idpeRule.Name);
     return(true);
 }
 /// <summary>
 /// Deploys data source into specific targetConfigironment
 /// </summary>
 /// <param name="toConfig">Target environment</param>
 /// <param name="rule">The rule object</param>
 public override string DeployRule(SreEnvironmentConfig toEnvironment, IdpeRule rule)
 {
     base.DeployRule(toEnvironment, rule);
     return(CreateAndCopyFile(toEnvironment, Packet) ? Constants.success : Constants.failed);
 }
예제 #30
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     SelectedRule = (IdpeRule)lstBoxRuleSet.SelectedItem;
     this.Close();
 }