Esempio n. 1
5
 public static string PhonesToJson(Phone phone, Phone[] phones)
 {
     var items = new List<Phone> { phone };
     items.AddRange(phones ?? new Phone[0]);
     var array = new JArray();
     foreach (var item in items)
     {
         var itm = new JArray { new JValue(item.PhoneNumber) };
         if (!String.IsNullOrEmpty(item.Variables))
             itm.Add(new JValue(item.Variables));
         array.Add(itm);
     }
     return array.ToString();
 }
Esempio n. 2
1
        public void FormatPropertyInJson()
        {
            JObject query = new JObject();
            JProperty orderProp = new JProperty("order", "breadth_first");
            query.Add(orderProp);

            JObject returnFilter = new JObject();
            returnFilter.Add("body", new JValue("position.endNode().getProperty('name').toLowerCase().contains('t')"));
            returnFilter.Add("language", new JValue("javascript"));

            query.Add("return_filter", new JValue(returnFilter.ToString()));

            JObject pruneEval = new JObject();
            pruneEval.Add("body", new JValue("position.length() > 10"));
            pruneEval.Add("language", new JValue("javascript"));
            query.Add("prune_evaluator", pruneEval.ToString());

            query.Add("uniqueness", new JValue("node_global"));

            JArray relationships = new JArray();
            JObject relationShip1 = new JObject();
            relationShip1.Add("direction", new JValue("all"));
            relationShip1.Add("type", new JValue("knows"));
            relationships.Add(relationShip1);

            JObject relationShip2 = new JObject();
            relationShip2.Add("direction", new JValue("all"));
            relationShip2.Add("type", new JValue("loves"));
            relationships.Add(relationShip2);

            query.Add("relationships", relationships.ToString());
            //arr.Add(
            Console.WriteLine(query.ToString());
            //Assert.AreEqual(@"""order"" : ""breadth_first""", jobject.ToString());
        }
