private void delEquipmentButton_Click(object sender, EventArgs e) { if (equipmentDGV.SelectedCells.Count > 0) { currentEquip = equipmentDGV.Rows[equipmentDGV.SelectedCells[0].RowIndex].DataBoundItem as cEquipment; currentEquip.delInContract(currentHire.equipment_in_contract); currentEquip.addStock(); IsSaved = false; viewEquipmentContract(currentClient.id_client); } }
private void winterRental_FormClosing(object sender, FormClosingEventArgs e) { //При закрыт формы if (!IsSaved && equipmentDGV.Rows.Count > 0) { foreach (DataGridViewRow i in equipmentDGV.Rows) { currentEquip = i.DataBoundItem as cEquipment; currentEquip.addStock(); } currentHire.delete(); } if (equipmentDGV.Rows.Count == 0) { currentHire.delete(); } }