Example #1
0
 protected virtual bool DeleteObject(VideoRentBaseObject objectToDelete, string message, Action <object> action)
 {
     if (objectToDelete == null)
     {
         return(false);
     }
     return(ObjectHelper.SafeDelete(objectToDelete, message, ExceptionProcesser.Current, action));
 }
Example #2
0
 protected virtual bool DeleteObject(VideoRentBaseObject objectToDelete, string message)
 {
     if (objectToDelete == null)
     {
         return(false);
     }
     return(ObjectHelper.SafeDeleteNoCommit(objectToDelete, message) != null);
 }
Example #3
0
        public static bool SafeDelete(VideoRentBaseObject obj, string shureToDeleteMessage, IExceptionProcesser exceptionProcesser, Action <object> action)
        {
            UnitOfWork uow = SafeDeleteNoCommit(obj, shureToDeleteMessage, action);

            if (uow == null)
            {
                return(false);
            }
            SessionHelper.CommitSession(uow, exceptionProcesser);
            return(true);
        }
Example #4
0
        public static UnitOfWork SafeDeleteNoCommit(VideoRentBaseObject obj, string shureToDeleteMessage, Action <object> action)
        {
            if (!obj.AllowDelete)
            {
                MessageBox.Show(ConstStrings.Get("ObjectCanNotBeDeleted"), ConstStrings.Get("Warning"), MessageBoxButton.OK, MessageBoxImage.Warning);
                return(null);
            }
            if (!IsSureToDelete(shureToDeleteMessage))
            {
                return(null);
            }
            if (action != null)
            {
                action(null);
            }
            UnitOfWork uow = (UnitOfWork)obj.Session;

            obj.Delete();
            return(uow);
        }
Example #5
0
 public static UnitOfWork SafeDeleteNoCommit(VideoRentBaseObject obj, string shureToDeleteMessage)
 {
     return(SafeDeleteNoCommit(obj, shureToDeleteMessage, null));
 }
Example #6
0
 public static bool SafeDelete(VideoRentBaseObject obj, string shureToDeleteMessage, IExceptionProcesser exceptionProcesser)
 {
     return(SafeDelete(obj, shureToDeleteMessage, exceptionProcesser, null));
 }