Esempio n. 3
0
        public static string GetPageContentByPageId(int pageId, string loginUserInfo)
        {
            JArray ja = new JArray();
            try
            {
                using (venuesEntities db = new venuesEntities())
                {
                    string strSql = string.Format("SELECT tpc.ContentSequence,tpc.ContentValue,tpc.ID,tpc.ModuleID,tpc.PageID,tpc.TemplateID ,tm.ModuleType FROM tbl_page_content AS tpc LEFT JOIN tbl_module AS tm ON tm.ID=tpc.ModuleID WHERE tpc.PageID= {0}", pageId);

                    ObjectQuery<DbDataRecord> kss = db.CreateQuery<DbDataRecord>(strSql);
                    string path = System.Configuration.ConfigurationManager.AppSettings["FilePath"].ToString();
                    foreach (var ks in kss)
                    {
                        ja.Add(
                            new JObject(
                               new JProperty("ID", ks["ID"].ToString()),
                               new JProperty("ContentSequence", ks["ContentSequence"].ToString()),
                               new JProperty("ContentValue", ks["ContentValue"].ToString()),
                               new JProperty("FileNameServer", ks["ContentValue"].ToString()),
                               new JProperty("ModuleID", ks["ModuleID"].ToString()),
                               new JProperty("ModuleTypeID", ks["ModuleType"].ToString()),
                               new JProperty("PageID", ks["PageID"].ToString()),
                               new JProperty("TemplateID", ks["TemplateID"].ToString())
                              // new JProperty("FilePathAddress", path)
                                )
                            );
                    };
                }
            }
            catch (Exception e)
            {
                LogManager.addLog(KeyManager.LogTypeId_Error, KeyManager.MENUS.Menu_PagesManager, "根据pageId获取该页面内容信息:" + e.Message, loginUserInfo);
            }
            return ja.ToString();
        }
        public void ReadAsCollection_ObjectArray()
        {
            JArray values = new JArray();
            for (int i = 1; i <= 3; i++)
            {
                JObject jsonObject = new JObject
                {
                    { "prop1", "value1" },
                    { "prop2", true },
                    { "prop3", 123 }
                };
                values.Add(jsonObject);
            }

            string json = values.ToString();
            byte[] bytes = Encoding.UTF8.GetBytes(json);
            MemoryStream ms = new MemoryStream(bytes);

            var result = FunctionBinding.ReadAsCollection(ms).ToArray();

            Assert.Equal(3, result.Length);
            for (int i = 0; i < 3; i++)
            {
                JObject jsonObject = (JObject)result[i];
                Assert.Equal("value1", (string)jsonObject["prop1"]);
                Assert.Equal(true, (bool)jsonObject["prop2"]);
                Assert.Equal(123, (int)jsonObject["prop3"]);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Parse the property editors from the json array
 /// </summary>
 /// <param name="jsonEditors"></param>
 /// <returns></returns>
 internal static IEnumerable<PropertyEditor> GetPropertyEditors(JArray jsonEditors)
 {
     return JsonConvert.DeserializeObject<IEnumerable<PropertyEditor>>(
         jsonEditors.ToString(), 
         new PropertyEditorConverter(),
         new PreValueFieldConverter());
 }
Esempio n. 6
0
        public static string GetAllTheme()
        {
            JArray ja = new JArray();
            try
            {
                using (venuesEntities db = new venuesEntities())
                {
                    string strSql = "SELECT tt.ID,tt.ThemeImage,tt.ThemeName,tt.Sequence FROM tbl_theme AS tt ORDER BY tt.Sequence";

                    ObjectQuery<DbDataRecord> kss = db.CreateQuery<DbDataRecord>(strSql);

                    foreach (var ks in kss)
                    {
                        ja.Add(
                            new JObject(
                               new JProperty("ID", ks["ID"].ToString()),
                               new JProperty("ThemeImage", ks["ThemeImage"].ToString()),
                               new JProperty("Sequence", ks["Sequence"].ToString()),
                               new JProperty("ThemeName", ks["ThemeName"].ToString())
                                )
                            );
                    };
                }
            }
            catch (Exception e)
            {
               // LogManager.addLog(KeyManager.LogTypeId_Error, KeyManager.MENUS.Menu_SalesManager, "查询所有主题,error=" + e.Message, loginUserInfo);
            }
            return ja.ToString();
        }
Esempio n. 7
0
 private void Save()
 {
     JArray array = new JArray();
     foreach(Control c in Page.Form.Controls){
         if(c is TextBox){
             TextBox tb = (TextBox) c;
             if(!tb.Text.IsNullOrEmpty()){
                 array.Add(JObject.Parse("{\"id\":\"" + tb.ID + "\",\"value\":\"" + tb.Text.Trim() + "\"}"));
             }
         }
     }
     if(array.Count > 0){
         int did = Request["did"].ToInt32();
         FormData model = service.GetFormData(did,FormType.LQHHLJL);
         if(model != null){
             model.formdata = array.ToString();
             service.UpdateFormData(model);
         }
         else{
             service.AddFormData(new FormData
             {
                 dataid = did,
                 formtype = FormType.LQHHLJL,
                 formdata = array.ToString()
             });
         }
         if(sample != null){
             sample.SerialNum = TextBox2.Text.Trim();
             sample.JGBW = TextBox9.Text.Trim();
             sampleService.UpdateSample(sample);
         }
     }
 }
Esempio n. 8
0
        /// <summary>
        /// Begins the async batch operation
        /// </summary>
        /// <param name="commandDatas">The command data.</param>
        /// <returns></returns>
        public Task<BatchResult[]> BatchAsync(ICommandData[] commandDatas)
        {
            var metadata = new JObject();
            AddTransactionInformation(metadata);
            var req = HttpJsonRequest.CreateHttpJsonRequest(this, url + "/bulk_docs", "POST", metadata, credentials);
            var jArray = new JArray(commandDatas.Select(x => x.ToJson()));
            var data = Encoding.UTF8.GetBytes(jArray.ToString(Formatting.None));

            return Task.Factory.FromAsync(req.BeginWrite, req.EndWrite, data, null)
                .ContinueWith(writeTask => Task.Factory.FromAsync<string>(req.BeginReadResponseString, req.EndReadResponseString,null))
                .Unwrap()
                .ContinueWith(task =>
                {
                    string response;
                    try
                    {
                        response = task.Result;
                    }
                    catch (WebException e)
                    {
                        var httpWebResponse = e.Response as HttpWebResponse;
                        if (httpWebResponse == null ||
                            httpWebResponse.StatusCode != HttpStatusCode.Conflict)
                            throw;
                        throw ThrowConcurrencyException(e);
                    }
                    return JsonConvert.DeserializeObject<BatchResult[]>(response);
                });
        }
Esempio n. 9
0
        public static Tuple<string, string> SplitShowsByGenre(string json, string genre)
        {
            JArray selectedShowsJson = new JArray();
            JArray otherShowsJson = new JArray();

            foreach (JObject showJson in JArray.Parse(json))
            {
                bool genreFound = false;
                foreach (JValue genreJson in showJson.Value<JArray>("genres"))
                {
                    if (genreJson.ToString() == genre)
                    {
                        selectedShowsJson.Add(showJson);
                        genreFound = true;
                        break;
                    }
                }
                if (!genreFound)
                {
                    otherShowsJson.Add(showJson);
                }
            }

            return new Tuple<string, string>(selectedShowsJson.ToString(Formatting.None), otherShowsJson.ToString(Formatting.None));
        }
Esempio n. 10
0
        public async Task<string> StartAsyncRequest(string url) {
            //lookup user and convert all their feed items into json
            //HACK CAUTION: fragile, screen_name is last param so we can do this as long as it doesn't change
            string account = url.Split('=').Last();
            var items = Data.feeditems[account];

            var ja = new JArray();

            foreach (var i in items) {

                var jo = new JObject();

                jo["user"] = new JObject {["screen_name"] = i.account};;
                jo["created_at"] = i.createdAt.ToString(TwitterFeedItemService.twitterDateTimeFormat);
                jo["id"] = i.id;
                jo["text"] = i.text;

                var m = new JArray();
                for (int j = 1; j <= i.mentions; j++) {
                    m.Add("mention");
                }

                jo["entities"] = new JObject {["user_mentions"] = m};



                ja.Add(jo);
            }

            var t = new Task<string>(() => ja.ToString());
            t.Start();
            return await t;
        }
        private async void button_send_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
        {
            JArray ja = new JArray();

            foreach (var a in ((ListView)listView_friends).SelectedItems)
            {
                classes.Friend friendToSendSnapTo = (classes.Friend)(a);
                ja.Add(friendToSendSnapTo.username);
            }

            String JSON = await a.sendSnap(main.static_user, main.static_pass, pb, ja.ToString(), snap_file, int.Parse(slider_time.Value.ToString()));

            //Frame.Navigate(typeof(snap_screen));

            JObject jo = JObject.Parse(JSON);

            if (jo["status"].ToString() == "True")
            {
                h.showSingleButtonDialog("Snap uploaded", "Snap uploaded successfully!", "Dismiss");
            }
            else
            {
                h.showSingleButtonDialog("Server error [" + jo["code"] + "]", ((jo["message"] != null) ? jo["message"].ToString() : "No server message was provided"), "Dismiss");
            }

        }
Esempio n. 12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request["odds"] != null)
         {
             string[] oddsArray = Request["odds"].Split('|');
             DataTable dt = this.FillOddsHistory(oddsArray);//填充
             DateTime stime = Convert.ToDateTime(dt.Compute("max(time)", "")).AddHours(-6);// 6小时内
             dt = dt.Select("time > '" + stime.ToString() + "'").CopyToDataTable();
             JArray data = new JArray();
             foreach (DataRow dr in dt.Rows)
             {
                 DataSet ds = scheduleBLL.statOddsHistory("companyid=" + oddsArray[0] + " and e_win=" + dr["odds_w"] +
                                 " and e_draw=" + dr["odds_d"] + " and e_lost=" + dr["odds_l"]);
                 if (Convert.ToInt32(ds.Tables[0].Rows[0]["totalcount"]) > 0)
                 {
                     JObject obj = new JObject();
                     obj.Add("time", dr["time"].ToString());
                     obj.Add("win", Convert.ToDecimal(ds.Tables[0].Rows[0]["perwin"]) - Convert.ToDecimal(dr["per_w"]) * 100);
                     obj.Add("draw", Convert.ToDecimal(ds.Tables[0].Rows[0]["perdraw"]) - Convert.ToDecimal(dr["per_d"]) * 100);
                     obj.Add("lost", Convert.ToDecimal(ds.Tables[0].Rows[0]["perlost"]) - Convert.ToDecimal(dr["per_l"]) * 100);
                     obj.Add("totalcount", Convert.ToInt32(ds.Tables[0].Rows[0]["totalcount"]));
                     data.Add(obj);
                 }
             }
             Response.Write(data.ToString());
             Response.End();
         }
     }
 }
 public RestResponse AddAdditionalResults(int monitorId, JArray jsArray, long checktime)
 {
     var parameters = new Dictionary<String, Object>();
     parameters.Add("monitorId", monitorId);
     parameters.Add("results", jsArray.ToString());
     parameters.Add("checktime", checktime);
     return MakePostRequest(CustomMonitoraction.addAdditionalResults, parameters);
 }
 public IActionResult List()
 {
     JArray names = new JArray(
         from name in FileAccess.GetVenueNames()
         select new JValue(name)
     );
     return Content(names.ToString());
 }
 public IActionResult List()
 {
     JArray arr = new JArray(
         from name in FileAccess.GetFixtureNames()
         select new JValue(name)
     );
     return Content(arr.ToString());
 }
