private void btnOK_Click(object sender, EventArgs e) { SreKey key = new SreKey(); key.Name = txtName.Text; key.Value = txtValue.Text; key.Type = cmbType.SelectedIndex; try { Manager dm = new Manager(); if (_ApplicationId > 0) { dm.Save(_ApplicationId, key); _Keys = dm.GetApplicationKeys(_ApplicationId, false); } else { dm.Save(key); _Keys = dm.GetKeys(); } BindData(); if (Form.ModifierKeys != Keys.Control) { btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } } catch (Exception ex) { toolStripStatusLabel1.Text = ex.Message; } }
string FindSREKeyUsingName(List <SreKey> keys, SreKeyTypes sreKeyType) { SreKey key = (from e in keys where e.Name == sreKeyType.ToString() select e).SingleOrDefault(); return(key != null ? key.Value : string.Empty); }
public static SreKey GetKey(this List <SreKey> keys, string key) { SreKey srekey = (from k in keys where k.Name == key select k).SingleOrDefault(); return(srekey); }
public static string GetKeyValue(this List <SreKey> keys, string key) { SreKey srekey = (from k in keys where k.Name == key select k).SingleOrDefault(); if (srekey == null) { return(string.Empty); } return(string.IsNullOrEmpty(srekey.Value) ? string.Empty : srekey.Value); }
bool IsLocalFileSystemFoldersOverriden(List <SreKey> keys) { SreKey key = (from e in keys where e.Type == (int)SreKeyTypes.LocalFileSystemFoldersOverriden select e).SingleOrDefault(); bool result = false; if (key != null) { bool.TryParse(key.Value, out result); } return(result); }
private void InitConfig() { SreKey OutputWriterDatabaseConfiguration = new Manager().GetKey(_Job.DataSource.Id, SreKeyTypes.OutputWriterDatabaseConfiguration.ToString()); if ((OutputWriterDatabaseConfiguration != null) && (!string.IsNullOrEmpty(OutputWriterDatabaseConfiguration.Name))) { DatabaseMap = new ColumnMap(_Job.DataSource.Id, OutputWriterDatabaseConfiguration.Value); ConnectionStringKey = DatabaseMap.ConnectionKey; if (!string.IsNullOrEmpty(DatabaseMap.ConnectionKeyRunTime)) { string connectionKeyNameRuntime = _Job.GetProcessVariableValue(DatabaseMap.ConnectionKeyRunTime).ToString(); if (string.IsNullOrEmpty(connectionKeyNameRuntime)) { throw new Exception(string.Format("Database writer run time connection string '{0}' was not defined!", DatabaseMap.ConnectionKeyRunTime)); } ConnectionStringKey = _Job.DataSource.Keys.GetKey(connectionKeyNameRuntime); } } }
public static DatabaseTypes GetDatabaseType(this SreKey key) { SreKeyTypes sreKeyType = (SreKeyTypes)key.Type; switch (sreKeyType) { case SreKeyTypes.ConnectionStringSqlServer: return(DatabaseTypes.SqlServer); case SreKeyTypes.ConnectionStringOracle: return(DatabaseTypes.Oracle); case SreKeyTypes.ConnectionStringDB2iSeries: return(DatabaseTypes.DB2iSeries); case SreKeyTypes.ConnectionStringSqlCe: return(DatabaseTypes.SqlCe); default: throw new Exception(sreKeyType.ToString() + " is not database type key!"); } }
private void headerFooterConfiguration1_Saved(object sender, EventArgs e) { Manager manager = new Manager(); string delimiter = cmbDelmiter.Text; if (delimiter.ToLower() == "tab") { delimiter = "\t"; } manager.UpdateDelimiter(DataSourceId, delimiter); SreKey key = new SreKey(); key.Name = SreKeyTypes.IsFirstRowHeader.ToString(); key.Value = chkFileHasHeader.Checked.ToString(); key.Type = (int)SreKeyTypes.IsFirstRowHeader; manager.Save(DataSourceId, key); if (chkRenameHeaders.Checked) { key = new SreKey(); key.Name = SreKeyTypes.RenameColumnHeader.ToString(); key.Value = "True"; key.Type = (int)SreKeyTypes.RenameColumnHeader; manager.Save(DataSourceId, key); } else { manager.DeleteKeyFromApplication(DataSourceId, SreKeyTypes.RenameColumnHeader.ToString(), true); } key = new SreKey(); key.Name = SreKeyTypes.EDIX12Xslt.ToString(); key.Value = rtbXslt.Text; key.Type = (int)SreKeyTypes.EDIX12Xslt; manager.Save(DataSourceId, key); }
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(); }