protected void Page_Load(object sender, EventArgs e) { var date = Request.QueryString["time"]; Query.Data.Query q = HttpContext.Current.Session["TQuery"] as Query.Data.Query; if (date != null && q != null) { this.rpt_d.DataSource = DB.Current.sm_biz_Workpiece .Where(x => x.MachineID == q.MachineID && x.Type == q.Type && x.Date == date.ToDateTime() && x.Shift == 'D'); this.rpt_n.DataSource = DB.Current.sm_biz_Workpiece .Where(x => x.MachineID == q.MachineID && x.Type == q.Type && x.Date == date.ToDateTime() && x.Shift == 'N'); this.rpt_n.DataBind(); this.rpt_d.DataBind(); } else { this.Label1.Visible = true; } }
public void ProcessRequest(HttpContext context) { Query.Data.Query q = HttpContext.Current.Session["TQuery"] as Query.Data.Query; context.Response.ContentType = "text/plain"; var Day = context.Request.Form["Day"].Replace("合计", string.Empty); var total = context.Request.Form["Total"]; var db = BAL.DB.Current; List <DAL.sm_biz_Workpiece> data = null; if (string.IsNullOrEmpty(Day)) { data = (from x in db.sm_biz_Workpiece join s in db.sm_biz_State on x.State equals s.ID where x.Date >= q.TimeFrom && x.Date < q.TimeTo && s.Group == (int)q.Step select x).ToList(); } else { data = (from x in db.sm_biz_Workpiece join s in db.sm_biz_State on x.State equals s.ID where x.Date == Day.ToDateTime() && s.Group == (int)q.Step select x).ToList(); } var dic = new Dictionary <int, int>(); var chd = (from x in data group x by x.State into g select new Group { Key = g.Key, Count = g.Count() }).ToList(); var cht = new GoogleApi.Chart(new GoogleApi.ChartType.Pie(PieType.p3)); cht.Size.Height = 200; cht.Size.Width = 500; foreach (var ee in chd) { cht.Lables.List.Add(ee.State + ee.Count + "/" + total); } cht.Data.Group.Add(new List <float>(chd.Select(x => (float)x.Count))); context.Response.Write(cht.ToString()); }