コード例 #1
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow r in dgView.Rows)
            {
                if (r.Cells["Klasse"].Value == null)
                {
                    continue;
                }
                string k = r.Cells["Klasse"].Value.ToString().Trim();
                if (k == string.Empty)
                {
                    continue;
                }
                if (r.Cells["Percentage"].Value == null)
                {
                    continue;
                }
                string p = r.Cells["Percentage"].Value.ToString();
                if (!p.IsNumeric())
                {
                    continue;
                }

                tblCompResult cr = new tblCompResult(leden.GetLidByLidNr(int.Parse(r.Cells["LidNr"].Value.ToString())));
                cr.LidNr        = cr.Lid.LidNr;
                cr.Jaar         = int.Parse(cboJaar.Text);
                cr.SeizoenCombo = cboSeizoen.Text;
                cr.KlasseCombo  = r.Cells["Klasse"].Value.ToString();
                cr.Percentage   = int.Parse(r.Cells["Percentage"].Value.ToString());

                resultaten.InsertOrUpdate(cr);
            }
            dataAdaptor.UpdateCompResulten(resultaten);
            dataAdaptor.CommitTransaction(true);
            toolStripStatusLabel1.Text = "Bewaard";
        }