public Restriction GetRestriction() { var data = EachRestriction1.GetData(); IsValid = EachRestriction1.IsValid; return(data); }
//public Academic.DbEntities.Subjects.SubjectSection Section; /// <summary> /// Iniital call... /// </summary> void SetRestriction() { using (var helper = new DbHelper.ActAndRes()) { var sectionId = SectionId; if (sectionId > 0) //then its section { using (var secHelper = new DbHelper.SubjectSection()) { var section = secHelper.GetSection(sectionId); if (section != null && section.Restriction != null) { EachRestriction1.RestrictionId = section.RestrictionId ?? 0; EachRestriction1.SetConstraints(section.Restriction.MatchMust, section.Restriction.MatchAllAny); var rSession = Session["ControlList_" + hidPageKeyForUniqueSession.Value] as RestrictionIdName; var user = Page.User as CustomPrincipal; if (user != null) { if (rSession != null) { var parent = rSession; SetRestriction(section.Restriction, parent); } else { Session["ControlList_" + hidPageKeyForUniqueSession.Value] = new RestrictionIdName() { AbsoluteId = EachRestriction1.AbsoluteId, ParentId = "0", Name = "Main", Children = new List <RestrictionIdName>(), RelativeId = "1" }; } } } } } else//else its activity or resource { var restriction = helper.GetRestriction( ActivityOrResource , (byte)(((int)ActivityOrResourceType)) , ActivityOrResourceId); if (restriction != null) { EachRestriction1.RestrictionId = restriction.Id; EachRestriction1.SetConstraints(restriction.MatchMust, restriction.MatchAllAny); // populate session.. var relativeId = EachRestriction1.RelativeId; var rSession = Session["ControlList_" + hidPageKeyForUniqueSession.Value] as RestrictionIdName; var user = Page.User as CustomPrincipal; if (user != null) { if (rSession != null) { var parent = rSession; SetRestriction(restriction, parent); } else { Session["ControlList_" + hidPageKeyForUniqueSession.Value] = new RestrictionIdName() { AbsoluteId = EachRestriction1.AbsoluteId, ParentId = "0", Name = "Main", Children = new List <RestrictionIdName>(), RelativeId = "1" }; } } } } } }