private void editPropButton_Click(object sender, EventArgs e) { if (propertiesGridView.SelectedRows.Count != 1) { MessageBox.Show("нечего редактировать", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } IList<Database.PropertyInfo> propList = getUnusedProperties(true); PersonPropEdit edit = new PersonPropEdit(getDatabase()); edit.list = propList; edit.personProperty = selectedPersonProperty(); DialogResult result = edit.ShowDialog(); if (result == DialogResult.OK) { Database.PersonProperty prop = edit.personProperty; fullPersonInfo.properties.Rows[selectedIndex()][0] = prop.propertyId; fullPersonInfo.properties.Rows[selectedIndex()][1] = prop.propName; fullPersonInfo.properties.Rows[selectedIndex()][2] = prop.value; propertiesGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader); } }
private void addPropButton_Click(object sender, EventArgs e) { IList<Database.PropertyInfo> propList = getUnusedProperties(false); if (propList.Count == 0) { MessageBox.Show("Все свойства заполнены, больше добавлять нечего", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } PersonPropEdit edit = new PersonPropEdit(getDatabase()); edit.list = propList; DialogResult result = edit.ShowDialog(); if (result == DialogResult.OK) { Database.PersonProperty prop = edit.personProperty; fullPersonInfo.properties.Rows.Add(prop.propertyId, prop.propName, prop.value); propertiesGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader); } }