Example #1
0
 public UseCase(UseCaseTypes type)
     : this()
 {
     Type     = type;
     Name     = type.ToString();
     IsCustom = false;
     if (type == UseCaseTypes.RetrieveByPk)
     {
         InputParameters.Add(new DataParameter(DomainInputType.Guid, "Id"));
         OutputParameters.Add(new DataParameter(DomainInputType.DomainEntity, "Entity"));
     }
     else if (type == UseCaseTypes.RetrieveByUn)
     {
         InputParameters.Add(new DataParameter(DomainInputType.String, "Name"));
         OutputParameters.Add(new DataParameter(DomainInputType.DomainEntity, "Entity"));
     }
     else if (type == UseCaseTypes.Create)
     {
         InputParameters.Add(new DataParameter(DomainInputType.DomainEntity, "Entity"));
         OutputParameters.Add(new DataParameter(DomainInputType.Guid, "Id"));
     }
     else if (type == UseCaseTypes.Update)
     {
         InputParameters.Add(new DataParameter(DomainInputType.DomainEntity, "Entity"));
     }
     else if (type == UseCaseTypes.DeleteByPk)
     {
         InputParameters.Add(new DataParameter(DomainInputType.Guid, "Id"));
     }
     else if (type == UseCaseTypes.DeleteByUn)
     {
         InputParameters.Add(new DataParameter(DomainInputType.String, "Name"));
     }
 }
Example #2
0
        public SqlQuery SetInt64OutParam(string paramName)
        {
            String pname = SetOutParam(paramName, DbType.Int64);

            OutputParameters.Add(paramName, new OutputParameter(pname, typeof(Int64)));
            return(this);
        }
Example #3
0
        public void AssignOutputParameterContainer(string ParamName, out SqlParameter ParamOut, object Value = null)
        {
            SqlParameter _param;

            if (ParamName.Substring(0, 1) != "@")
            {
                ParamName = '@' + ParamName;
            }
            if (Parameters[ParamName] != null)
            {
                _param = Parameters[ParamName];
            }
            else
            {
                _param = new SqlParameter()
                {
                    ParameterName = ParamName
                };
                Parameters.Add(_param);
            }
            if (Value != null)
            {
                AddParameterValue(ParamName, Value);
            }
            OutputParameters.Add(_param);
            ParamOut = _param;
            //ObjectParameters.Add(new ObjectParameter() {Container=Container, Parameter=_param });
        }
Example #4
0
        /// <summary>
        /// 设置回传参数
        /// </summary>
        public override Dictionary <string, string> SetViewParameters()
        {
            Dictionary <string, string> result = base.SetViewParameters();

            OutputParameters = OutputParameters ?? new SortedList();
            if (_confirmUser != null)
            {
                SortedList confirmUserParams = new SortedList();
                //是否需要确认包的人编码和信息
                confirmUserParams.Add("confirmUserId", _confirmUser.UserID);
                if (OutputParameters.ContainsKey("confirmUserParams"))
                {
                    OutputParameters["confirmUserParams"] = confirmUserParams;
                }
                else
                {
                    OutputParameters.Add("confirmUserParams", confirmUserParams);
                }
            }
            if (!_isPrintedBCU)
            {
                PrintBCUCode();
            }

            return(result);
        }
Example #5
0
 public RepositoryMethod AddDefaultOutputViewParameter()
 {
     OutputParameters.Add(new DataParameter(DomainInputType.Enumerable, "Collection")
     {
         EnumerableType = DomainInputType.DomainEntity
     });
     return(this);
 }
