private void btnDelete_Click(object sender, EventArgs e) { if (Messages.DeleteConfirmationMessage() && iBoxId != null) { if (ORMForSDF.DeleteFromDatabase("Slot", "FK_BoxId", iBoxId.toInt32(), Properties.Settings.Default.Connection)) { if (ORMForSDF.DeleteFromDatabase("Box", "Id", iBoxId.toInt32(), Properties.Settings.Default.Connection)) { btnClear_Click(null, null); } } } }
private void btnDelete_Click(object sender, EventArgs e) { if (Messages.DeleteConfirmationMessage() && iStaffId != null) { if (db.Transactions.Where(x => x.FK_Staff == iStaffId).ToList().Count > 0) { Messages.ReferenceExistsMessage(); return; } if (ORMForSDF.DeleteFromDatabase("Staff", "Id", iStaffId.toInt32(), Properties.Settings.Default.Connection)) { btnClear_Click(null, null); } } }
private void btnDelete_Click(object sender, EventArgs e) { if (Messages.DeleteConfirmationMessage() && iCustomerId != null) { foreach (var item in db.Slots.Where(x => x.FK_CustomerId == iCustomerId)) { item.InStatus = false; item.OccupaidStatus = false; ORMForSDF.UpdateToDatabaseObj(item, "Slot", "Id", item.Id.toInt32(), Properties.Settings.Default.Connection); } ORMForSDF.DeleteFromDatabase("Transactions", "FK_Customer", iCustomerId.ToInt32(), Properties.Settings.Default.Connection); if (ORMForSDF.DeleteFromDatabase("Customer", "Id", iCustomerId.toInt32(), Properties.Settings.Default.Connection)) { btnClear_Click(null, null); } } }