private bool DeleteRowManual(PContactLogRow ARowToDelete, ref String ACompletionMessage) { foreach (DataRowView ContactLogRow in grdDetails.SelectedDataRows) { DataView PartnerContactLogs = new DataView(FMainDS.PPartnerContact); PartnerContactLogs.RowFilter = String.Format("{0} = {1} AND {2} = {3}", PPartnerContactTable.GetPartnerKeyDBName(), FMainDS.PPartner[0].PartnerKey, PPartnerContactTable.GetContactLogIdDBName(), ContactLogRow.Row[PContactLogTable.ColumnContactLogIdId]); // Delete the PartnerContact records foreach (DataRowView row in PartnerContactLogs) { row.Delete(); } // Actually delete the ContactLog if it's the last if (!TRemote.MPartner.Partner.WebConnectors.IsContactLogAssociatedWithMoreThanOnePartner((long)ContactLogRow.Row[PContactLogTable. ColumnContactLogIdId ])) { ContactLogRow.Row.Delete(); } } grdDetails.Refresh(); return(true); }