Beispiel #1
0
        private void buttonUpdate_Click(object sender, EventArgs e)
        {
            List <String> listAssetsProperties;
            String        strEquation = textBoxEquation.Text;

            if (!CheckEquation())
            {
                return;
            }
            calculate.m_bCalculate = true;
            ParseAsset(strEquation, out listAssetsProperties);
            object[] values = new object[listAssetsProperties.Count];
            int      i      = 0;

            if (listAssetsProperties.Count > 0)
            {
                foreach (DataGridViewRow row in dgvDefault.Rows)
                {
                    if (row.Cells[0].Value != null && row.Cells[1].Value != null)
                    {
                        String asset    = row.Cells[0].Value.ToString();
                        String strValue = row.Cells[1].Value.ToString();
                        String strType  = m_hashColumnType[asset].ToString();
                        if (strType != "varchar")
                        {
                            values[i] = double.Parse(strValue);
                        }
                        else
                        {
                            values[i] = strValue;
                        }
                        i++;
                    }
                }
            }
            try
            {
                object result = calculate.RunMethod(values);
                textBoxReturn.Text = result.ToString();
            }
            catch (Exception exc)
            {
                Global.WriteOutput("Error in asset equation. " + exc.Message);
            }
        }