Пример #1
0
        private static List <TreeNode> ReadYBT5349Samples(DateTime dtp)
        {
            BLL.Bend        bllb  = new HR_Test.BLL.Bend();
            DataSet         dsb   = bllb.GetNotOverlapList("testDate=#" + dtp.Date + "#");
            int             count = dsb.Tables[0].Rows.Count;
            List <TreeNode> ltn   = new List <TreeNode>();

            for (int j = 0; j < count; j++)
            {
                DataSet  _dsb = bllb.GetList(" testNo='" + dsb.Tables[0].Rows[j]["testNo"].ToString() + "' and testDate=#" + dtp.Date + "#");
                TreeNode tn   = new TreeNode();
                tn.Text       = dsb.Tables[0].Rows[j]["testNo"].ToString();
                tn.Name       = "YBT5349-2006";
                tn.ImageIndex = 0;
                foreach (DataRow dr in _dsb.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       = "YBT5349-2006_c";
                        ftn.Tag        = dr;
                        tn.Nodes.Add(ftn);
                    }
                    else
                    {
                        //左侧node未完成试验的图标
                        TreeNode ftn = new TreeNode();
                        ftn.ImageIndex = 2;
                        ftn.Text       = dr["testSampleNo"].ToString();
                        ftn.Name       = "YBT5349-2006_c";
                        ftn.Tag        = dr;
                        tn.Nodes.Add(ftn);
                    }
                }
                _dsb.Dispose();
                ltn.Add(tn);
            }
            dsb.Dispose();
            return(ltn);
        }
Пример #2
0
        //获取 弯曲试验 结果的 DataSource
        public static void readFinishSample(DataGridView dg, DataGridView dataGridViewSum, string testNo, DateTimePicker dtime, ZedGraph.ZedGraphControl zed)
        {
            //try
            //{
            //dg.MultiSelect = true;
            if (dg != null)
            {
                dg.DataSource = null;
                dg.Columns.Clear();
                dg.RowHeadersVisible = false;
            }
            BLL.Bend bllTs    = new HR_Test.BLL.Bend();
            double   maxvalue = 0;
            DataSet  dsmax    = bllTs.GetFbbMax(" testNo='" + testNo + "' and testDate =#" + dtime.Value.Date + "#");

            if (!string.IsNullOrEmpty(dsmax.Tables[0].Rows[0]["Fbb"].ToString()))
            {
                maxvalue = Convert.ToDouble(dsmax.Tables[0].Rows[0]["Fbb"].ToString());
            }
            if (!string.IsNullOrEmpty(testNo))
            {
                //if (testNo.Contains('-'))
                //    testNo = testNo.Substring(0, testNo.LastIndexOf("-"));
                //获取不重复的试验编号列表
                DataSet ds = bllTs.GetNotOverlapList(" testNo='" + testNo + "' and testDate =#" + dtime.Value.Date + "#");

                DataSet   ds1        = bllTs.GetNotOverlapList(" testNo='" + testNo + "' and testDate =#" + dtime.Value.Date + "#");
                DataTable dt1        = ds1.Tables[0];
                string    methodName = dt1.Rows[0]["testMethod"].ToString();
                if (dt1 != null)
                {
                    StringBuilder[] tst = strSql_B(methodName, maxvalue);
                    if (!string.IsNullOrEmpty(tst[0].ToString()) && dg != null)
                    {
                        dg.DataSource = CreateView_B(tst[0].ToString(), dt1.Rows[0]["testNo"].ToString());
                    }

                    if (!string.IsNullOrEmpty(tst[1].ToString()))
                    {
                        dataGridViewSum.DataSource = CreateAverageView_B(tst[0], tst[1], dt1.Rows[0]["testNo"].ToString());
                    }
                }
            }
            else
            {
                DataSet   ds  = bllTs.GetFinishListDefault(" testNo='" + testNo + "' and testDate=#" + dtime.Value.Date + "#", maxvalue);
                DataTable _dt = ds.Tables[0];
                DataRow   dr  = _dt.NewRow();
                _dt.Rows.Add(dr);
                if (dg != null)
                {
                    dg.DataSource = _dt;
                }
                ds.Dispose();
            }

            if (dg != null)
            {
                DataGridViewCheckBoxColumn chkcol = new DataGridViewCheckBoxColumn();
                chkcol.Name         = "选择";
                chkcol.MinimumWidth = 50;
                chkcol.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;

                DataGridViewTextBoxColumn c = new DataGridViewTextBoxColumn();
                c.Name = "";
                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();
            }

            if (zed != null)
            {
                //clear all curves
                foreach (CurveItem ci in zed.GraphPane.CurveList)
                {
                    ci.Clear();
                    ci.Label.Text = "";
                }

                zed.AxisChange();
                zed.Refresh();
            }
            dsmax.Dispose();
            //}
            //catch (Exception ee) { MessageBox.Show(this, ee.ToString(), "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); }
        }