示例#1
0
        /// <summary>
        /// Create an "request" (verzoek) to send to the API. It will fill in the properties based on the suplied order, and the user bsn.
        /// For the move request we add the person as an property as an exception.
        /// The target organization of municipality DenBosch is used for now. This will be the organization that will handle the request.
        /// </summary>
        /// <param name="order"></param>
        /// <param name="bsn"></param>
        private Request CreateRequestData(Order order, string bsn)
        {
            var submitter = new Submitter {
                person = bsn
            };
            var organization = new Organization {
                rsin = TargetOrganizationDenBosch
            };

            var request = new Request
            {
                submitters    = new [] { submitter },
                request_cases = new string[0],
                properties    = new Dictionary <string, object>(),
                organizations = new [] { organization },
                request_type  = _orderTypeBaseUri + "request_types/" + order.requestType
            };

            foreach (var question in order.data.Where(q => q.question != "END"))
            {
                if (question.key is string)
                {
                    //Normal question
                    if (question.value is string)
                    {
                        request.properties.Add(question.key, question.value);
                    }
                    else
                    {
                        var values = "";
                        if (question.value != null)
                        {
                            values = string.Join(", ", question.value);
                        }

                        if (question.key != null)
                        {
                            request.properties.Add(question.key, values);
                        }
                    }
                }
                else
                {
                    //Multiple keys/values in question
                    var index = 0;
                    foreach (string key in question.key)
                    {
                        var value = question.value[index].ToString();
                        request.properties.Add(key, value);
                        index++;
                    }
                }
            }

            //TODO: Add some properties to verhuizen requestType on a fixed id for now. Will need to be discussed with Conduction.
            if (order.requestType == "9d76fb58-0711-4437-acc4-9f4d9d403cdf")
            {
                request.properties.Add("eigenaar", true);
                request.properties.Add("ingangsdatum", "01-01-2000");
                request.properties.Add("doorgeven_gegevens", false);
            }

            return(request);
        }
示例#2
0
        /// <summary>
        /// Create an "request" (verzoek) to send to the API. It will fill in the properties based on the suplied order, and the user bsn.
        /// For the move request we add the person as an property as an exception.
        /// The target organization of municipality DenBosch is used for now. This will be the organization that will handle the request.
        /// </summary>
        /// <param name="order"></param>
        /// <param name="bsn"></param>
        private Request CreateRequestData(Order order, string bsn)
        {
            var submitter = new Submitter {
                person = bsn
            };
            //var submitter = new Submitter { person = "680508429" }; //Added request for different bsn.
            var organization = new Organization
            {
                id   = OrganizationIdDenBosch,
                rsin = TargetOrganizationDenBosch
            };

            var request = new Request
            {
                submitters    = new [] { submitter },
                request_cases = new string[0],
                properties    = new Dictionary <string, object>(),
                organization  = _webResourceBaseUri + "organizations/" + organization.id,
                request_type  = _orderTypeBaseUri + "request_types/" + order.requestType,
                status        = "complete",
            };

            foreach (var question in order.data.Where(q => q.question != "END"))
            {
                if (question.key is string)
                {
                    //Normal question
                    if (question.value is string)
                    {
                        request.properties.Add(question.key, question.value);
                    }
                    else
                    {
                        var values = "";
                        if (question.value != null)
                        {
                            values = string.Join(", ", question.value);
                        }

                        if (question.key != null)
                        {
                            request.properties.Add(question.key, values);
                        }
                    }
                }
                else
                {
                    //Multiple keys/values in question
                    var index = 0;
                    foreach (string key in question.key)
                    {
                        var value = question.value[index].ToString();
                        request.properties.Add(key, value);
                        index++;
                    }
                }
            }

            //TODO: Add some properties to verhuizen requestType on a fixed id for now. Will need to be discussed with Conduction.
            if (order.requestType == MovePersonRequestTypeId)
            {
                request.properties.Add("eigenaar", true);
                request.properties.Add("ingangsdatum", "01-01-2000");
                request.properties.Add("doorgeven_gegevens", false);
            }

            return(request);
        }