Esempio n. 16
0
 public void JArray_Should_Support_Complex_Types()
 {
     var arry = new JArray();
     arry.Add(1);
     arry.Add("abc");
     var result = arry.ToString(Formatting.None);
     Assert.AreEqual("[1,\"abc\"]", result);
 }
Esempio n. 17
0
 public virtual byte[] GetExceptionResponse(Exception ex)
 {
     JToken jresult = JToken.FromObject(ex.Message);
     JArray response = new JArray();
     response.Add("ERR");
     response.Add(jresult);
     return Encoding.UTF8.GetBytes(response.ToString(Formatting.None));
 }
Esempio n. 18
0
        public void Example()
        {
            #region Usage
            IList<BlogPost> blogPosts = new List<BlogPost>
            {
                new BlogPost
                {
                    Title = "Json.NET is awesome!",
                    AuthorName = "James Newton-King",
                    AuthorTwitter = "JamesNK",
                    PostedDate = new DateTime(2013, 1, 23, 19, 30, 0),
                    Body = @"<h3>Title!</h3>
                             <p>Content!</p>"
                }
            };

            JArray blogPostsArray = new JArray(
                blogPosts.Select(p => new JObject
                {
                    { "Title", p.Title },
                    {
                        "Author", new JObject
                        {
                            { "Name", p.AuthorName },
                            { "Twitter", p.AuthorTwitter }
                        }
                    },
                    { "Date", p.PostedDate },
                    { "BodyHtml", HttpUtility.HtmlEncode(p.Body) },
                })
                );

            Console.WriteLine(blogPostsArray.ToString());
            // [
            //   {
            //     "Title": "Json.NET is awesome!",
            //     "Author": {
            //       "Name": "James Newton-King",
            //       "Twitter": "JamesNK"
            //     },
            //     "Date": "2013-01-23T19:30:00",
            //     "BodyHtml": "&lt;h3&gt;Title!&lt;/h3&gt;\r\n&lt;p&gt;Content!&lt;/p&gt;"
            //   }
            // ]
            #endregion

            Assert.AreEqual(@"[
  {
    ""Title"": ""Json.NET is awesome!"",
    ""Author"": {
      ""Name"": ""James Newton-King"",
      ""Twitter"": ""JamesNK""
    },
    ""Date"": ""2013-01-23T19:30:00"",
    ""BodyHtml"": ""&lt;h3&gt;Title!&lt;/h3&gt;\r\n                             &lt;p&gt;Content!&lt;/p&gt;""
  }
]", blogPostsArray.ToString());
        }
 public static void SavePlayerConfig()
 {
     var obj = new JArray();
     foreach(var ply in playerConfig.Select(x => x.Value))
     {
         obj.Add(ply);
     }
     File.WriteAllText("Plugins/minetessentials/players.json", obj.ToString());
 }
 public IActionResult List()
 {
     JArray arr = new JArray(
         from grp in MasterController.Instance.Groups.Values
         orderby grp.Order
         select new JValue(grp.Name)
     );
     return Content(arr.ToString());
 }
