private static List <TreeNode> ReadGBT7314Samples(DateTime dtp) { BLL.Compress bllC = new HR_Test.BLL.Compress(); DataSet dsc = bllC.GetNotOverlapList(" testDate = #" + dtp.Date + "#"); int count = dsc.Tables[0].Rows.Count; List <TreeNode> ltn = new List <TreeNode>(); for (int j = 0; j < count; j++) { DataSet _dsc = bllC.GetList(" testNo='" + dsc.Tables[0].Rows[j]["testNo"].ToString() + "' and testDate=#" + dtp.Date + "#"); TreeNode tn = new TreeNode(); tn.Text = dsc.Tables[0].Rows[j]["testNo"].ToString(); tn.Name = "GBT7314-2005"; tn.ImageIndex = 0; foreach (DataRow dr in _dsc.Tables[0].Rows) { if (Convert.ToBoolean(dr["isFinish"].ToString()) == true) { //左侧node完成试验的图标 TreeNode ftn = new TreeNode(); ftn.ImageIndex = 1; ftn.Text = dr["testSampleNo"].ToString(); ftn.Name = "GBT7314-2005_c"; ftn.Tag = dr; tn.Nodes.Add(ftn); } else { //左侧node未完成试验的图标 TreeNode ftn = new TreeNode(); ftn.ImageIndex = 2; ftn.Text = dr["testSampleNo"].ToString(); ftn.Name = "GBT7314-2005_c"; ftn.Tag = dr; tn.Nodes.Add(ftn); } } _dsc.Dispose(); ltn.Add(tn); } dsc.Dispose(); return(ltn); }
public static void readFinishSample(DataGridView dg, DataGridView dgSum, string testNo, DateTimePicker dtp, ZedGraph.ZedGraphControl zed) { //try //{ //dg.MultiSelect = true; if (dg != null) { dg.DataSource = null; dg.Columns.Clear(); dg.RowHeadersVisible = false; } BLL.Compress bllTs = new HR_Test.BLL.Compress(); if (!string.IsNullOrEmpty(testNo)) { //if (testNo.Contains('-')) // testNo = testNo.Substring(0, testNo.LastIndexOf("-")); //获取不重复的试验编号列表 DataSet ds = bllTs.GetNotOverlapList(" testNo='" + testNo + "' and testDate =#" + dtp.Value.Date + "#"); DataSet dsMax = bllTs.GetMaxFmc(" testNo='" + testNo + "' and isEffective=false and testDate =#" + dtp.Value.Date + "#"); double maxValue = 0; if (dsMax != null) { if (!string.IsNullOrEmpty(dsMax.Tables[0].Rows[0]["Fmc"].ToString())) { maxValue = Convert.ToDouble(dsMax.Tables[0].Rows[0]["Fmc"].ToString()); } } DataTable dt = ds.Tables[0]; int ab = 0; if (dt != null) { //矩形 if (dt.Rows[0]["a"].ToString() != "0") { ab = 1; } //圆柱形 if (dt.Rows[0]["d"].ToString() != "0") { ab = 2; } } DataSet ds1 = bllTs.GetNotOverlapList1(" testNo='" + testNo + "' and testDate =#" + dtp.Value.Date + "#"); DataTable dt1 = ds1.Tables[0]; string methodName = dt1.Rows[0]["testMethodName"].ToString(); if (dt1 != null) { StringBuilder[] tst = strSql_T(methodName, maxValue); if (!string.IsNullOrEmpty(tst[0].ToString()) && dg != null) { dg.DataSource = CreateView(tst[0].ToString(), dt1.Rows[0]["testNo"].ToString(), ab); } if (!string.IsNullOrEmpty(tst[1].ToString())) { dgSum.DataSource = CreateAverageView(tst[0], tst[1], dt1.Rows[0]["testNo"].ToString(), ab); } } } else { DataSet ds = bllTs.GetFinishList(" testNo='" + testNo + "' and testDate=#" + dtp.Value.Date + "#", 0); DataTable dt = ds.Tables[0]; DataRow dr = dt.NewRow(); dt.Rows.Add(dr); if (dg != null) { dg.DataSource = dt; } ds.Dispose(); } //DataGridViewDisableCheckBoxColumn chkcol = new DataGridViewDisableCheckBoxColumn(); DataGridViewCheckBoxColumn chkcol = new DataGridViewCheckBoxColumn(); chkcol.Name = "选择"; chkcol.MinimumWidth = 50; chkcol.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; DataGridViewTextBoxColumn c = new DataGridViewTextBoxColumn(); c.Name = ""; if (dg != null) { dg.Columns.Insert(0, chkcol); dg.Columns.Insert(1, c); dg.Name = "tensile"; //dg.Rows[0].Cells[0].Value = false; //dg.Rows[0].Cells[0].Selected = false; int rCount = dg.Rows.Count; for (int i = 0; i < rCount; i++) { if (!string.IsNullOrEmpty(dg.Rows[i].Cells[2].Value.ToString())) { if (Convert.ToBoolean(dg.Rows[i].Cells[2].Value.ToString()) == true) { dg.Rows[i].DefaultCellStyle.BackColor = Color.IndianRed; } } if (i > 19) { dg.Rows[i].Cells[1].Style.BackColor = Color.FromName(_Color_Array[i % 20]); dg.Rows[i].Cells[1].Style.ForeColor = Color.FromName(_Color_Array[i % 20]); dg.Rows[i].Cells[1].Style.SelectionForeColor = Color.FromName(_Color_Array[i % 20]); dg.Rows[i].Cells[1].Style.SelectionBackColor = Color.FromName(_Color_Array[i % 20]); dg.Rows[i].Cells[1].Value = _Color_Array[i % 20].ToString(); } else { dg.Rows[i].Cells[1].Style.BackColor = Color.FromName(_Color_Array[i]); dg.Rows[i].Cells[1].Style.ForeColor = Color.FromName(_Color_Array[i]); dg.Rows[i].Cells[1].Style.SelectionBackColor = Color.FromName(_Color_Array[i]); dg.Rows[i].Cells[1].Style.SelectionForeColor = Color.FromName(_Color_Array[i]); dg.Rows[i].Cells[1].Value = _Color_Array[i].ToString(); } } foreach (DataGridViewColumn dgvc in dg.Columns) { dgvc.SortMode = DataGridViewColumnSortMode.NotSortable; dgvc.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; } if (dg.Columns.Count > 1) { dg.Columns[0].Frozen = true; dg.Columns[1].Frozen = true; dg.Columns[1].Width = 10; } if (dg.Columns.Count > 2) { dg.Columns[2].Frozen = true; } dg.Refresh(); } //clear all curves if (zed != null) { foreach (CurveItem ci in zed.GraphPane.CurveList) { ci.Clear(); ci.Label.Text = ""; } zed.AxisChange(); zed.Refresh(); } //} //catch (Exception ee) { throw ee; } }