public IList <ISourceValuePointer> GetUploadProperties(UInt32 taskId) { if (ScopeRunAt == EnumWebRunAt.Server) { ParameterValueCollection pvs = ParameterValues; if (pvs != null && pvs.Count > 0) { List <ISourceValuePointer> lst = new List <ISourceValuePointer>(); foreach (ParameterValue pv in pvs) { IList <ISourceValuePointer> l = pv.GetValueSources(); if (l != null && l.Count > 0) { foreach (ISourceValuePointer v in l) { if (!v.IsWebServerValue() && v.IsWebClientValue()) { lst.Add(v); } } } } return(lst); } } return(null); }
public void ValidateParameterValues(ParameterValueCollection parameters) { if (_method != null) { List <ParameterClass> ps = _method.Parameters; ParameterValueCollection.ValidateParameterValues(parameters, ps, this); } }
public ParameterValueCollection GetParameters() { ParameterValueCollection ps = new ParameterValueCollection(); if (_dataTransfers != null) { Dictionary <IProperty, ParameterValue> .ValueCollection.Enumerator en = _dataTransfers.Values.GetEnumerator(); while (en.MoveNext()) { ps.Add(en.Current); } } return(ps); }
public void ValidateParameterValues(ParameterValueCollection parameters) { List <ParameterClass> ps = _event.GetParameters(this); if (ps.Count > 0) { if (ps[0].IsLibType && typeof(object).Equals(ps[0].BaseClassType)) { if (string.Compare("sender", ps[0].Name, StringComparison.OrdinalIgnoreCase) == 0) { if (parameters.Count == 0) { ParameterValue pv = new ParameterValue(_action); pv.Name = ps[0].Name; pv.SetDataType(typeof(object)); pv.ValueType = EnumValueType.Property; pv.Property = _event.RootPointer; parameters.Add(pv); } if (ps.Count > 1) { if (ps[1].IsLibType && typeof(EventArgs).Equals(ps[1].BaseClassType)) { if (parameters.Count < 2) { ParameterValue pv = new ParameterValue(_action); pv.Name = ps[1].Name; pv.SetDataType(typeof(EventArgs)); pv.ValueType = EnumValueType.Property; FieldPointer fp = new FieldPointer(); fp.Owner = new DataTypePointer(new TypePointer(typeof(EventArgs))); fp.MemberName = "Empty"; pv.Property = fp; parameters.Add(pv); } } } } } } ParameterValueCollection.ValidateParameterValues(parameters, ps, this); }
public void ValidateParameterValues(ParameterValueCollection parameters) { if (_prop == null) { FormWarning.ShowMessage("Error calling {0}.ValidateParameterValues. Property not set. Action:{1}", this.GetType().FullName, this.Action); } else { ParameterValue p = null; foreach (ParameterValue pv in parameters) { if (string.Compare(pv.Name, PropertyValueName, StringComparison.Ordinal) == 0) { p = pv; break; } } if (p == null) { p = createValue(); } if (_prop.PropertyType != null) { p.SetDataType(_prop.PropertyType); } IList <Attribute> ed = _prop.GetUITypeEditor(); if (ed != null && ed.Count > 0) { Attribute[] atts = new Attribute[ed.Count]; ed.CopyTo(atts, 0); p.MergeValueAttributes(atts); } parameters.Clear(); parameters.Add(p); } }
public void ValidateParameterValues(ParameterValueCollection parameterValues) { //parameters are defined in action, not method, for this special case _action.ValidateParameterValues(); }
public void ValidateParameterValues(ParameterValueCollection parameterValues) { }
private IList <ISourceValuePointer> getSourceValuePointers(UInt32 taskId, EnumWebValueSources scope) { List <ISourceValuePointer> list = new List <ISourceValuePointer>(); if (_condition != null) { IList <ISourceValuePointer> l1 = _condition.GetValueSources(); if (l1 != null && l1.Count > 0) { foreach (ISourceValuePointer p in l1) { if (taskId != 0) { p.SetTaskId(taskId); } if (scope == EnumWebValueSources.HasClientValues) { if (p.IsWebClientValue()) { list.Add(p); } } else if (scope == EnumWebValueSources.HasServerValues) { if (!p.IsWebClientValue()) { list.Add(p); } } else { list.Add(p); } } } } ParameterValueCollection pvs = ParameterValues; if (pvs != null && pvs.Count > 0) { foreach (ParameterValue pv in pvs) { IList <ISourceValuePointer> l = pv.GetValueSources(); if (l != null && l.Count > 0) { foreach (ISourceValuePointer p in l) { if (scope == EnumWebValueSources.HasClientValues) { if (p.IsWebClientValue()) { list.Add(p); } } else if (scope == EnumWebValueSources.HasServerValues) { if (!p.IsWebClientValue()) { list.Add(p); } } else { list.Add(p); } } } } } OnGetSourceValuePointers(taskId, scope, list); return(list); }
public void ValidateParameterValues(ParameterValueCollection parameterValues) { ParameterValueCollection.ValidateParameterValues(parameterValues, MethodParameterTypes, this); }
public void ValidateParameterValues(ParameterValueCollection parameterValues) { ParameterValueCollection.ValidateParameterValues(parameterValues, this.Parameters, this); }
private ParameterValueCollection CreateParameterValues(string prefix, FdoRow row) { ParameterValueCollection values = new ParameterValueCollection(); if (_mappings == null || _mappings.Count == 0) { foreach (string col in row.Columns) { //No excluded properties or property not in exclusion list if (_unWritableProperties == null || _unWritableProperties.Count == 0 || !_unWritableProperties.Contains(col)) { //Omit null values if (row[col] != null && row[col] != DBNull.Value) { if (!row.IsGeometryProperty(col)) { LiteralValue dv = ValueConverter.GetConvertedValue(row[col]); if (dv != null) { ParameterValue pv = new ParameterValue(prefix + col, dv); values.Add(pv); } } else { IGeometry geom = row[col] as IGeometry; if (geom != null) { ParameterValue pv = new ParameterValue(prefix + col, new GeometryValue(FdoGeometryFactory.Instance.GetFgf(geom))); values.Add(pv); } } } } } } else { foreach (string col in row.Columns) { //No excluded properties or property not in exclusion list if (_unWritableProperties == null || _unWritableProperties.Count == 0 || !_unWritableProperties.Contains(col)) { //Omit null and un-mapped values if (_mappings[col] != null || row[col] != null && row[col] != DBNull.Value) { if (!row.IsGeometryProperty(col)) { LiteralValue dv = ValueConverter.GetConvertedValue(row[col]); if (dv != null) { ParameterValue pv = new ParameterValue(prefix + _mappings[col], dv); values.Add(pv); } } else { IGeometry geom = row[col] as IGeometry; if (geom != null) { ParameterValue pv = new ParameterValue(prefix + _mappings[col], new GeometryValue(FdoGeometryFactory.Instance.GetFgf(geom))); values.Add(pv); } } } } } } return(values); }
/// <summary> /// Executes the operation /// </summary> /// <param name="rows"></param> /// <returns></returns> public override IEnumerable <FdoRow> Execute(IEnumerable <FdoRow> rows) { int count = 0; string prefix = "param"; using (IInsert insertCmd = _service.CreateCommand <IInsert>(CommandType.CommandType_Insert)) { //Prepare command for batch insert insertCmd.SetFeatureClassName(this.ClassName); foreach (FdoRow row in rows) { //Prepare the parameter placeholders if (insertCmd.PropertyValues.Count == 0) { foreach (string col in row.Columns) { //Exclude un-writeable properties if (!_unWritableProperties.Contains(col)) { string pName = col; string paramName = prefix + pName; insertCmd.PropertyValues.Add(new PropertyValue(pName, new Parameter(paramName))); } } } //Load the batch parameter values ParameterValueCollection pVals = CreateParameterValues(prefix, row); insertCmd.BatchParameterValues.Add(pVals); count++; //Insert the batch when the number of features batched //reaches the specified number if (count == this.BatchSize) { using (IFeatureReader reader = insertCmd.Execute()) { reader.Close(); this.BatchInserted(this, new BatchInsertEventArgs(count)); this.RaiseBatchProcessed(count); _batchTotal += count; } count = 0; insertCmd.BatchParameterValues.Clear(); } } //Insert the remaining batch if (count > 0) { using (IFeatureReader reader = insertCmd.Execute()) { reader.Close(); this.BatchInserted(this, new BatchInsertEventArgs(count)); this.RaiseBatchProcessed(count); _batchTotal += count; } count = 0; insertCmd.BatchParameterValues.Clear(); } } yield break; }
public void ValidateParameterValues(ParameterValueCollection parameterValues) { IList <IParameter> ps = MethodParameterTypes; ParameterValueCollection.ValidateParameterValues(parameterValues, ps, this); }
/// <summary> /// Converts this feature to a parameter value collection. /// </summary> /// <param name="prefix">The prefix.</param> /// <param name="mappings">The mappings.</param> /// <param name="excludeProperties">The list of properties to exclude.</param> /// <returns></returns> public ParameterValueCollection ToParameterValueCollection(string prefix, NameValueCollection mappings, ICollection <string> excludeProperties) { ParameterValueCollection values = new ParameterValueCollection(); if (mappings == null) { foreach (string col in this.Columns) { //No excluded properties or property not in exclusion list if (excludeProperties == null || excludeProperties.Count == 0 || !excludeProperties.Contains(col)) { //Omit null values if (this[col] != null && this[col] != DBNull.Value) { if (!IsGeometryProperty(col)) { LiteralValue dv = ValueConverter.GetConvertedValue(this[col]); if (dv != null) { ParameterValue pv = new ParameterValue(prefix + col, dv); values.Add(pv); } } else { IGeometry geom = this[col] as IGeometry; if (geom != null) { ParameterValue pv = new ParameterValue(prefix + col, new GeometryValue(FdoGeometryFactory.Instance.GetFgf(geom))); values.Add(pv); } } } } } } else { foreach (string col in this.Columns) { //No excluded properties or property not in exclusion list if (excludeProperties == null || excludeProperties.Count == 0 || !excludeProperties.Contains(col)) { //Omit null and un-mapped values if (mappings[col] != null && this[col] != null && this[col] != DBNull.Value) { if (!IsGeometryProperty(col)) { LiteralValue dv = ValueConverter.GetConvertedValue(this[col]); if (dv != null) { ParameterValue pv = new ParameterValue(prefix + col, dv); values.Add(pv); } } else { IGeometry geom = this[col] as IGeometry; if (geom != null) { ParameterValue pv = new ParameterValue(prefix + col, new GeometryValue(FdoGeometryFactory.Instance.GetFgf(geom))); values.Add(pv); } } } } } } return(values); }
public void ValidateParameterValues(ParameterValueCollection parameters) { Type[] tps = this.ParameterTypes; ParameterValueCollection.ValidateParameterValues(parameters, tps, this); }
private ParameterValueCollection CreateParameterValues(string prefix, FdoRow row) { ParameterValueCollection values = new ParameterValueCollection(); if (_mappings == null || _mappings.Count == 0) { foreach (string col in row.Columns) { //No excluded properties or property not in exclusion list if (_unWritableProperties == null || _unWritableProperties.Count == 0 || !_unWritableProperties.Contains(col)) { //Omit null values if (row[col] != null && row[col] != DBNull.Value) { if (!row.IsGeometryProperty(col)) { LiteralValue dv = ValueConverter.GetConvertedValue(row[col]); if (dv != null) { ParameterValue pv = new ParameterValue(prefix + col, dv); values.Add(pv); } } else { IGeometry geom = row[col] as IGeometry; if (geom != null) { ParameterValue pv = new ParameterValue(prefix + col, new GeometryValue(FdoGeometryFactory.Instance.GetFgf(geom))); values.Add(pv); } } } } } } else { foreach (string col in row.Columns) { //No excluded properties or property not in exclusion list if (_unWritableProperties == null || _unWritableProperties.Count == 0 || !_unWritableProperties.Contains(col)) { //Omit null and un-mapped values if (_mappings[col] != null || row[col] != null && row[col] != DBNull.Value) { if (!row.IsGeometryProperty(col)) { LiteralValue dv = ValueConverter.GetConvertedValue(row[col]); if (dv != null) { ParameterValue pv = new ParameterValue(prefix + _mappings[col], dv); values.Add(pv); } } else { IGeometry geom = row[col] as IGeometry; if (geom != null) { ParameterValue pv = new ParameterValue(prefix + _mappings[col], new GeometryValue(FdoGeometryFactory.Instance.GetFgf(geom))); values.Add(pv); } } } } } } return values; }