示例#1
0
 public JobIndexCategory AddJobIndexCategory(AbstractJobIndexId parentId, string name, string dictionaryName)
 {
     try
     {
         using (var scope = new TransactionScope())
         {
             var id = jobIndexRep.GetNextId();
             JobIndexCategory parent = null;
             if (parentId != null)
             {
                 parent = jobIndexRep.GetJobIndexCategory(new AbstractJobIndexId(parentId.Id));
             }
             var jobIndexCategory = new JobIndexCategory(id, parent, name, dictionaryName);
             jobIndexRep.Add(jobIndexCategory);
             scope.Complete();
             return(jobIndexCategory);
         }
     }
     catch (Exception exp)
     {
         var res = jobIndexRep.TryConvertException(exp);
         if (res == null)
         {
             throw;
         }
         throw res;
     }
 }
示例#2
0
 public JobIndexGroup AddJobIndexGroup(PeriodId periodId, AbstractJobIndexId parentId, string name,
                                       string dictionaryName)
 {
     try
     {
         using (var tr = new TransactionScope())
         {
             var           id     = jobIndexRep.GetNextId();
             var           period = periodRep.GetById(periodId);
             JobIndexGroup parent = null;
             if (parentId != null)
             {
                 parent = jobIndexRep.GetJobIndexGroupById(new AbstractJobIndexId(parentId.Id));
             }
             var jobIndexGroup = new JobIndexGroup(id, period, parent, name, dictionaryName);
             jobIndexRep.Add(jobIndexGroup);
             tr.Complete();
             return(jobIndexGroup);
         }
     }
     catch (Exception exp)
     {
         var res = jobIndexRep.TryConvertException(exp);
         if (res == null)
         {
             throw;
         }
         throw res;
     }
 }