public static void OnDeleting(ITermsOfPayment payment, IObjectSpace objectSpace)
        {
            var oid = (payment as DevExpress.ExpressApp.DC.DCBaseObject).Oid;

            CriteriaOperator criteria = new BinaryOperator("TermsOfPayment.Oid", oid, BinaryOperatorType.Equal);
            if (ReferenceEquals(criteria, null)==false)
            {
                var patient = objectSpace.GetObjects<IPatient>(criteria);

                if (patient != null)
                {
                    if (patient.Any() ==true)
                    {
                        throw new UserFriendlyException(DevExpress.ExpressApp.Utils.CaptionHelper.GetLocalizedText("Messages", "RelatedObjectsDelWarning"));
                    }
                }
            }
        }
 public static void AfterConstruction(ITermsOfPayment payment)
 {
     payment.Name = String.Empty;
     payment.Desctiption = String.Empty;
 }