private void btnAtualizarSoftHouse_Click(object sender, EventArgs e) { int index = -1; if (SoftHouseGridView.CurrentCell != null) { index = SoftHouseGridView.CurrentCell.RowIndex; } if (index != -1) { SoftHouseModel model = new SoftHouseModel(); model.cnpjSoftHouse = SoftHouseGridView.Rows[index].Cells[0].Value.ToString(); model.nmRazao = SoftHouseGridView.Rows[index].Cells[1].Value.ToString(); model.nmCont = SoftHouseGridView.Rows[index].Cells[2].Value.ToString(); model.telefone = SoftHouseGridView.Rows[index].Cells[3].Value.ToString(); model.email = SoftHouseGridView.Rows[index].Cells[4].Value.ToString(); SoftHouseForm form = new SoftHouseForm(model); form.ShowDialog(this); if (form.model != null) { model = form.model; SoftHouseGridView.Rows[index].Cells[0].Value = model.cnpjSoftHouse; SoftHouseGridView.Rows[index].Cells[1].Value = model.nmRazao; SoftHouseGridView.Rows[index].Cells[2].Value = model.nmCont; SoftHouseGridView.Rows[index].Cells[3].Value = model.telefone; SoftHouseGridView.Rows[index].Cells[4].Value = model.email; } } }
private void btnAdicionarSoftHouse_Click(object sender, EventArgs e) { SoftHouseForm softHouseForm = new SoftHouseForm(); softHouseForm.ShowDialog(this); SoftHouseModel softHouseModel = softHouseForm.model; if (softHouseModel != null) { SoftHouseGridView_add(softHouseModel); } }