public LoadDataMethod() { using (DataClassesMatchDataContext2 matches = new DataClassesMatchDataContext2(Conn.conn)) { var match = from p in matches.Analysis_Review where p.result_grnn != null where p.bj_select == 1 group p by p.Match_type into ttt select new { ttt.Key, yes = ttt.Where(e => e.result_grnn == "yes").Count(), no = ttt.Where(e => e.result_grnn == "no").Count(), yesrate = 100.0 * ttt.Where(e => e.result_grnn == "yes").Count() / ttt.Count(), }; yesornorate = match.Where(e => e.yesrate > 50 || e.no <= 2).Select(e => e.Key).ToList(); } }
private void button26_Click(object sender, EventArgs eee) { using (DataClassesMatchDataContext2 matches = new DataClassesMatchDataContext2(Conn.conn)) { var match = from p in matches.Analysis_Review //where p.Match_time.Value > DateTime.Now where p.result_grnn != null where p.bj_select == 1 group p by p.Match_type into ttt select new { ttt.Key, yes = ttt.Where(e => e.result_grnn == "yes").Count(), no = ttt.Where(e => e.result_grnn == "no").Count(), yesrate = 100.0 * ttt.Where(e => e.result_grnn == "yes").Count() / ttt.Count(), }; gridControl1.DataSource = match.OrderBy(e => e.yesrate); gridControl1.Refresh(); gridView1.PopulateColumns(); gridView1.OptionsView.ColumnAutoWidth = false; gridView1.BestFitColumns(); //设置并制作Foot下面的统计信息 gridView1.Columns[0].SummaryItem.DisplayFormat = "{0}"; //gridView1.Columns[0].SummaryItem.FieldName = "yesrate"; gridView1.Columns[0].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Count; } }
private void todayAnalysisReview() { LoadDataMethod ldm = new LoadDataMethod(); using (DataClassesMatchDataContext2 matches = new DataClassesMatchDataContext2(Conn.conn)) { var tables = matches.Analysis_Review .Where(e => e.Match_time.Value > DateTime.Now.AddDays(-1)) .Where(e => ldm.yesornorate.Contains(e.Match_type)) .Where(e => e.bj_select == 1) .OrderBy(e => e.Match_time); gridControl1.DataSource = tables; gridControl1.Refresh(); gridView1.PopulateColumns(); DevExpress.XtraGrid.Columns.GridColumn col = gridView1.Columns[19]; col.DisplayFormat.FormatString = "yyyy-MM-dd HH:mm:ss"; col.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Custom; gridView1.OptionsView.ColumnAutoWidth = false; gridView1.BestFitColumns(); //设置并制作Foot下面的统计信息 gridView1.Columns[19].SummaryItem.DisplayFormat = "{0}"; //gridView1.Columns[0].SummaryItem.FieldName = "analysis_review_id"; gridView1.Columns[19].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Count; } }