Esempio n. 21
0
 public static byte[] CreateEventMessage(string eventType, object ev)
 {
     JToken jev = JToken.FromObject(ev);
     var message = new JArray();
     message.Add(8);
     message.Add(eventType);
     message.Add(jev);
     return Encoding.UTF8.GetBytes(message.ToString(Formatting.None));
 }
Esempio n. 22
0
        public virtual byte[] GetOKResponse(object returnValue)
        {
            JToken jresult = (returnValue == null) ? new JRaw("null") : JToken.FromObject(returnValue);

            JArray response = new JArray();
            response.Add("OK");
            response.Add(jresult);
            return Encoding.UTF8.GetBytes(response.ToString(Formatting.None));
        }
Esempio n. 23
0
 public static byte[] CreateCallMessage(string callID, string methodName, params object[] args)
 {
     var message = new JArray();
     message.Add(2);
     message.Add(callID);
     message.Add(methodName);
     message.Add(JArray.FromObject(args));
     return Encoding.UTF8.GetBytes(message.ToString(Formatting.None));
 }
        private static string DeserializeToDynamic(string json)
        {
          
            var requests = new JArray();

            var array = JArray.Parse(json);
            foreach (var item in array)
            {
               
                if (item is JArray)
                {
                    foreach (var nested in item)
                    {
                        dynamic request = JsonConvert.DeserializeObject(nested.ToString(Formatting.None));

                        if (request.Body.Payload != null && request.Body.Payload.Payload != null)
                        {

                            var token = JToken.Parse(request.Body.Payload.Payload.ToString());
                            if (token is JArray)
                            {
                                var payload = JArray.Parse(request.Body.Payload.Payload.ToString());
                                request.Body.Payload.Payload = payload;
                            }
                            else
                            {
                                var payload = JObject.Parse(request.Body.Payload.Payload.ToString());
                                request.Body.Payload.Payload = payload;
                            }
                           
                           
                        }

                        if (request.Body.Payload != null && request.Body.Payload.MetaData != null)
                        {
                            var token = JToken.Parse(request.Body.Payload.MetaData.ToString());
                            if (token is JArray)
                            {
                                var metaData = JArray.Parse(request.Body.Payload.MetaData.ToString());
                                request.Body.Payload.MetaData = metaData;
                            }
                            else
                            {
                                var metaData = JObject.Parse(request.Body.Payload.MetaData.ToString());
                                request.Body.Payload.MetaData = metaData;
                            }
                        }

                        //requests.Add(request.ToString());
                        requests.Add(JArray.Parse("[" + request.ToString() + "]"));
                    }
                }
                
            }
            return requests.ToString(Formatting.None);
        }
		public void ProcessRequest (HttpContext context) {
			var lane_id = context.Request ["lane_id"].ToUInt32 ();
			if (lane_id == null) {
				context.Response.StatusCode = 400;
				context.Response.ContentType = "text/plain";
				context.Response.Write ("lane_id GET parameter is required.");
				return;
			}

			using (var db = new DB ())
			using (var cmd = db.CreateCommand ()) {
				DB.CreateParameter (cmd, "nlimit", LIMIT);
				DB.CreateParameter (cmd, "lane_id", (int) lane_id.Value);

				cmd.CommandText = @"SELECT 1 FROM lane WHERE id = @lane_id";
				if (cmd.ExecuteScalar () == null) {
					context.Response.StatusCode = 404;
					context.Response.ContentType = "text/plain";
					context.Response.Write ("No such lane.");
					return;
				}

				cmd.CommandText = @"
					SELECT rw.id, lane, host.host, revision, rw.state, rw.createdtime, rw.assignedtime, rw.startedtime, rw.endtime, workhost.host
					FROM revisionwork AS rw
					INNER JOIN lane ON lane.id = rw.lane_id
					INNER JOIN host ON host.id = rw.host_id
					LEFT OUTER JOIN host AS workhost ON workhost.id = rw.workhost_id
					INNER JOIN revision ON revision.id = rw.revision_id
					WHERE lane.id = @lane_id AND createdtime IS NOT NULL
					ORDER BY rw.createdtime DESC
					LIMIT @nlimit;
				";

				using (var reader = cmd.ExecuteReader ()) {
					var commits = new JArray ();
					while (reader.Read ()) {
						var commit = new JObject ();
						commit ["id"] = reader.GetInt32 (0);
						commit ["lane"] = reader.GetString (1);
						commit ["host"] = reader.GetString (2);
						commit ["revision"] = reader.GetString (3);
						commit ["status"] = reader.GetInt32 (4);
						commit ["createdtime"] = dateTimeToMilliseconds(reader.GetDateTimeOrNull(5));
						commit ["assignedtime"] = dateTimeToMilliseconds(reader.GetDateTimeOrNull(6));
						commit ["startedtime"] = dateTimeToMilliseconds(reader.GetDateTimeOrNull(7));
						commit ["endtime"] = dateTimeToMilliseconds(reader.GetDateTimeOrNull(8));
						commit ["assignedhost"] = reader.IsDBNull(9) ? null : reader.GetString (9);
						commits.Add (commit);
					}
					context.Response.StatusCode = 200;
					context.Response.ContentType = "application/json";
					context.Response.Write (commits.ToString ());
				}
			}
		}
