public IQueryable<Log> GetLogs() { GasContext _db = new GasContext(); IQueryable<Log> query = _db.Logs.Select(row => row); return query; }
public IQueryable<GasPrice> GetGasPrices() { GasContext _db = new GasContext(); IQueryable<GasPrice> query = _db.GasPrices.Select(row => row); return query; }
// e.q. of QueryString("id") http://localhost/ProductList.aspx?id=1 public IQueryable<Log> GetLogEntriesQS([QueryString("id")] int? Id/*, [RouteData] string UserName*/) { var _db = new GasContext(); IQueryable<Log> query = _db.Logs; //TODO: atm it shows logs by id from QueryString, it would make more sense to manually pick user to check his logs or have // a date range picker to show all logs for certain time period if (Id.HasValue && Id > 0) { query = query.Where(l => l.LogId == Id); } return query; }
protected void Page_Load(object sender, EventArgs e) { GasContext _db = new GasContext(); IQueryable<DateTime> gasPricesDate = _db.GasPrices .Select(x => x.gasDate); var gd = gasPricesDate.ToArray(); var gds = new string[gd.Length]; for (int i = 0; i < gd.Length; i++) { gds[i] = Conversion.getTime(gd[i]).ToString(); } IQueryable<decimal> gasPricesPrice = _db.GasPrices .Select(x => x.gasPrice); var gp = gasPricesPrice.ToArray(); var gps = new decimal[gp.Length]; for (int i = 0; i < gp.Length; i++) { gps[i] = gp[i]; } object[,] dataFill = new object[gasPricesDate.Count(), 2]; for (int i = 0; i < gasPricesDate.Count(); i++) { dataFill[i, 0] = gds[i]; dataFill[i, 1] = gps[i]; } Series serie = new Series { Data = new Data(dataFill) }; Highstock chart = new Highstock("chart"); chart.SetSeries(serie); chart.SetYAxis(new YAxis { Labels = new YAxisLabels { Formatter = "function() { return Highcharts.numberFormat(this.value, 2) ;}" } }); chart.SetTooltip(new Tooltip { PointFormat = "Value: {point.y:.2f}" }); ltrChartGasPrice.Text = chart.ToHtmlString(); }
public IQueryable<Log> GetLogs() { var _db = new DemoMPE.Models.GasContext(); IQueryable<Log> query = _db.Logs; return query; }
public IQueryable<GasPrice> GetGasPrices() { var _db = new DemoMPE.Models.GasContext(); IQueryable<GasPrice> query = _db.GasPrices; return query; }