public bool AdsAddClickCount(Guid AdsId) { try { var advertisement = new AdvertisementBO().Get(this.ConnectionHandler, AdsId); advertisement.ClickCount++; return(new AdvertisementBO().Update(this.ConnectionHandler, advertisement)); } catch (KnownException ex) { Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { 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); this.FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted); var obj = new AdvertisementBO().Get(this.ConnectionHandler, keys); if (!new AdvertisementBO().Delete(this.ConnectionHandler, keys)) { throw new Exception("خطایی در حذف آگهی وجود دارد"); } if (obj.FileId.HasValue) { if ( !FileManagerComponent.Instance.FileTransactionalFacade(this.FileManagerConnection) .Delete(obj.FileId)) { throw new Exception("خطایی در حذف عکس آگهی وجود دارد"); } } this.ConnectionHandler.CommitTransaction(); this.FileManagerConnection.CommitTransaction(); return(true); } catch (KnownException ex) { this.ConnectionHandler.RollBack(); this.FileManagerConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { this.ConnectionHandler.RollBack(); this.FileManagerConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } }
public IEnumerable <Advertisement> GetAllByDate(int sectionPosition, string date) { try { var allByDate = new AdvertisementBO().GetAllByDate(this.ConnectionHandler, sectionPosition, date); foreach (var advertisement in allByDate) { FillComplex(advertisement); } return(allByDate); } catch (KnownException ex) { Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } }