public WagiClass(int Id, kryteriaClass k1, kryteriaClass k2, double waga) { this.Id = Id; this.k1 = k1; this.k2 = k2; this.waga = waga; }
public void addDataColumnToGrid(kryteriaClass k) { dataGridView1.Columns.Add(k.nazwaKryterium, k.nazwaKryterium); dataGridView1.Rows.Add(); for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) { this.dataGridView1.Rows[i].HeaderCell.Value = kryteriaList[i].nazwaKryterium; } dataGridView1.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders); try { for (int i = 0; i < kryteriaList.Count; i++) { for (int j = 0; j < kryteriaList.Count; j++) { if (i == j) { dataGridView1.Rows[j].Cells[i].Value = 1; dataGridView1.Rows[j].Cells[i].ReadOnly = true; dataGridView1.Rows[j].Cells[i].Style.BackColor = Color.Black; dataGridView1.Rows[j].Cells[i].Style.ForeColor = Color.White; } } } } catch (Exception x) { MessageBox.Show(x.Message); } }
public void addKryterium(kryteriaClass k) { kryteriaList.Add(k); comboBox1.Items.Add(k.nazwaKryterium); if (kryteriaList.Count == 1) { treeView1.Nodes.Add("KryteriaMain", "Kryteria"); treeView1.Nodes["KryteriaMain"].Nodes.Add(k.nazwaKryterium); treeView1.ExpandAll(); } else { treeView1.Nodes["KryteriaMain"].Nodes.Add(k.nazwaKryterium); } if (kryteriaList.Count > 1) { button3.Enabled = true; } if (kryteriaList.Count > 1 && atrybutyList.Count > 1 && wagiCheck == true) { comboBox1.Enabled = true; } }
private void button1_Click(object sender, EventArgs e) { kryteriaClass k = new kryteriaClass(textBox1.Text); if (k.nazwaKryterium != "") { x.addKryterium(k); x.addDataColumnToGrid(k); Refresh(); x.addDataRowToGrid(); Close(); } else { MessageBox.Show("Pole musi byc uzupelnione."); } }