Example #6
0
        internal void SetOutputParameters(ProcessNode node)
        {
            if (OutputParameters == null)
            {
                OutputParameters = ImmutableDictionary.Create <string, IImmutableDictionary <string, object> >();
            }

            OutputParameters.Add(node.NodeName, node.OutputParameters);
        }
        public override Dictionary <string, string> SetViewParameters()
        {
            Dictionary <string, string> result = base.SetViewParameters();
            string personStr = personTxt.Text.Trim();

            OutputParameters = OutputParameters ?? new SortedList();
            SortedList personParams = new SortedList();

            personParams.Add("person_barcode", personStr);
            OutputParameters.Add("personParams", personParams);
            return(result);
        }
        public override Dictionary <string, string> SetViewParameters()
        {
            Dictionary <string, string> result = base.SetViewParameters();

            OutputParameters = OutputParameters ?? new SortedList();
            SortedList deviceParams = new SortedList();

            deviceParams.Add("device_runtimes", txtBatch.Text);
            deviceParams.Add("device_barcode", _MachineCode);
            OutputParameters.Add("deviceParams", deviceParams);

            return(result);
        }
Example #9
0
    private static OutputParameters GetOutputParameters(OracleParameterCollection parameters)
    {
        OutputParameters outputParameters = new OutputParameters();

        foreach (OracleParameter parameter in parameters)
        {
            if (parameter.Direction == ParameterDirection.Output)
            {
                outputParameters.Add(parameter);
            }
        }
        return(outputParameters);
    }
Example #10
0
        public void AssignOutputParameter(string ParamName, SqlParameter pParam)
        {
            if (Parameters[ParamName] != null)
            {
                pParam = Parameters[ParamName];
            }
            else
            {
                pParam = new SqlParameter()
                {
                    ParameterName = ParamName
                };
                Parameters.Add(pParam);
            }

            OutputParameters.Add(pParam);
        }
        /// <summary>
        /// Create the template output
        /// </summary>
        public override string TransformText()
        {
            #line 8 "C:\_CirclesArrows\blueprint41\Blueprint41\Neo4j\Refactoring\Templates\SetDefaultConstantValue.tt"


            Debug.WriteLine("	executing {0} -> {1}.{2} = '{3}'", this.GetType().Name, Entity.Name, Property.Name, (Value == null) ? "<NULL>" : Value.ToString());

            // Setup Cypher Parameters
            OutputParameters.Add(Property.Name, Value);



            #line default
            #line hidden
            this.Write("MATCH (node:");

            #line 16 "C:\_CirclesArrows\blueprint41\Blueprint41\Neo4j\Refactoring\Templates\SetDefaultConstantValue.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(Entity.Label.Name));

            #line default
            #line hidden
            this.Write(") WHERE NOT EXISTS(node.");

            #line 16 "C:\_CirclesArrows\blueprint41\Blueprint41\Neo4j\Refactoring\Templates\SetDefaultConstantValue.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(Property.Name));

            #line default
            #line hidden
            this.Write(") WITH node LIMIT 10000 SET node.");

            #line 16 "C:\_CirclesArrows\blueprint41\Blueprint41\Neo4j\Refactoring\Templates\SetDefaultConstantValue.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(Property.Name));

            #line default
            #line hidden
            this.Write(" = {");

            #line 16 "C:\_CirclesArrows\blueprint41\Blueprint41\Neo4j\Refactoring\Templates\SetDefaultConstantValue.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(Property.Name));

            #line default
            #line hidden
            this.Write("}\r\n");
            return(this.GenerationEnvironment.ToString());
        }
