Esempio n. 1
0
 public bool DeletePartialWithUrl(string url)
 {
     try
     {
         this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
         var partialsBO = new PartialsBO();
         var @where     = partialsBO.Where(ConnectionHandler, partials => partials.Url == url.ToLower());
         if ([email protected]())
         {
             return(true);
         }
         foreach (var partialse in where)
         {
             if (!partialsBO.Delete(this.ConnectionHandler, partialse.Id))
             {
                 throw new Exception("خطایی در حذف صفحه وجود دارد");
             }
         }
         this.ConnectionHandler.CommitTransaction();
         return(true);
     }
     catch (KnownException ex)
     {
         this.ConnectionHandler.RollBack();
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
     catch (Exception ex)
     {
         this.ConnectionHandler.RollBack();
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
 }
Esempio n. 2
0
        public override bool Delete(params object[] keys)
        {
            try
            {
                this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                var partialsBO = new PartialsBO();
                if (!partialsBO.Delete(this.ConnectionHandler, keys))
                {
                    throw new Exception("خطایی در حذف صفحه وجود دارد");
                }
                this.ConnectionHandler.CommitTransaction();
                return(true);
            }
            catch (KnownException ex)
            {
                this.ConnectionHandler.RollBack();

                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                this.ConnectionHandler.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
        }