void SaveVendor() { if (formValid) { currentTypeOfRepair.Name = nameTextEdit.Text; if (edit) { currentTypeOfRepair.DateOfChange = DateTime.Now; currentTypeOfRepair.Save(); } } }
private void barButtonItemDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { using (UnitOfWork u = new UnitOfWork()) { device_TypeOfRepair currentTypeOfRepair = u.GetObjectByKey <device_TypeOfRepair>((Guid)typeOfRepairGridView.GetFocusedRowCellValue("GUID")); DialogResult d = XtraMessageBox.Show(string.Format("Удалить наименование ремонта {0}?", currentTypeOfRepair.Name), "Подтверждение действия", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (d == DialogResult.Yes) { currentTypeOfRepair.DeletedDate = DateTime.Now; currentTypeOfRepair.Save(); u.CommitChanges(); } } loadData(); }