Exemple #1
0
        private void bcmv_Click(object sender, EventArgs e)
        {
            s.getMVtable123(tbDeviceID.Text);
            s.getCenter123(tbDeviceID.Text);

            int i1 = s.ds.Tables["MVL"].Rows.Count;
            int i2 = s.ds.Tables["MVL"].Columns.Count - 1;

            double[,] m1 = new double[i1, i2];

            for (int i = 0; i < i1; i++)
            {
                for (int j = 0; j < i2; j++)
                {
                    m1[i, j] = Convert.ToDouble(s.ds.Tables["MVL"].Rows[i][j + 1]);
                }
            }

            foreach (DataGridViewRow dr in Data.Rows)
            {
                if (dr.Cells[0].Value != null)
                {
                    double[,] m2 = new double[1, 2];
                    m2[0, 0]     = (Convert.ToDouble(dr.Cells[1].Value) - Convert.ToDouble(s.ds.Tables["Center"].Rows[0][1])) / Convert.ToDouble(s.ds.Tables["Center"].Rows[0][3]);
                    m2[0, 1]     = (Convert.ToDouble(dr.Cells[2].Value) - Convert.ToDouble(s.ds.Tables["Center"].Rows[0][2])) / Convert.ToDouble(s.ds.Tables["Center"].Rows[0][4]);

                    dr.Cells[3].Value = MatrixCal.MatrixSumTimes(MatrixCal.MatrixTimes(m1, m2), m2);
                }
            }

            Data.AllowUserToAddRows = false;
            Data.Update();
        }
        private void bGetLimts_Click(object sender, EventArgs e)
        {
            SQLComm s = new SQLComm();

            dgCenter.DataSource = s.getCenter123(commWork.deviceID);
            dgMVL.DataSource    = s.getMVtable123(commWork.deviceID);
        }