private void btnDeleteDefect_Click(object sender, System.EventArgs e) { UjfApartmentHouseDefect deleteParameters = new UjfApartmentHouseDefect(); deleteParameters = this.ujfApartmentHouseDefectView.GetDeleteParameters(); if (deleteParameters != null) { if (System.Windows.Forms.MessageBox.Show("Вы действительно хотите удалить этот дефект? Удаление дефекта также удалит все ссылки на него!", "Внимание", System.Windows.Forms.MessageBoxButtons.YesNo) != System.Windows.Forms.DialogResult.No) { new UjfApartmentHouseDefectSheduleView().DeleteByCurrentDefect(deleteParameters.Id); deleteParameters.Delete(); deleteParameters.SaveChanges(); this.ujfApartmentHouseDefectView.UpdateBindingDefect(this.m_inspectionId); } } else { System.Windows.Forms.MessageBox.Show("Не найдено дефектов для удаления"); } }
private void dgvDefects_CellEndEdit(object sender, System.Windows.Forms.DataGridViewCellEventArgs e) { UjfApartmentHouseDefect defect = new UjfApartmentHouseDefect(); defect = (UjfApartmentHouseDefect) this.bsDefects.get_Current(); defect.DefectCost = defect.DefectCount * defect.UnitCostDefect; defect.DefectCostCoordination = defect.DefectCountCoordination * defect.UnitCostDefect; defect.SaveChanges(); }