public static void OnDeleting(IIdentifyCardType cardType, IObjectSpace objectSpace) { if (cardType.allowTodel == false) { throw new UserFriendlyException(DevExpress.ExpressApp.Utils.CaptionHelper.GetLocalizedText("Exceptions", "SecuredObjectDelAttempt")); } var identityCards = Get_PersonIdentityCards(cardType, objectSpace); if (identityCards != null) { if (identityCards.Count > 0) { throw new UserFriendlyException(DevExpress.ExpressApp.Utils.CaptionHelper.GetLocalizedText("Messages", "RelatedObjectsDelWarning")); } } }
public static IList<IPersonIdentityCard> Get_PersonIdentityCards(IIdentifyCardType cardType, IObjectSpace objectSpace) { var criteria = CriteriaOperator.Parse("[IdentityCardType] = ?", cardType); return objectSpace.GetObjects<IPersonIdentityCard>(criteria); }
public static void AfterConstruction(IIdentifyCardType cardType) { cardType.allowTodel = true; }