Hi i am using WCF RIA services class in Silverlight.
I do have a line chart control named mcChart in which i have bound the item source to Date and Amount properties of class customer.
public class Customer
{
public DateTime Date{ get; set; }
public int Amount{ get; set; }
}
I do have this method through WCF ria domain service class to access the sql table gardenwater{Id, Date, Amt}:
public IQueryable<gardenwater> GetGardenwaters()
{
return this.ObjectContext.gardenwaters;
}
Now i want to store the data in List<Customer> cust = new List<Customer>(); so that it can be shown in the chart.
I have tried like this :
EntityQuery<gardenwater> inquery = from c in wdc.GetGardenwatersQuery()
select new { Date =Convert.ToDateTime(c.Date), Amount =Convert.ToInt32(c.usedwater) };
and then
foreach (var gardenWater in inquery )
{
cust.Add(new Customer() { Date = Convert.ToDateTime(gardenWater.Date), Amount = Convert.ToInt32(gardenWater.usedwater) });
}
mcChart.DataContext = cust;
Doing all the above i am not able to get any good results.
I want to display the data through storing SQL table data in Class properties.
Please suggest me what can i do or what mistakes i am doing ?
I got it resolved by now…i can use following