Example #12
0
        /// <summary>
        /// Create the template output
        /// </summary>
        public override string TransformText()
        {
            #line 8 "C:\_CirclesArrows\blueprint41\Blueprint41.Neo4jDriver.v4.0.1\Neo4j\Refactoring\Templates\v4\SetRelationshipPropertyValue.tt"


            string relationship = string.IsNullOrWhiteSpace(RelationshipType) ? "All Relationships" : RelationshipType;
            Debug.WriteLine("	executing {0} -> SetRelationshipPropertyValue of  relationship {1} for property {2} = {3}", this.GetType().Name, relationship, Property, Value);
            string type = string.IsNullOrWhiteSpace(RelationshipType) ? "r" : "r:" + RelationshipType;

            OutputParameters.Add(Property, Value);


            #line default
            #line hidden
            this.Write("MATCH ()-[");

            #line 16 "C:\_CirclesArrows\blueprint41\Blueprint41.Neo4jDriver.v4.0.1\Neo4j\Refactoring\Templates\v4\SetRelationshipPropertyValue.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type));

            #line default
            #line hidden
            this.Write("]->() WHERE NOT EXISTS(r.");

            #line 16 "C:\_CirclesArrows\blueprint41\Blueprint41.Neo4jDriver.v4.0.1\Neo4j\Refactoring\Templates\v4\SetRelationshipPropertyValue.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(Property));

            #line default
            #line hidden
            this.Write(")  WITH r LIMIT 10000 SET r.");

            #line 16 "C:\_CirclesArrows\blueprint41\Blueprint41.Neo4jDriver.v4.0.1\Neo4j\Refactoring\Templates\v4\SetRelationshipPropertyValue.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(Property));

            #line default
            #line hidden
            this.Write(" = $");

            #line 16 "C:\_CirclesArrows\blueprint41\Blueprint41.Neo4jDriver.v4.0.1\Neo4j\Refactoring\Templates\v4\SetRelationshipPropertyValue.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(Property));

            #line default
            #line hidden
            this.Write("\r\n");
            return(this.GenerationEnvironment.ToString());
        }
        public override Dictionary <string, string> SetViewParameters()
        {
            Dictionary <string, string> result = base.SetViewParameters();

            result["ShowParameterUI"] = yesReleaseBtn.IsChecked ? "false" : "true";
            if (yesReleaseBtn.IsChecked)
            {
                SortedList parameter02 = Sl_check["pd_par2"] as SortedList;
                if (parameter02 != null)
                {
                    for (int i = 0; i < parameter02.Count; i++)
                    {
                        string key = parameter02.GetKey(i).ToString();
                        if (key.Contains("_result"))
                        {
                            parameter02[key] = 1;
                        }
                    }
                }
            }

            if (setDataGrid.Rows.Count > 0)
            {
                //BD test does not need to show items.
                if (setDataGrid.Columns.Contains("setBarCodeCol") &&
                    setDataGrid.Rows[0].Cells["setBarCodeCol"].Value != null &&
                    setDataGrid.Rows[0].Cells["setBarCodeCol"].Value.Equals(BarCodeHelper.BDTestSetCode))
                {
                    result["ShowParameterUI"] = "false";
                    SortedList confirmUserParams = new SortedList();
                    //是否需要确认包的人编码和信息
                    confirmUserParams.Add("BDTestResult", yesReleaseBtn.IsChecked.ToString());
                    if (OutputParameters.ContainsKey("BDTestResult"))
                    {
                        OutputParameters["BDTestResult"] = confirmUserParams;
                    }
                    else
                    {
                        OutputParameters.Add("BDTestResult", confirmUserParams);
                    }
                }
            }
            return(result);
        }
Example #14
0
        private void AddOutput(CKlaxVariable parameter, bool bIsNewParameter)
        {
            var newViewmodel  = new CEntityVariableViewModel(parameter);
            var functionGraph = m_functionGraph;

            void Redo()
            {
                newViewmodel.PropertyChanged += OnParameterPropertyChanged;
                functionGraph.OutputParameters.Add(parameter);
                OutputParameters.Add(newViewmodel);
                functionGraph.RebuildFunctionNodes();
            }

            void Undo()
            {
                newViewmodel.PropertyChanged -= OnParameterPropertyChanged;
                OutputParameters.Remove(newViewmodel);
                functionGraph.OutputParameters.Remove(parameter);
                functionGraph.RebuildFunctionNodes();
            }

            newViewmodel.DeleteCommand = new CRelayCommand(arg =>
            {
                Undo();
                UndoRedoUtility.Record(new CRelayUndoItem(Redo, Undo));
            });

            if (bIsNewParameter)
            {
                Redo();
            }
            else
            {
                newViewmodel.PropertyChanged += OnParameterPropertyChanged;
                OutputParameters.Add(newViewmodel);
            }

            if (bIsNewParameter)
            {
                UndoRedoUtility.Record(new CRelayUndoItem(Undo, Redo));
            }
        }
