Esempio n. 1
0
 IList <decimal> IDataAccess.GetAccessibleRuleGroups()
 {
     if (userRepository.HasAllRuleGroupAccess(this.CurrentUserId) > 0)
     {
         IList <RuleCategory> list = new EntityRepository <RuleCategory>().GetAll();
         var ids = from obj in list
                   select obj.ID;
         return(ids.ToList <decimal>());
     }
     else
     {
         //return userRepository.GetUserRuleGroupIdList(this.CurrentUserId);
         BRuleCategory  bRuleCat            = new BRuleCategory();
         List <decimal> ruleCatList         = new List <decimal>();
         List <decimal> childAndParentsList = new List <decimal>();
         ruleCatList.AddRange(userRepository.GetUserRuleGroupIdList(this.CurrentUserId));
         foreach (decimal ruleCatId in ruleCatList)//اضافه کردن بچه ها و والد ها
         {
             IList <RuleCategory> childs = new List <RuleCategory>();
             //childs = bRuleCat.GetReportChildsByParentPath(ruleCatId);
             childAndParentsList.Add(bRuleCat.GetByID(ruleCatId).Parent.ID);
             var ids = from child in childs
                       select child.ID;
             childAndParentsList.AddRange(ids.ToList <decimal>());
         }
         ruleCatList.AddRange(childAndParentsList);
         return(ruleCatList);
     }
 }
Esempio n. 2
0
 public void Copy_InsertRuleCat_Test()
 {
     try
     {
         decimal newId = businessCategory.CopyRuleCategory(AdoRuleCat.ID).ID;
         ClearSession();
         ruleCat_testObject = businessCategory.GetByID(newId);
         Assert.AreEqual(newId, ruleCat_testObject.ID);
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }