Beispiel #1
0
        private byte[] SaveFeaturesOperHandler(NameValueCollection boundVariables,
                                               JsonObject operationInput,
                                               string outputFormat,
                                               string requestProperties,
                                               out string responseProperties)
        {
            responseProperties = null;

            JsonObject joConn;
            bool       found = operationInput.TryGetJsonObject("connectionString", out joConn);

            if (!found || joConn == null)
            {
                throw new ArgumentNullException("connectionString can not parse to jsonobject");
            }

            JsonObject joFC;

            found = operationInput.TryGetJsonObject("featureClass", out joFC);
            if (!found || joFC == null)
            {
                throw new ArgumentNullException("featureClass can not parse to jsonobject");
            }

            object[] joFeatures;
            found = operationInput.TryGetArray("features", out joFeatures);
            if (!found || joFeatures == null)
            {
                throw new ArgumentNullException("features can not parse to jsonobject");
            }

            JsonObject result = new JsonObject();

            ConnectionJSObject   connJsObj = ParamsParser.ParseConn(joConn);
            FeatureClassJSObject fcObj     = ParamsParser.ParseFeatrureClass(joFC);
            List <FeatureObject> features  = ParamsParser.ParseFeatures(joFeatures);

            bool           isok   = false;
            int            count  = 0;
            string         outMsg = string.Empty;
            FeaturesHelper helper = new FeaturesHelper();

            isok = helper.SaveFeatures(connJsObj, fcObj, features, out count, out outMsg);
            result.AddBoolean("isSucess", isok);
            result.AddLong("recordCount", count);
            result.AddString("outMsg", outMsg);

            return(Encoding.UTF8.GetBytes(result.ToJson()));
        }