internal virtual InputProperties GetInputProperties(string method) { InputProperties props = new InputProperties(); switch (method) { case "GetWorklistItems": { #region properties props.Add(this._svcObject.Properties["Status"]); props.Add(this._svcObject.Properties["ActivityName"]); props.Add(this._svcObject.Properties["ProcessName"]); props.Add(this._svcObject.Properties["ProcessFullName"]); props.Add(this._svcObject.Properties["Folio"]); props.Add(this._svcObject.Properties["EventInstanceName"]); props.Add(this._svcObject.Properties["Priority"]); props.Add(this._svcObject.Properties["UserName"]); break; #endregion } case "LoadWorklistItem": { props.Add(this._svcObject.Properties["SerialNumber"]); props.Add(this._svcObject.Properties["UserName"]); break; } } return(props); }
private InputProperties GetInputProperties(string Method) { InputProperties properties = new InputProperties(); switch (Method) { case "ExcelList": #region properties properties.Add(new Property("ExcelDocumentPath", "System.String", SoType.File, new MetaData("ExcelDocumentPath", "Excel Document Path Value"))); properties.Add(new Property("RowNumber", "System.Int32", SoType.Number, new MetaData("RowNumber", "RowNumber"))); properties.Add(new Property("ExcelSheetName", "System.String", SoType.Text, new MetaData("ExcelSheetName", "Excel Sheet Name"))); for (int i = 1; i <= _NoOfColumns; i++) { properties.Add(new Property("Column" + i, "System.String", SoType.Text, new MetaData("Column" + i, "Column" + i))); } break; case "SaveData": properties.Add(new Property("ExcelDocumentPath", "System.String", SoType.File, new MetaData("ExcelDocumentPath", "Excel Document Path Value"))); properties.Add(new Property("RowNumber", "System.Int32", SoType.Number, new MetaData("RowNumber", "RowNumber"))); properties.Add(new Property("ExcelSheetName", "System.String", SoType.Text, new MetaData("ExcelSheetName", "Excel Sheet Name"))); properties.Add(new Property("TableName", "System.String", SoType.Text, new MetaData("TableName", "SmartObjectName"))); //properties.Add(new Property("FilterData", "System.Guid", SoType.Guid, new MetaData("FilterData", "FilterData"))); break; #endregion } return(properties); }
/// <summary> /// Creates an instance of the rule. /// </summary> /// <param name="primaryProperty">Primary property.</param> /// <param name="expression">Regular expression.</param> public RegExMatch(Csla.Core.IPropertyInfo primaryProperty, string expression) : base(primaryProperty) { Expression = expression; RuleUri.AddQueryParameter("e", expression); InputProperties.Add(primaryProperty); }
public CalculateAge(IPropertyInfo birthdateProperty, IPropertyInfo ageProperty) : base(birthdateProperty) { AgeProperty = ageProperty; InputProperties.Add(birthdateProperty); AffectedProperties.Add(ageProperty); }
/// <summary> /// Creates an instance of the rule. /// </summary> /// <param name="primaryProperty">Property to which the rule applies.</param> /// <param name="max">Max length value.</param> public MaxValue(Csla.Core.IPropertyInfo primaryProperty, T max) : base(primaryProperty) { Max = max; this.RuleUri.AddQueryParameter("max", max.ToString()); InputProperties.Add(primaryProperty); }
/// <summary> /// Initializes a new instance of the <see cref="StopIfNotFieldExists"/> class. /// </summary> /// <param name="primaryProperty">Primary property for this rule.</param> public StopIfNotFieldExists(IPropertyInfo primaryProperty) : base(primaryProperty) { if (InputProperties == null) InputProperties = new List<IPropertyInfo>(); InputProperties.Add(primaryProperty); }
/// <summary> /// Creates an instance of the rule. /// </summary> /// <param name="primaryProperty">Property to which the rule applies.</param> /// <param name="min">Min value.</param> public MinValue(Csla.Core.IPropertyInfo primaryProperty, T min) : base(primaryProperty) { Min = min; this.RuleUri.AddQueryParameter("min", min.ToString()); InputProperties.Add(primaryProperty); }
public CommonModuleEntry() { Key = Common.KeyConst; Name = Common.Name; Description = Common.Description; InputProperties.Add(new ElementPropertyEntry("WorkspacePath", "Workspace folder root path", DataType.VirtualPath, true)); }
/// <summary> /// Creates an instance of the rule. /// </summary> /// <param name="affectedProperties">Array of properties to which the rule applies.</param> public OneOfSeveralStringsRequiredRule(params IPropertyInfo[] affectedProperties) : base(affectedProperties[0]) { foreach (IPropertyInfo affectedProperty in affectedProperties) { InputProperties.Add(affectedProperty); } }
private InputProperties GetInputProperties(string Method) { InputProperties properties = new InputProperties(); switch (Method) { case "IsInRole": #region properties properties.Add(new Property("Role_Name", "System.String", SoType.Text, new MetaData("Role_Name", "Role_Name"))); properties.Add(new Property("IsinRole", "System.Boolean", SoType.YesNo, new MetaData("IsinRole", "IsinRole"))); properties.Add(new Property("Name", "System.String", SoType.Text, new MetaData("Username", "Username"))); break; case "GetRoleUsersEmailAddress": properties.Add(new Property("Role_Name", "System.String", SoType.Text, new MetaData("Role_Name", "Role_Name"))); break; case "GetRoleUsersEmailsonIndex": properties.Add(new Property("Role_Name", "System.String", SoType.Text, new MetaData("Role_Name", "Role_Name"))); properties.Add(new Property("UserIndex", "System.Int32", SoType.Number, new MetaData("UserIndex", "UserIndex"))); break; case "GetRoleUsersEmails": properties.Add(new Property("Role_Name", "System.String", SoType.Text, new MetaData("Role_Name", "Role_Name"))); //properties.Add(new Property("UserIndex", "System.Int32", SoType.Number, new MetaData("UserIndex", "UserIndex"))); break; #endregion } return(properties); }
/// <summary> /// Creates an instance of the rule. /// </summary> /// <param name="primaryProperty">Property to which the rule applies.</param> /// <param name="attribute">ValidationAttribute instance.</param> public DataAnnotation(Csla.Core.IPropertyInfo primaryProperty, System.ComponentModel.DataAnnotations.ValidationAttribute attribute) : base(primaryProperty) { this.Attribute = attribute; RuleUri.AddQueryParameter("a", attribute.GetType().FullName); if (primaryProperty != null) { InputProperties.Add(primaryProperty); } }
public CalculateFractionRule(PropertyInfo <decimal> targetProperty, PropertyInfo <decimal> sourceProperty, decimal fraction) : base(targetProperty) { InputProperties.Add(sourceProperty); _sourceProperty = sourceProperty; _fraction = fraction; RuleUri.AddQueryParameter("fraction", fraction.ToString()); }
/// <summary> /// Valida una regla /// </summary> /// <param name="delegateRule"></param> /// <param name="primaryProperty"></param> /// <param name="secundaryProperty"></param> public ValidateRule(DelegateRule delegateRule, IPropertyInfo primaryProperty, IPropertyInfo secundaryProperty = null) : base(primaryProperty) { _delegateRule = delegateRule; if (secundaryProperty != null) { InputProperties.Add(primaryProperty); InputProperties.Add(secundaryProperty); } }
public Increment(PropertyInfo <int> primaryProperty, PropertyInfo <int> affectedProperty) : base(primaryProperty) { _primaryProperty = primaryProperty; _affectedProperty = affectedProperty; if (InputProperties == null) { InputProperties = new List <IPropertyInfo>(); } InputProperties.Add(primaryProperty); AffectedProperties.Add(affectedProperty); }
/// <summary> /// Initializes a new instance of the <see cref="LessThanProperty"/> class. /// </summary> /// <param name="primaryProperty">The primary property.</param> /// <param name="compareToProperty">The compare to property.</param> public LessThanProperty(IPropertyInfo primaryProperty, IPropertyInfo compareToProperty) : base(primaryProperty) { CompareTo = compareToProperty; if (InputProperties == null) { InputProperties = new List <IPropertyInfo>(); } InputProperties.Add(primaryProperty); InputProperties.Add(compareToProperty); }
public CheckSumRule(PropertyInfo <int> value1Property, PropertyInfo <int> value2Property, int sumValue) : base(value1Property) { _sumValue = sumValue; InputProperties.Add(value1Property); InputProperties.Add(value2Property); _value1Property = value1Property; _value2Property = value2Property; RuleUri.AddQueryParameter("sumvalue", sumValue.ToString()); }
/// <summary> /// Creates an instance of the rule. /// </summary> /// <param name="primaryProperty">Primary property for the rule.</param> /// <param name="dependencyProperty">The dependency property.</param> /// <param name="isBiDirectional">if set to <c>true</c> [is bi directional].</param> /// <remarks> /// When rules are run for one of the dependency properties the rules for primary property i rerun. /// </remarks> public DependencyFrom(Csla.Core.IPropertyInfo primaryProperty, Csla.Core.IPropertyInfo dependencyProperty, bool isBiDirectional) : base(primaryProperty) { if (InputProperties == null) { InputProperties = new List <IPropertyInfo>(); } InputProperties.Add(dependencyProperty); if (isBiDirectional) { AffectedProperties.Add(dependencyProperty); } }
public IsDuplicateNameAsync(IPropertyInfo primaryProperty, IPropertyInfo secondaryProperty) : base(primaryProperty) { SecondaryProperty = secondaryProperty; InputProperties.Add(primaryProperty); InputProperties.Add(secondaryProperty); IsAsync = false; // setting all to false will only allow the rule to run when the property is set - typically by the user from the UI. CanRunAsAffectedProperty = false; CanRunInCheckRules = false; CanRunOnServer = false; }
public FlatFileWriterEntry() { //Key = "FlatFileWriter"; //Name = "Flat File Writer"; //Description = "This elements write a flat file (like CSV) from a Table value."; Key = FlatFileWriter.KeyConst; Name = FlatFileWriter.Name; Description = FlatFileWriter.Description; InputProperties.Add(new ElementPropertyEntry("TargetFilePath", "Target file path", DataType.VirtualPath, true)); InputProperties.Add(new ElementPropertyEntry("ColumnDelimiter", "Column char delimite", DataType.Char, true)); InputProperties.Add(new ElementPropertyEntry("Table", "Table Value to write in flat file", DataType.Table, true)); }
public FlatFileReaderEntry() { Key = FlatFileReader.KeyConst; Name = FlatFileReader.Name; Description = FlatFileReader.Description; InputProperties.Add(new ElementPropertyEntry("SourceFilePath", "Source file path", DataType.VirtualPath, true)); InputProperties.Add(new ElementPropertyEntry("SkipStartingDataRows", "Starting row to skip", DataType.Int)); InputProperties.Add(new ElementPropertyEntry("FirstRowHasHeader", "Use first row as header", DataType.Bool, true)); InputProperties.Add(new ElementPropertyEntry("ColumnDelimiter", "Column char delimiter", DataType.Char, true)); InputProperties.Add(new ElementPropertyEntry("LimitToRows", "Limit result to rows number", DataType.Int)); OutputProperties.Add(new ElementPropertyEntry("Table", "Rows imported from flat file", DataType.Table, true)); }
public SqlQueryReaderEntry() { //Key = "SqlQueryReader"; //Name = "SQL Query Reader"; //Description = "This elements read data form a SQL Server query and returns a Table value."; Key = SqlQueryReader.KeyConst; Name = SqlQueryReader.Name; Description = SqlQueryReader.Description; InputProperties.Add(new ElementPropertyEntry("ConnectionString", "Sql Server Connection String", DataType.String, true)); InputProperties.Add(new ElementPropertyEntry("SqlQuery", "SqL Query", DataType.String, true)); OutputProperties.Add(new ElementPropertyEntry("Table", "Rows imported from Sql Query", DataType.Table, true)); }
public SqlTableWriterEntry() { //Key = "SqlTableWriter"; //Name = "SQL Table Writer"; //Description = "This elements insert TableValue to a SQL Server table."; Key = SqlTableWriter.KeyConst; Name = SqlTableWriter.Name; Description = SqlTableWriter.Description; InputProperties.Add(new ElementPropertyEntry("ConnectionString", "Sql Server Connection String", DataType.String, true)); InputProperties.Add(new ElementPropertyEntry("SqlTable", "Sql destination table", DataType.String, true)); InputProperties.Add(new ElementPropertyEntry("ColumnsMapping", "Columns Mapping", DataType.Collection)); InputProperties.Add(new ElementPropertyEntry("SourceTable", "Source Table Value", DataType.Table, true)); }
/// <summary> /// Initializes a new instance of the <see cref="LookupCustomer"/> class. /// </summary> /// <param name="primaryProperty"> /// The primary property. /// </param> /// <param name="nameProperty"> /// The name property. /// </param> public LookupCustomer(IPropertyInfo primaryProperty, IPropertyInfo nameProperty) : base(primaryProperty) { NameProperty = nameProperty; if (InputProperties == null) { InputProperties = new List <IPropertyInfo>(); } InputProperties.Add(primaryProperty); AffectedProperties.Add(nameProperty); IsAsync = false; CanRunAsAffectedProperty = false; // only run when this property is changed CanRunInCheckRules = true; // when true will also run in CheckRules CanRunOnServer = false; // when true will also run on logical serverside (Data Access) }
private InputProperties GetInputProperties(string method) { InputProperties properties = new InputProperties(); switch (method) { case "ActionWorklistItem": { properties.Add(_so.Properties["SerialNumber"]); properties.Add(_so.Properties["ActionName"]); break; } case "OpenWorklistItem": { properties.Add(_so.Properties["SerialNumber"]); break; } case "ReleaseWorklistItem": { properties.Add(_so.Properties["SerialNumber"]); break; } case "GetWorklistItemActions": { properties.Add(_so.Properties["SerialNumber"]); break; } case "RedirectWorklistItem": { properties.Add(_so.Properties["SerialNumber"]); break; } case "RedirectManagedUserWorklistItem": { properties.Add(_so.Properties["SerialNumber"]); break; } } return(properties); }
/// <summary> /// Initializes a new instance of the <see cref="AsyncLookupCustomer"/> class. /// </summary> /// <param name="primaryProperty"> /// The primary property. /// </param> /// <param name="nameProperty"> /// The name property. /// </param> public AsyncLookupCustomer(IPropertyInfo primaryProperty, IPropertyInfo nameProperty) : base(primaryProperty) { NameProperty = nameProperty; if (InputProperties == null) { InputProperties = new List <IPropertyInfo>(); } InputProperties.Add(primaryProperty); AffectedProperties.Add(nameProperty); IsAsync = true; // setting all to false will only allow the rule to run when the property is set - typically by the user from the UI. CanRunAsAffectedProperty = false; CanRunInCheckRules = false; CanRunOnServer = false; }
/// <summary> /// Initializes a new instance of the <see cref="FieldExists"/> class. /// </summary> /// <param name="primaryProperty">The primary property.</param> /// <param name="innerRule">The inner rule.</param> public FieldExists(IPropertyInfo primaryProperty, IBusinessRule innerRule) : base(primaryProperty) { if (InputProperties == null) { InputProperties = new List <IPropertyInfo>(); } InputProperties.Add(primaryProperty); InnerRule = innerRule; RuleUri.AddQueryParameter("rule", System.Uri.EscapeUriString(InnerRule.RuleName)); // merge InnerRule input property list into this rule's list if (InnerRule.InputProperties != null) { InputProperties.AddRange(InnerRule.InputProperties); } // remove any duplicates InputProperties = new List <IPropertyInfo>(InputProperties.Distinct()); AffectedProperties.AddRange(innerRule.AffectedProperties); }
private InputProperties GetInputProperties(string method) { InputProperties properties = new InputProperties(); switch (method) { case "GetWorklistItems": { #region properties properties.Add(new Property("Status", "System.String", SoType.Text, new MetaData("Status", "Status"))); properties.Add(new Property("ActivityName", "System.String", SoType.Text, new MetaData("Activity Name", "Activity Name"))); properties.Add(new Property("ProcessName", "System.String", SoType.Text, new MetaData("Process Name", "Process Name"))); properties.Add(new Property("ProcessFullName", "System.String", SoType.Text, new MetaData("Process Full Name", "Process Full Name"))); properties.Add(new Property("Folio", "System.String", SoType.Text, new MetaData("Folio", "Folio"))); properties.Add(new Property("EventInstanceName", "System.String", SoType.Text, new MetaData("Event Instance Name", "Event Instance Name"))); properties.Add(new Property("Priority", "System.String", SoType.Text, new MetaData("Priority", "Priority"))); properties.Add(new Property("UserName", "System.String", SoType.Text, new MetaData("User Name", "User Name"))); break; #endregion } case "LoadWorklistItem": { properties.Add(new Property("SerialNumber", "System.String", SoType.Text, new MetaData("SerialNumber", "SerialNumber"))); break; } } return properties; }
public CopyValueRule(PropertyInfo <int> targetProperty, PropertyInfo <int> sourceProperty) : base(targetProperty) { InputProperties.Add(sourceProperty); _sourceProperty = sourceProperty; }
internal virtual InputProperties GetInputProperties(string method) { InputProperties props = new InputProperties(); switch (method) { case "GetWorklistItems": { #region properties props.Add(this._svcObject.Properties["Status"]); props.Add(this._svcObject.Properties["ActivityName"]); props.Add(this._svcObject.Properties["ProcessName"]); props.Add(this._svcObject.Properties["ProcessFullName"]); props.Add(this._svcObject.Properties["Folio"]); props.Add(this._svcObject.Properties["EventInstanceName"]); props.Add(this._svcObject.Properties["Priority"]); props.Add(this._svcObject.Properties["UserName"]); break; #endregion } case "LoadWorklistItem": { props.Add(this._svcObject.Properties["SerialNumber"]); props.Add(this._svcObject.Properties["UserName"]); break; } } return props; }
/// <summary> /// This method is specifically written to discover the schema of a XML file /// we are only catering for a simple datatable where the XML file contains a single repeating structure /// We will load the XML file into a dataSet, extract DataTables from the dataset and then create /// Service Objects for each data table. We will then create Properties for each column in the data set, and finally /// create two Methods (List and Read) for each Service Object. /// </summary> private void DiscoverXMLFileSchema(string xmlFilePath) { //read the type mappings so that we can convert the DataTable's property types into //equivalent Service Object Property types TypeMappings map = (TypeMappings)this.Service.ServiceConfiguration["Type Mappings"]; //load the XML file specified in the service instance configuration into a dataset so that we can discover it try { //read the target XML file into a dataset so we can discover it DataSet pseudoDataSource = new DataSet("PseudoDataSource"); pseudoDataSource.ReadXml(xmlFilePath); //iterate through each DataTable in the DataSource foreach (DataTable table in pseudoDataSource.Tables) { //1. CREATE SERVICE OBJECTS //we will create a Service Object for each table in the DataSet ServiceObject svcObject = new ServiceObject(); //clean up the System Name svcObject.Name = table.TableName.Replace(" ", ""); svcObject.MetaData.DisplayName = table.TableName; //2. CREATE SERVICE OBJECT PROPERTIES //we will create Service Object Properties for each column in the Table foreach (DataColumn column in table.Columns) { //note that the Name cannot have spaces Property svcProperty = new Property(column.ColumnName.Replace(" ", "")); svcProperty.MetaData.DisplayName = column.ColumnName; //set the property type based on the type mappings defined for the service svcProperty.SoType = map[column.DataType.Name]; //svcObject.Properties.Add(svcProperty); svcObject.Properties.Create(svcProperty); } //3. CREATE SERVICE OBJECT METHODS //we will only create Read and List methods for the XML Service Broker //LIST Method. Method svcListMethod = new Method(); //note that the Name should not contain spaces svcListMethod.Name = "List" + table.TableName.Replace(" ", ""); svcListMethod.MetaData.DisplayName = "List " + table.TableName; svcListMethod.Type = MethodType.List; //Set up the return properties for the List Method ReturnProperties listReturnProperties = new ReturnProperties(); //for this method we'll return each column as a property. foreach (Property svcProperty in svcObject.Properties) { listReturnProperties.Add(svcProperty); } svcListMethod.ReturnProperties = listReturnProperties; //Set up the input properties for the List Method InputProperties listInputProperties = new InputProperties(); //for this method we'll return each column as a property. foreach (Property svcProperty in svcObject.Properties) { listInputProperties.Add(svcProperty); } svcListMethod.InputProperties = listInputProperties; //call the create factory to add the service object method svcObject.Methods.Create(svcListMethod); //READ Method Method svcReadMethod = new Method(); //note that the Name should not contain spaces svcReadMethod.Name = "Read" + table.TableName.Replace(" ", ""); svcReadMethod.MetaData.DisplayName = "Read " + table.TableName; svcReadMethod.Type = MethodType.Read; //Set up the return properties for the Read Method ReturnProperties readReturnProperties = new ReturnProperties(); //for this method we will return each column as a property. foreach (Property svcProperty in svcObject.Properties) { readReturnProperties.Add(svcProperty); } svcReadMethod.ReturnProperties = readReturnProperties; //Set up the input properties for the method InputProperties inputProperties = new InputProperties(); //for this method we will define the first column in the data table as the input property inputProperties.Add(svcObject.Properties[0]); svcReadMethod.InputProperties = inputProperties; //define the required properties for the method. //in this case, we will assume that the first property of the item is also the Key value for the item //which we will require to locate the specified item in the XML file svcReadMethod.Validation.RequiredProperties.Add(inputProperties[0]); //add the Read method to the Service Object using the create factory svcObject.Methods.Create(svcReadMethod); //Use Method parameters if you want to define a parameter for the method //Parameters are used when the required input value is not already a Property of the Service Object. //if the required input value is already defined as a property for the SmartObject, use RequiredProperties instead //MethodParameter readMethodParameter = new MethodParameter(); //readMethodParameter.Name = "SomeName"; //readMethodParameter.MetaData.DisplayName = "SomeDisplayName"; //readMethodParameter.SoType = one of the available SO Types]; //svcReadMethod.MethodParameters.Add(readMethodParameter); //4. ADD THE SERVICE OBJECT TO THE SERVICE INSTANCE // Activate Service Object for use, otherwise you cannot create SmartObjects for the service object svcObject.Active = true; //add the Service Object to the Service Type, using the create factory this.Service.ServiceObjects.Create(svcObject); } } catch (Exception ex) { throw new Exception("Error while attempting to DiscoverXMLFileSchema. Error: " + ex.Message, ex); } }
public StringOnlyLettersAsync(Csla.Core.IPropertyInfo primaryProperty) : base(primaryProperty) { IsAsync = true; InputProperties.Add(primaryProperty); }
private InputProperties GetInputProperties(string method) { InputProperties properties = new InputProperties(); switch (method) { case"ActionWorklistItem": { properties.Add(_so.Properties["SerialNumber"]); properties.Add(_so.Properties["ActionName"]); break; } case "OpenWorklistItem": { properties.Add(_so.Properties["SerialNumber"]); break; } case "ReleaseWorklistItem": { properties.Add(_so.Properties["SerialNumber"]); break; } case "GetWorklistItemActions": { properties.Add(_so.Properties["SerialNumber"]); break; } case "RedirectWorklistItem": { properties.Add(_so.Properties["SerialNumber"]); break; } case "RedirectManagedUserWorklistItem": { properties.Add(_so.Properties["SerialNumber"]); break; } } return properties; }
public DelayRule(Csla.Core.IPropertyInfo primaryProperty) : base(primaryProperty) { InputProperties.Add(PrimaryProperty); }