Ejemplo n.º 1
0
        public async Task <String> CreateObjectInfo([FromBody] LocationApi location)
        {
            IStatefulInfoApi info = ServiceProxy.Create <IStatefulInfoApi>(
                new Uri(uriString: "fabric:/InfoPaneApp/InfoPaneApi"),
                new ServicePartitionKey(0));

            String output = await info.CreateInfo(location.LocationId, location.NodeType, location.tenantName, location.tenantId);

            return(output);
        }
Ejemplo n.º 2
0
        public async Task <String> GetInfo(String nodeInfo)
        {
            NodeInfo         node = JsonConvert.DeserializeObject <NodeInfo>(nodeInfo);
            IStatefulInfoApi info = ServiceProxy.Create <IStatefulInfoApi>(
                new Uri(uriString: "fabric:/InfoPaneApp/InfoPaneApi"),
                new ServicePartitionKey(0));

            String output = await info.GetInfo(node.LocationId, node.NodeType, node.tenantName, node.tenantId);

            return(output);
        }
Ejemplo n.º 3
0
        public async Task <String> UpdateObjectProps([FromBody] String objProps)
        {
            Trace.WriteLine("---------------------------");
            Trace.WriteLine("Started" + DateTime.Now.ToString("h:mm:ss tt"));
            IStatefulInfoApi info = ServiceProxy.Create <IStatefulInfoApi>(
                new Uri(uriString: "fabric:/InfoPaneApp/InfoPaneApi"),
                new ServicePartitionKey(0));

            IStatefullErrorApi getinfoDocDB = ServiceProxy.Create <IStatefullErrorApi>(
                new Uri(uriString: "fabric:/ErrorApp/ErrorApi"),
                new ServicePartitionKey(0));

            JObject inputData = JObject.Parse(objProps);

            JObject json    = JObject.Parse(inputData["data"].ToString());
            string  Typedoc =
                await getinfoDocDB.GetObjectDocument(json["NodeType"].ToString(), inputData["tenantName"].ToString(), inputData["tenantId"].ToString());

            Trace.WriteLine("Getting error info" + DateTime.Now.ToString("h:mm:ss tt"));
            dynamic jsondoc = JsonConvert.DeserializeObject(Typedoc);

            if (jsondoc != null)
            {
                foreach (var docobj in jsondoc)
                {
                    foreach (var js in json)
                    {
                        string key = docobj["Name"];
                        if (js.Key.Equals(key))
                        {
                            if (!(js.Value.ToString().Equals("")))
                            {
                                json["IsMissingField"] = "false";
                            }
                            if ((js.Value.ToString().Equals("")))
                            {
                                json["IsMissingField"] = "true";
                            }
                        }
                    }
                }
            }
            Trace.WriteLine("Updating to database response" + DateTime.Now.ToString("h:mm:ss tt"));

            String response = await info.UpdateObjectProperty(json.ToString(), inputData["tenantName"].ToString(), inputData["tenantId"].ToString());

            Trace.WriteLine("Returning response" + DateTime.Now.ToString("h:mm:ss tt"));

            return(response);
        }