C# data

/*******************/

GetKilowatt(“Test1”, “Column”);
GetKilowatt(“Test2”, “Column”);

return Json(datakilowatt, JsonRequestBehavior.AllowGet);

 

 

 

/********NEW GetData*********/
List<EnergyKilowattData> datakilowatt = new List<EnergyKilowattData>();
private void GetKilowatt(string param_name,string param_type)
{
var db = new PetaPoco.Database(“DefaultConnection”);
EnergyKilowattData dataitems = new EnergyKilowattData();
dataitems.name=param_name;
dataitems.type=param_type;
dataitems.data= new ArrayList();
foreach (var a in db.Query<Kilowatt>(“;EXEC GetDataPerDate @StartDate, @EndDate, @UserID, @MCID, @SensorPostion”, new { StartDate = “2016-07-16 16:34:20.247”, EndDate = “2016-07-17 16:34:20.247”, UserID = 61, MCID = 63, SensorPostion = 1 }))
{
dataitems.data.Add(a.kilowatts);
}

datakilowatt.Add(dataitems);

}
/*

/*Model Class**/

public class EnergyKilowattData
{

public string name {get; set; }
public string type {get; set; }
public ArrayList data { get; set; }
}

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s