示例#1
0
 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;
     }
 }
示例#2
0
 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;
     }
 }
示例#3
0
 public static void CreateUnitIndexCategory(IUnitIndexRepository unitIndexRepository)
 {
     if (unitIndexCategory == null)
     {
         unitIndexCategory = new UnitIndexCategory(unitIndexRepository.GetNextId(), null, "شاخص های سازمانی",
                                                   "UnitIndexCategory");
         unitIndexRepository.Add(unitIndexCategory);
     }
 }
示例#4
0
        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);
        }