public override bool Insert(HtmlDesgin htmlDesgin) { try { this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); var htmlDesginBO = new HtmlDesginBO(); if (!htmlDesginBO.Insert(this.ConnectionHandler, htmlDesgin)) { throw new Exception("خطایی در ذخیره HTML وجود دارد"); } 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); } }
public override bool Delete(params object[] keys) { try { this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); var htmlDesginBo = new HtmlDesginBO(); var obj = htmlDesginBo.Get(this.ConnectionHandler, keys); var contents = new PartialLoadBO().Any(ConnectionHandler, container => container.HtmlDesginId == obj.Id); if (contents) { throw new Exception("این HTML در محتوا استفاده شده است و قابل حذف نیست"); } if (!htmlDesginBo.Delete(this.ConnectionHandler, keys)) { throw new Exception("خطایی در حذف HTML وجود دارد"); } 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); } }