Exemple #1
0
 public JobIndex UpdateJobIndex(AbstractJobIndexId jobIndexId, AbstractJobIndexId groupId, IDictionary <SharedJobIndexCustomFieldId, string> customFieldValues, bool isInquireable, int calculationOrder, long calculationLevel)
 {
     try
     {
         using (var tr = new TransactionScope())
         {
             if (groupId == null)
             {
                 throw new ArgumentException("groupId is null");
             }
             var group = jobIndexRep.GetJobIndexGroupById(groupId);
             if (group == null)
             {
                 throw new ArgumentException("group is null");
             }
             var jobIndex = jobIndexRep.GetJobIndexById(jobIndexId);
             if (group.PeriodId != jobIndex.PeriodId)
             {
                 throw new ArgumentException("groupId is not valid");
             }
             var customFldValues = getSharedJobIndexCustomFields(jobIndex.SharedJobIndexId, customFieldValues);
             jobIndex.Update(group, isInquireable, customFldValues, periodChecker, calculationOrder,
                             calculationLevel);
             jobIndexRep.Update(jobIndex);
             tr.Complete();
             return(jobIndex);
         }
     }
     catch (Exception exp)
     {
         var res = jobIndexRep.TryConvertException(exp);
         if (res == null)
         {
             throw;
         }
         throw res;
     }
 }