Esempio n. 26
0
        public string T()
        {
            JArray array = new JArray();
            JValue text = new JValue("Manual text");
            JValue date = new JValue(new DateTime(2000, 5, 23));
 
            array.Add(text);
            array.Add(date);
 
            string json = array.ToString();
            return json;
        }
Esempio n. 27
0
		public void PublishEvent(string topic, string publishID) {
			foreach (WAMPClient c in clients) {
				if (c.subscribedTopics.ContainsKey(topic)) {
					JArray packet = new JArray();
					packet.Add (WAMPMessageType.EVENT);
					packet.Add (c.subscribedTopics[topic]);
					packet.Add (publishID);
					packet.Add (new JObject());
					c.Send(packet.ToString());
				}
			}

		}
Esempio n. 28
0
        public override byte[] GetExceptionResponse(Exception ex)
        {
            if (requestId == null || requestId.Type == JTokenType.Null)
                return null;

            JToken jresult = JToken.FromObject(ex.Message);
            JArray response = new JArray();
            response.Add(4);
            response.Add(requestId);
            response.Add(jresult);

            return Encoding.UTF8.GetBytes(response.ToString(Formatting.None));
        }
Esempio n. 29
0
        public override byte[] GetOKResponse(object returnValue)
        {
            if (requestId == null || requestId.Type == JTokenType.Null)
                return null;

            JToken jresult = (returnValue == null) ? new JRaw("null") : JToken.FromObject(returnValue);

            JArray response = new JArray();
            response.Add(3);
            response.Add(requestId);
            response.Add(jresult);

            return Encoding.UTF8.GetBytes(response.ToString(Formatting.None));
        }
