public static void DeleteDependencies(long id) { var ctx = new DataClassesDataContext(); // LabOrder's dependency is LabOrderDetail var labOrderDetails = from l in ctx.LabOrderDetails where l.LabOrderID == id select l; foreach (var labOrderDetail in labOrderDetails) { LabOrderDetailOperations.DeleteDependencies(labOrderDetail.ID); } ctx.LabOrderDetails.DeleteAllOnSubmit(labOrderDetails); // submit changes ctx.SubmitChanges(); }
public static void DeleteDependencies(long id) { // medical service has dependency lab order detail var ctx = new DataClassesDataContext(); var labOrderDetails = from l in ctx.LabOrderDetails where l.MedicalServiceID == id select l; foreach (var labOrderDetail in labOrderDetails) { LabOrderDetailOperations.DeleteDependencies(labOrderDetail.ID); } ctx.LabOrderDetails.DeleteAllOnSubmit(labOrderDetails); //submit changes ctx.SubmitChanges(); }