示例#1
0
        private void btnImportObs_Click(object sender, EventArgs e)
        {
            VBTools.ImportExport import = new ImportExport();
            DataTable dt = import.Input;
            if (dt == null)
                return;

            string[] headerCaptions = { "Obs IDs", "Obs" };
            //Dictionary<string, string> obsColumns = new Dictionary<string, string>();
               // obsColumns.Add("ID", "ID");
            //obsColumns.Add("Observation", "Observation");

            string[] obsColumns = { "ID", "Observation" };

            frmColumnMapper colMapper = new frmColumnMapper(obsColumns, dt, headerCaptions, true);
            DialogResult dr = colMapper.ShowDialog();

            if (dr == DialogResult.OK)
            {
                dt = colMapper.MappedTable;
                dgvObs.DataSource = dt;
            }
            else
                return;

            foreach (DataGridViewColumn dvgCol in dgvObs.Columns)
                dvgCol.SortMode = DataGridViewColumnSortMode.NotSortable;

            setViewOnGrid(dgvObs);
        }
示例#2
0
        private void btnImportObs_Click(object sender, EventArgs e)
        {
            VBTools.ImportExport import = new ImportExport();
            DataTable dt = import.Input;
            if (dt == null)
                return;

            string[] headerCaptions = { "Obs IDs", "Obs" };
            Dictionary<string, string> obsColumns = new Dictionary<string, string>();
            //obsColumns.Add("id", "id");
            obsColumns.Add(pls_model.target, pls_model.target);

            frmColumnMapper colMapper = new frmColumnMapper(obsColumns, dt, headerCaptions, false);
            DialogResult dr = colMapper.ShowDialog();

            if (dr == DialogResult.OK)
            {
                dt = colMapper.MappedTable;
                dgvObs.DataSource = dt;
            }

            string target = pls_model.target;
            for(int indx=0; indx<dgvObs.RowCount; indx++)
                if (Convert.ToDouble(dgvObs.Rows[indx].Cells[target].Value) > pls_model.regulatory_threshold )
                    dgvObs.Rows[indx].Cells[target].Style.ForeColor = Color.Red;

            foreach (DataGridViewColumn dvgCol in dgvObs.Columns)
                dvgCol.SortMode = DataGridViewColumnSortMode.NotSortable;
        }
示例#3
0
        //private void btnChange_Click(object sender, EventArgs e)
        //{
        //    if (btnChange.Text == "Change")
        //    {
        //        txtDecCrit.ReadOnly = false;
        //        txtRegStd.ReadOnly = false;
        //        btnChange.Text = "Save";
        //    }
        //    else if (btnChange.Text == "Save")
        //    {
        //        txtDecCrit.ReadOnly = true;
        //        txtRegStd.ReadOnly = true;
        //        btnChange.Text = "Change";
        //    }
        //}
        private void btnImportIVs_Click(object sender, EventArgs e)
        {
            VBTools.ImportExport import = new ImportExport();
            DataTable dt = import.Input;
            if (dt == null)
                return;

            string[] headerCaptions = { "Model Variables", "Imported Variables" };

            Dictionary<string, string> fields = new Dictionary<string, string>(_mainEffects);
            //if (_mainEffects.ContainsKey("ID") == false)
            //    fields.Add("ID", "ID");

            //frmColumnMapper colMapper =  new frmColumnMapper(_mainEffects, dt, headerCaptions, true);
            frmColumnMapper colMapper = new frmColumnMapper(_referencedVariables, dt, headerCaptions, true);

            DialogResult dr = colMapper.ShowDialog();

            if (dr == DialogResult.OK)
            {
                dt = colMapper.MappedTable;

                int errndx = 0;
                if (!recordIndexUnique(dt, out errndx))
                {
                    MessageBox.Show("Unable to import datasets with non-unique record identifiers.\n" +
                                    "Fix your datatable by assuring unique record identifier values\n" +
                                    "in the ID column and try importing again.\n\n" +
                                    "Record Identifier values cannot be blank or duplicated;\nencountered " +
                                    "error near row " + errndx.ToString(), "Import Data Error - Cannot Import This Dataset", MessageBoxButtons.OK);
                    return;
                }

                dgvVariables.DataSource = dt;
            }
            else
                return;

            //DataColumn dc = new DataColumn("IVRowIdx", typeof(int));
            //dt.Columns.Add(dc);
            //dc.SetOrdinal(0);
            foreach (DataGridViewColumn dvgCol in dgvVariables.Columns)
            {
                dvgCol.SortMode = DataGridViewColumnSortMode.NotSortable;
            }

            //for (int i = 0; i < dt.Rows.Count; i++)
            //{
            //    dt.Rows[i]["IVRowIdx"] = i;
            //}
            //dgvVariables.Columns[0].Visible = false;

            setViewOnGrid(dgvVariables);
            btnMakePredictions.Enabled = false;
        }
示例#4
0
        private void btnImportIVs_Click(object sender, EventArgs e)
        {
            VBTools.ImportExport import = new ImportExport();
            DataTable dt = import.Input;
            if (dt == null)
                return;

            string[] headerCaptions = { "Model Variables", "Imported Variables" };
            frmColumnMapper colMapper = new frmColumnMapper(_mainEffects, dt, headerCaptions, false);
            DialogResult dr = colMapper.ShowDialog();

            if (dr == DialogResult.OK)
            {
                dt = colMapper.MappedTable;
                dgvVariables.DataSource = dt;
            }

            foreach (DataGridViewColumn dvgCol in dgvVariables.Columns)
                dvgCol.SortMode = DataGridViewColumnSortMode.NotSortable;
        }