Example #15
0
        public void ProcessData(RepositoryMethod regardingRepositoryMethod)
        {
            Name        = regardingRepositoryMethod.Name;
            DisplayName = $"Method {SchemaName}.{RepositoryName}.{regardingRepositoryMethod.Name}";

            var repositoryMethod = JsonParserService.ObjectifyWithTypes <RepositoryMethodContent>
                                       (regardingRepositoryMethod.Content);

            foreach (var item in repositoryMethod.Parameters
                     .Where(k => k.Direction == Methods.MethodParameter.ParameterDirection.Input))
            {
                InputParameters.Add(item);
            }

            foreach (var item in repositoryMethod.Parameters
                     .Where(k => k.Direction == Methods.MethodParameter.ParameterDirection.Output))
            {
                OutputParameters.Add(item);
            }
        }
Example #16
0
        protected override void ProcessOutputParam()
        {
            // We are connected to a Sql 7.0 server
            if (TdsVersion < TdsVersion.tds80)
            {
                base.ProcessOutputParam();
                return;
            }

            GetSubPacketLength();

            Comm.Skip((Comm.GetByte() & 0xff) << 1); // Parameter name
            Comm.Skip(1);                            // Status: 0x01 - in case of OUTPUT parameter
            // Status: 0x02 - in case of return value of UDF
            Comm.Skip(4);                            // Usertype - sizeof (ULong)

            TdsColumnType colType = (TdsColumnType)Comm.GetByte();
            object        value   = GetColumnValue(colType, true);

            OutputParameters.Add(value);
        }
Example #17
0
        public override Dictionary <string, string> SetViewParameters()
        {
            Dictionary <string, string> result = base.SetViewParameters();

            if (WorkflowServer.Transport_container_wf.Contains(PdCode))
            {
                SortedList devices = new SortedList();
                int        index   = 1;
                foreach (DataGridViewRow item in carDataGrid.Rows)
                {
                    SortedList device = new SortedList();
                    device.Add(1, item.Cells["carCodeCol"].Value.ToString());
                    devices.Add(index, device);
                    index++;
                }
                OutputParameters.Add("deviceParams", devices);
            }


            return(result);
        }
Example #18
0
        public override Dictionary <string, string> SetViewParameters()
        {
            Dictionary <string, string> result = base.SetViewParameters();
            SortedList workSetInfos            = new SortedList();
            int        index = 1;

            foreach (var item in _workSpecialSet)
            {
                DataRow setData = null;
                foreach (DataGridViewRow setRow in setDataGrid.Rows)
                {
                    DataRow rowData = setRow.Tag as DataRow;
                    if (rowData["bar_code"] != null && rowData["bar_code"].ToString() == item.Key)
                    {
                        setData = rowData;
                        break;
                    }
                }

                foreach (DataRow data in item.Value)
                {
                    SortedList workSpecialInfo = new SortedList();
                    workSpecialInfo.Add(0, "0");
                    workSpecialInfo.Add(1, setData["ws_id"]);
                    workSpecialInfo.Add(2, item.Key.ToString());
                    workSpecialInfo.Add(3, data["id"].ToString());
                    //workSpecialInfo.Add("workspecial_id", 0);
                    workSpecialInfo.Add(4, data["instrument_num"].ToString());
                    workSpecialInfo.Add(5, PdCode);
                    workSpecialInfo.Add(6, "1");
                    workSpecialInfo.Add(7, "");
                    workSetInfos.Add(index, workSpecialInfo);
                    index++;
                }
            }

            OutputParameters.Add("workspecialList", workSetInfos);
            return(result);
        }
Example #19
0
        private void AddOutput(CKlaxVariable parameter, bool bIsNewParameter)
        {
            var newViewmodel = new CEntityVariableViewModel(parameter);

            void Redo()
            {
                m_interfaceFunction.OutputParameters.Add(parameter);
                OutputParameters.Add(newViewmodel);
            }

            void Undo()
            {
                OutputParameters.Remove(newViewmodel);
                m_interfaceFunction.OutputParameters.Remove(parameter);
            }

            newViewmodel.DeleteCommand = new CRelayCommand(arg =>
            {
                Undo();
                UndoRedoUtility.Record(new CRelayUndoItem(Redo, Undo));
            });

            if (bIsNewParameter)
            {
                Redo();
            }
            else
            {
                OutputParameters.Add(newViewmodel);
            }

            if (bIsNewParameter)
            {
                UndoRedoUtility.Record(new CRelayUndoItem(Undo, Redo));
            }
        }
