Exemple #1
0
        public bool DeleteHelpRealtion(Guid sourceId, Guid relationid)
        {
            try
            {
                this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                var byFilter = new HelpRelationBO().Get(this.ConnectionHandler, sourceId, relationid);
                if (byFilter != null)
                {
                    if (!new HelpRelationBO().Delete(this.ConnectionHandler, sourceId, relationid))
                    {
                        throw new Exception("خطایی در حذف ارتباط وجود دارد");
                    }
                }
                if (!new HelpReationCollectionBO().Delete(this.ConnectionHandler, relationid))
                {
                    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);
            }
        }
Exemple #2
0
 public IEnumerable <DataStructure.Help> GetHelpRelation(Guid sourceId)
 {
     try
     {
         var helplist = new List <Help.DataStructure.Help>();
         var list     = new HelpRelationBO().Select(ConnectionHandler, x => x.HelpRelationCollectionId, relation => relation.HelpId == sourceId);
         if (list.Any())
         {
             return(new HelpBO().Where(ConnectionHandler, x => x.Id.In(list)));
         }
         return(helplist);
     }
     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);
     }
 }