Esempio n. 30
-1
        public async Task Run()
        {
            // Gather download count data from statistics warehouse
            IReadOnlyCollection<DownloadCountData> downloadData;
            Trace.TraceInformation("Gathering Download Counts from {0}/{1}...", StatisticsDatabase.DataSource, StatisticsDatabase.InitialCatalog);
            using (var connection = await StatisticsDatabase.ConnectTo())
            using (var transaction = connection.BeginTransaction(IsolationLevel.Snapshot))
            {
                downloadData = (await connection.QueryWithRetryAsync<DownloadCountData>(
                    _storedProcedureName, commandType: CommandType.StoredProcedure, transaction: transaction, commandTimeout: _defaultCommandTimeout)).ToList();
            }

            Trace.TraceInformation("Gathered {0} rows of data.", downloadData.Count);

            if (downloadData.Any())
            {
                SemanticVersion semanticVersion = null;

                // Group based on Package Id
                var grouped = downloadData.GroupBy(p => p.PackageId);
                var registrations = new JArray();
                foreach (var group in grouped)
                {
                    var details = new JArray();
                    details.Add(group.Key);
                    foreach (var gv in group)
                    {
                        // downloads.v1.json should only contain normalized versions - ignore others
                        if (SemanticVersion.TryParse(gv.PackageVersion, out semanticVersion)
                            && gv.PackageVersion == semanticVersion.ToNormalizedString())
                        {
                            var version = new JArray(gv.PackageVersion, gv.TotalDownloadCount);
                            details.Add(version);
                        }
                    }
                    registrations.Add(details);
                }

                var reportText = registrations.ToString(Formatting.None);

                foreach (var storageContainerTarget in Targets)
                {
                    try
                    {
                        var targetBlobContainer = await GetBlobContainer(storageContainerTarget);
                        var blob = targetBlobContainer.GetBlockBlobReference(ReportName);
                        Trace.TraceInformation("Writing report to {0}", blob.Uri.AbsoluteUri);
                        blob.Properties.ContentType = "application/json";
                        await blob.UploadTextAsync(reportText);
                        Trace.TraceInformation("Wrote report to {0}", blob.Uri.AbsoluteUri);
                    }
                    catch (Exception ex)
                    {
                        Trace.TraceError("Error writing report to storage account {0}, container {1}. {2} {3}",
                            storageContainerTarget.StorageAccount.Credentials.AccountName,
                            storageContainerTarget.ContainerName, ex.Message, ex.StackTrace);
                    }
                }
            }
        }