public UnitIndexCategory UpdateUnitIndexCategory(AbstractUnitIndexId unitIndexCatId, AbstractUnitIndexId parentId, string name, string dictionaryName) { //todo:(medium)Update not working try { using (var scope = new TransactionScope()) { UnitIndexCategory parent = null; if (parentId != null) { parent = unitIndexRep.GetUnitIndexCategory(parentId); } var unitIndexCategory = new UnitIndexCategory(unitIndexCatId, parent, name, dictionaryName); unitIndexRep.Update(unitIndexCategory); scope.Complete(); return(unitIndexCategory); } } catch (Exception exp) { var res = unitIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
public UnitIndexCategory AddUnitIndexCategory(AbstractUnitIndexId parentId, string name, string dictionaryName) { try { using (var scope = new TransactionScope()) { var id = unitIndexRep.GetNextId(); UnitIndexCategory parent = null; if (parentId != null) { parent = unitIndexRep.GetUnitIndexCategory(new AbstractUnitIndexId(parentId.Id)); } var unitIndexCategory = new UnitIndexCategory(id, parent, name, dictionaryName); unitIndexRep.Add(unitIndexCategory); scope.Complete(); return(unitIndexCategory); } } catch (Exception exp) { var res = unitIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
public static void CreateUnitIndexCategory(IUnitIndexRepository unitIndexRepository) { if (unitIndexCategory == null) { unitIndexCategory = new UnitIndexCategory(unitIndexRepository.GetNextId(), null, "شاخص های سازمانی", "UnitIndexCategory"); unitIndexRepository.Add(unitIndexCategory); } }
public static void CreateUnitIndex(IUnitIndexRepository unitIndexRepository, string name, string dictionaryName) { if (unitIndexCategory == null) { unitIndexCategory = new UnitIndexCategory(unitIndexRepository.GetNextId(), null, "شاخص های سازمانی", "UnitIndices"); unitIndexRepository.Add(unitIndexCategory); } var unitIndex = new UnitIndex(unitIndexRepository.GetNextId(), unitIndexCategory, name, dictionaryName); unitIndex.AssignCustomFields(DefinedCustomFields.Where(dc => dc.EntityId == EntityTypeEnum.UnitIndex).ToList()); unitIndexRepository.Add(unitIndex); UnitIndices.Add(unitIndex); }