Example #20
0
        public void LoadConfiguration(GP.MetaData.GPMetaData serviceInfo, Uri taskEndPoint)
        {
            if (serviceInfo == null)
            {
                return;
            }

            TaskEndPoint = taskEndPoint;
            TaskName     = Title = serviceInfo.DisplayName;
            HelpUrl      = serviceInfo.HelpUrl;
            if (InputParameters == null)
            {
                InputParameters = new List <ParameterSupport.ParameterConfig>();
            }
            else
            {
                InputParameters.Clear();
            }

            if (OutputParameters == null)
            {
                OutputParameters = new List <ParameterSupport.ParameterConfig>();
            }
            else
            {
                OutputParameters.Clear();
            }

            if (LayerOrder == null)
            {
                LayerOrder = new ObservableCollection <string>();
            }
            else
            {
                LayerOrder.Clear();
            }

            Collection <LayerInformation> resultMapserviceLayerInfos = string.IsNullOrEmpty(serviceInfo.ResultMapServerName) || string.IsNullOrEmpty(serviceInfo.CurrentVersion) ? null : new Collection <LayerInformation>();

            #region Get parameter configs
            if (serviceInfo.Parameters != null)
            {
                int layerId = 0;
                foreach (ESRI.ArcGIS.Mapping.GP.MetaData.GPParameter param in serviceInfo.Parameters)
                {
                    ParameterConfig config = null;
                    if (param.DataType == "GPFeatureRecordSetLayer")
                    {
                        if (!string.IsNullOrEmpty(serviceInfo.ResultMapServerName) && param.Direction != "esriGPParameterDirectionInput")
                        {
                            if (!string.IsNullOrEmpty(serviceInfo.CurrentVersion)) // A resultmapservice can only be accessed at http://.../<resultMapservice>/MapServer/jobs/<jobId> when server version can be determined.
                            {
                                resultMapserviceLayerInfos.Add(ToLayerInfo(param, layerId++));
                            }
                            else
                            {
                                MapServiceLayerParameterConfig layerConfig = new MapServiceLayerParameterConfig
                                {
                                    Name                = param.Name,
                                    LayerName           = param.DisplayName,
                                    Type                = GPParameterType.MapServiceLayer,
                                    SupportsJobResource = false,
                                    Opacity             = 1,
                                };
                                OutputParameters.Add(layerConfig);
                                LayerOrder.Add(layerConfig.Name);
                            }
                        }
                        else
                        {
                            #region No result GP mapserver
                            GP.ParameterSupport.FeatureLayerParameterConfig layerConfig = new ParameterSupport.FeatureLayerParameterConfig()
                            {
                                ShownAtRunTime = true
                            };
                            layerConfig.Name     = param.Name;
                            layerConfig.Label    = layerConfig.DisplayName = string.IsNullOrEmpty(param.DisplayName) ? param.Name : param.DisplayName;
                            layerConfig.Mode     = ParameterSupport.FeatureLayerParameterConfig.InputMode.SketchLayer;
                            layerConfig.Type     = GPParameterType.FeatureLayer;
                            layerConfig.Required = param.ParameterType == "esriGPParameterTypeRequired";
                            ESRI.ArcGIS.Mapping.GP.MetaData.GPFeatureRecordSetLayer frs = param.DefaultValue as ESRI.ArcGIS.Mapping.GP.MetaData.GPFeatureRecordSetLayer;
                            if (frs != null)
                            {
                                if (frs.GeometryType == "esriGeometryPolyline")
                                {
                                    layerConfig.GeometryType = ESRI.ArcGIS.Mapping.Core.GeometryType.Polyline;
                                    layerConfig.HelpText     = Resources.Strings.DrawLine;
                                }
                                else if (frs.GeometryType == "esriGeometryPolygon")
                                {
                                    layerConfig.GeometryType = ESRI.ArcGIS.Mapping.Core.GeometryType.Polygon;
                                    layerConfig.HelpText     = Resources.Strings.DrawPolygon;
                                }
                                else if (frs.GeometryType == "esriGeometryPoint")
                                {
                                    layerConfig.GeometryType = ESRI.ArcGIS.Mapping.Core.GeometryType.Point;
                                    layerConfig.HelpText     = Resources.Strings.DrawPoint;
                                }
                                else if (frs.GeometryType == "esriGeometryMultipoint")
                                {
                                    layerConfig.GeometryType = ESRI.ArcGIS.Mapping.Core.GeometryType.MultiPoint;
                                    layerConfig.HelpText     = Resources.Strings.DrawPoint;
                                }
                                #region Layer with field info, geometry type and renderer
                                GraphicsLayer layer = new GraphicsLayer();
                                if (frs.Fields != null && frs.Fields.Length > 0)
                                {
                                    Collection <ESRI.ArcGIS.Mapping.Core.FieldInfo> fields = new Collection <ESRI.ArcGIS.Mapping.Core.FieldInfo>();

                                    List <string> doubleFields = new List <string>();
                                    List <string> singleFields = new List <string>();
                                    foreach (MetaData.Field field in frs.Fields)
                                    {
                                        #region Get Single and Double Fields
                                        string type = field.Type;
                                        if (type.StartsWith(GPConfiguration.esriFieldType, StringComparison.Ordinal))
                                        {
                                            type = type.Substring(GPConfiguration.esriFieldType.Length);
                                            ESRI.ArcGIS.Client.Field.FieldType fieldType =
                                                (ESRI.ArcGIS.Client.Field.FieldType)Enum.Parse(typeof(ESRI.ArcGIS.Client.Field.FieldType), type, true);

                                            if (fieldType == ESRI.ArcGIS.Client.Field.FieldType.Double)
                                            {
                                                doubleFields.Add(field.Name);
                                            }
                                            else if (fieldType == Client.Field.FieldType.Single)
                                            {
                                                singleFields.Add(field.Name);
                                            }
                                        }
                                        #endregion

                                        #region Get FieldInfos
                                        if (field.Type == "esriGeometry")
                                        {
                                            continue;
                                        }

                                        fields.Add(new ESRI.ArcGIS.Mapping.Core.FieldInfo()
                                        {
                                            DisplayName = field.Alias,
                                            FieldType   = mapFieldType(field.Type),
                                            Name        = field.Name,
                                            VisibleInAttributeDisplay = true,
                                            VisibleOnMapTip           = true,
                                        });
                                        #endregion
                                    }

                                    ESRI.ArcGIS.Mapping.Core.LayerExtensions.SetFields(layer, fields);
                                    layerConfig.SingleFields = singleFields.ToArray();
                                    layerConfig.DoubleFields = doubleFields.ToArray();
                                }
                                ESRI.ArcGIS.Mapping.Core.LayerExtensions.SetGeometryType(layer, layerConfig.GeometryType);
                                layer.Renderer = FeatureLayerParameterConfig.GetSimpleRenderer(layerConfig.GeometryType);

                                // Disable pop-ups by default for input layers
                                if (param.Direction == "esriGPParameterDirectionInput")
                                {
                                    LayerProperties.SetIsPopupEnabled(layer, false);
                                }
                                layerConfig.Layer = layer;
                                #endregion
                            }
                            else
                            {
                                layerConfig.GeometryType = ESRI.ArcGIS.Mapping.Core.GeometryType.Unknown;
                                layerConfig.HelpText     = Resources.Strings.UnknownGeometryType;
                            }
                            layerConfig.LayerName = layerConfig.Label;
                            layerConfig.ToolTip   = layerConfig.HelpText;
                            layerConfig.Opacity   = 1;

                            config = layerConfig;
                            LayerOrder.Add(layerConfig.Name);
                            #endregion
                        }
                    }
                    else if (param.DataType == "GPRasterDataLayer" || param.DataType == "GPRasterData")
                    {
                        if (string.IsNullOrEmpty(serviceInfo.ResultMapServerName) || param.Direction == "esriGPParameterDirectionInput")
                        {
                            config = new RasterDataParameterConfig()
                            {
                                Name           = param.Name,
                                ShownAtRunTime = true,
                                FormatToolTip  = "e.g. tif, jpg",
                                Type           = param.DataType == "GPRasterDataLayer" ? GPParameterType.RasterDataLayer : GPParameterType.RasterData,
                                ToolTip        = param.DataType == "GPRasterDataLayer" ? Resources.Strings.EnterUrlForRasterDataLayer : Resources.Strings.EnterUrlForRasterData,
                                HelpText       = param.DataType == "GPRasterDataLayer" ? Resources.Strings.EnterUrlForRasterDataLayer : Resources.Strings.EnterUrlForRasterData,
                                Label          = param.DisplayName,
                                DisplayName    = param.DisplayName,
                                Required       = param.ParameterType == "esriGPParameterTypeRequired",
                                Input          = param.Direction == "esriGPParameterDirectionInput"
                            };
                        }
                        else if (string.IsNullOrEmpty(serviceInfo.CurrentVersion))
                        {
                            MapServiceLayerParameterConfig layerConfig = new MapServiceLayerParameterConfig
                            {
                                Name                = param.Name,
                                LayerName           = param.DisplayName,
                                Type                = GPParameterType.MapServiceLayer,
                                SupportsJobResource = false,
                                Opacity             = 1,
                            };
                            OutputParameters.Add(layerConfig);
                            LayerOrder.Add(layerConfig.Name);
                        }
                        else
                        {
                            resultMapserviceLayerInfos.Add(ToLayerInfo(param, layerId++));
                        }
                    }
                    else
                    {
                        #region other param types
                        if (param.DataType == "GPMultiValue:GPString")
                        {
                            config = new MultiValueStringConfig()
                            {
                                ShownAtRunTime = true
                            }
                        }
                        ;
                        else
                        {
                            config = new ParameterConfig()
                            {
                                ShownAtRunTime = true
                            }
                        };

                        config.Name     = param.Name;
                        config.Label    = config.DisplayName = param.DisplayName;
                        config.Required = param.ParameterType == "esriGPParameterTypeRequired";

                        string defaultString = param.DefaultValue == null ? null : param.DefaultValue.ToString();

                        switch (param.DataType)
                        {
                            #region
                        case "GPBoolean":
                            config.Type = GPParameterType.Boolean;
                            if (param.DefaultValue != null)
                            {
                                config.DefaultValue = new Client.Tasks.GPBoolean(param.Name, (bool)param.DefaultValue);
                            }
                            break;

                        case "GPDouble":
                            config.Type = GPParameterType.Double;
                            if (!string.IsNullOrEmpty(defaultString))
                            {
                                double val = 0;
                                if (double.TryParse(defaultString, System.Globalization.NumberStyles.Any, CultureHelper.GetCurrentCulture(), out val))
                                {
                                    config.DefaultValue = new Client.Tasks.GPDouble(param.Name, val);
                                }
                            }
                            break;

                        case "GPLong":
                            config.Type = GPParameterType.Long;
                            if (!string.IsNullOrEmpty(defaultString))
                            {
                                int val = 0;
                                if (int.TryParse(defaultString, out val))
                                {
                                    config.DefaultValue = new ESRI.ArcGIS.Client.Tasks.GPLong(param.Name, val);
                                }
                            }
                            break;

                        case "GPDate":
                            config.Type = GPParameterType.Date;
                            if (!string.IsNullOrEmpty(defaultString))
                            {
                                long ticks = 0;
                                if (long.TryParse(defaultString, out ticks))
                                {
                                    config.DefaultValue = new ESRI.ArcGIS.Client.Tasks.GPDate(param.Name, Epoch.AddMilliseconds(ticks));
                                }
                            }
                            break;

                        case "GPLinearUnit":
                            config.Type = GPParameterType.LinearUnit;
                            if (param.DefaultValue is ESRI.ArcGIS.Mapping.GP.MetaData.GPLinearUnit)
                            {
                                ESRI.ArcGIS.Mapping.GP.MetaData.GPLinearUnit value = (param.DefaultValue as ESRI.ArcGIS.Mapping.GP.MetaData.GPLinearUnit);
                                config.DefaultValue = new ESRI.ArcGIS.Client.Tasks.GPLinearUnit(param.Name,
                                                                                                (ESRI.ArcGIS.Client.Tasks.esriUnits)(Enum.Parse(typeof(ESRI.ArcGIS.Client.Tasks.esriUnits), value.Units, true)),
                                                                                                value.Distance);
                            }
                            break;

                        case "GPString":
                            config.Type         = GPParameterType.String;
                            config.DefaultValue = new ESRI.ArcGIS.Client.Tasks.GPString(param.Name, defaultString);
                            if (param.ChoiceList != null && param.ChoiceList.Length > 0)
                            {
                                config.ChoiceList = new List <Choice>(param.ChoiceList.Length);
                                for (int i = 0; i < param.ChoiceList.Length; i++)
                                {
                                    config.ChoiceList.Add(new Choice()
                                    {
                                        DisplayText = param.ChoiceList[i],
                                        Value       =
                                            new ESRI.ArcGIS.Client.Tasks.GPString(param.Name, param.ChoiceList[i])
                                    });
                                }
                            }
                            break;

                        case "GPMultiValue:GPString":
                            config.Type = GPParameterType.MultiValueString;

                            object[] defaultStrings = param.DefaultValue as object[];
                            // the default value could be an array of strings
                            if (defaultStrings != null && defaultStrings.Length > 0)
                            {
                                List <GPString> list =
                                    (from string s in defaultStrings select new GPString(param.Name, s)).ToList();

                                config.DefaultValue = new GPMultiValue <GPString>(param.Name, list);
                            }

                            if (param.ChoiceList != null && param.ChoiceList.Length > 0)
                            {
                                config.ChoiceList = new List <Choice>(param.ChoiceList.Length);
                                foreach (string t in param.ChoiceList)
                                {
                                    config.ChoiceList.Add(new Choice
                                    {
                                        DisplayText = t,
                                        Value       = new GPString(param.Name, t)
                                    });
                                }
                            }
                            break;

                        case "GPRecordSet":
                            config.Type    = GPParameterType.RecordSet;
                            config.ToolTip = config.HelpText = Resources.Strings.EnterUrlForRecordset;
                            break;

                        case "GPDataFile":
                            config.Type    = GPParameterType.DataFile;
                            config.ToolTip = config.HelpText = Resources.Strings.EnterUrlForFile;
                            break;

                        default:
                            break;
                            #endregion
                        }
                        #endregion
                    }
                    if (config != null)
                    {
                        if (param.Direction == "esriGPParameterDirectionInput")
                        {
                            config.Input = true;
                            InputParameters.Add(config);
                        }
                        else
                        {
                            config.Input = false;
                            OutputParameters.Add(config);
                        }
                    }
                }
            }

            if (!string.IsNullOrEmpty(serviceInfo.ResultMapServerName) && !string.IsNullOrEmpty(serviceInfo.CurrentVersion))
            {
                MapServiceLayerParameterConfig layerConfig = new MapServiceLayerParameterConfig
                {
                    Name                = serviceInfo.ResultMapServerName,
                    LayerName           = serviceInfo.ResultMapServerName,
                    Type                = GPParameterType.MapServiceLayer,
                    LayerInfos          = resultMapserviceLayerInfos,
                    SupportsJobResource = true,
                    Opacity             = 1,
                };
                OutputParameters.Add(layerConfig);
                LayerOrder.Add(layerConfig.Name);
            }

            #endregion
        }
Example #21
0
 public RepositoryMethod AddOutputParameter(DomainInputType type, string name)
 {
     OutputParameters.Add(new DataParameter(type, name));
     return(this);
 }
Example #22
0
 public void AddOutputParameter(string parameter, object value)
 {
     OutputParameters.Add(parameter, value);
 }
 public DbCommandWrapper WithOutputParameter(string name, DbType type, int size, Action <object> setter)
 {
     CheckParameterForDuplication(name);
     OutputParameters.Add(name, new OutputParameter(name, type, size, setter));
     return(this);
 }