protected override OpResult _Delete(Card _obj) { if (_obj == null) { return(OpResult.NotifyDeleteAction(OpResult.ResultStatus.ObjectIsNull, _obj, "Card object cannot be deleted as it is null")); } if (Exists(_obj)) { ExecuteNonQuery(GetQuery_DeleteQuery(_obj)); RepositoryMgr.AddressMgr.Delete(_obj.Address1); RepositoryMgr.AddressMgr.Delete(_obj.Address2); RepositoryMgr.AddressMgr.Delete(_obj.Address3); RepositoryMgr.AddressMgr.Delete(_obj.Address4); RepositoryMgr.AddressMgr.Delete(_obj.Address5); CardType.TypeID type = CardType.GetTypeID(_obj.CardTypeID); if (type == CardType.TypeID.Customer) { RepositoryMgr.CustomerMgr.Delete((Customer)_obj); } else if (type == CardType.TypeID.Employee) { RepositoryMgr.EmployeeMgr.Delete((Employee)_obj); } else if (type == CardType.TypeID.Supplier) { RepositoryMgr.SupplierMgr.Delete((Supplier)_obj); } return(OpResult.NotifyDeleteAction(OpResult.ResultStatus.ExistsAndDeleted, _obj)); } else { return(OpResult.NotifyDeleteAction(OpResult.ResultStatus.NotExists, _obj, "Card object cannot be deleted as it does not exist")); } }