public JobIndexCategory UpdateJobIndexCategory(AbstractJobIndexId jobIndexCatId, AbstractJobIndexId parentId, string name, string dictionaryName) { //todo:(medium)Update not working try { using (var scope = new TransactionScope()) { JobIndexCategory parent = null; if (parentId != null) { parent = jobIndexRep.GetJobIndexCategory(parentId); } var jobIndexCategory = new JobIndexCategory(jobIndexCatId, parent, name, dictionaryName); jobIndexRep.Update(jobIndexCategory); scope.Complete(); return(jobIndexCategory); } } catch (Exception exp) { var res = jobIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
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; } }