public LocalChart(PbChart chart)
 {
     if (chart == null)
     {
         throw new ArgumentNullException("chart");
     }
     Chart = chart;
 }
 public LocalChart(PbChart chart)
 {
     if (chart == null) throw new ArgumentNullException("chart");
     Chart = chart;
 }
        public static async Task <LocalChart> GetChartDataAsync(string actionItemInstanceId, int propertyId)
        {
            if (actionItemInstanceId == null)
            {
                throw new ArgumentNullException("actionItemInstanceId");
            }

            try
            {
                using (var client = ConfigureClient())
                {
                    var queryString = "?propertyId=" + propertyId
                                      + "&approvalInstId=" + actionItemInstanceId;
                    var response = await client.GetAsync("actioncenter/prebillingdetail" + queryString);

                    response.EnsureSuccessStatusCode();
                    var json = await response.Content.ReadAsStringAsync();

                    var chart = JsonConvert.DeserializeObject <PbChart>(json);
                    return(new LocalChart(chart));
                }
            }
            catch (Exception)
            {
                var chart = new PbChart
                {
                    SupplierId = "1234141",
                    PerEndDt   = "04132015"
                };
                var rng = new Random();
                for (var i = 0; i < rng.Next(60, 500); i++)
                {
                    var x = rng.Next(0, 100);
                    if (x <= 4)
                    {
                        chart.VacantCount++;
                    }
                    else if (x < 10)
                    {
                        chart.Count_0_10++;
                    }
                    else if (x < 20)
                    {
                        chart.Count_10_20++;
                    }
                    else if (x < 30)
                    {
                        chart.Count_20_30++;
                    }
                    else if (x < 40)
                    {
                        chart.Count_30_40++;
                    }
                    else if (x < 50)
                    {
                        chart.Count_40_50++;
                    }
                    else if (x < 60)
                    {
                        chart.Count_50_60++;
                    }
                    else if (x < 70)
                    {
                        chart.Count_GT60++;
                    }
                }
                chart.TotalCurrentCharges = rng.Next(0, 10000);
                chart.BillableCount       = chart.Count_GT60 + chart.Count_50_60 + chart.Count_40_50 + chart.Count_30_40 + chart.Count_20_30 + chart.Count_10_20 + chart.Count_0_10;
                return(new LocalChart(chart));
            }
        }
        public static async Task<LocalChart> GetChartDataAsync(string actionItemInstanceId, int propertyId)
        {
            if (actionItemInstanceId == null) throw new ArgumentNullException("actionItemInstanceId");

            try
            {
                using (var client = ConfigureClient())
                {
                    var queryString = "?propertyId=" + propertyId
                        + "&approvalInstId=" + actionItemInstanceId;
                    var response = await client.GetAsync("actioncenter/prebillingdetail" + queryString);
                    response.EnsureSuccessStatusCode();
                    var json = await response.Content.ReadAsStringAsync();
                    var chart = JsonConvert.DeserializeObject<PbChart>(json);
                    return new LocalChart(chart);
                }
            }
            catch (Exception)
            {

                var chart = new PbChart
                {
                    SupplierId = "1234141",
                    PerEndDt = "04132015"
                };
                var rng = new Random();
                for (var i = 0; i < rng.Next(60, 500); i++)
                {
                    var x = rng.Next(0, 100);
                    if (x <= 4)
                        chart.VacantCount++;
                    else if (x < 10)
                        chart.Count_0_10++;
                    else if (x < 20)
                        chart.Count_10_20++;
                    else if (x < 30)
                        chart.Count_20_30++;
                    else if (x < 40)
                        chart.Count_30_40++;
                    else if (x < 50)
                        chart.Count_40_50++;
                    else if (x < 60)
                        chart.Count_50_60++;
                    else if (x < 70)
                        chart.Count_GT60++;
                }
                chart.TotalCurrentCharges = rng.Next(0, 10000);
                chart.BillableCount = chart.Count_GT60 + chart.Count_50_60 + chart.Count_40_50 + chart.Count_30_40 + chart.Count_20_30 + chart.Count_10_20 + chart.Count_0_10;
                return new LocalChart(chart);
            }
        }