Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- public partial class _10 : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- DataClassesDataContext db = new DataClassesDataContext();
- var qry = from unit in db.Products
- where unit.UnitPrice > 0
- select unit.UnitPrice;
- /*
- * Esto es lo que pide en el TP, pero él nos dijo
- * que no era lógico meter esta info en un GridView
- * que lo mostraramos de otra forma
- List<Object> lista = new List<Object>();
- *
- */
- var cantInt = qry.Count();
- var cantDec = qry.Max();
- var aver = qry.Average();
- var first = qry.First();
- /*
- lista.Add(cantInt);
- lista.Add(cantDec);
- lista.Add(aver);
- lista.Add(first);
- GridView1.DataSource = lista;
- GridView1.DataBind();
- */
- //Por span:
- spanCantidad.InnerHtml = cantInt.ToString();
- spanMaximo.InnerHtml = cantDec.ToString();
- spanPromedio.InnerHtml = aver.ToString();
- spanPrimero.InnerHtml = first.ToString();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement