void Choose_RestrictionChoosenNew(object sender, Academic.ViewModel.IdAndNameEventArgs e) { var restrictionId = Session["CurrentRestrictionId"]; var restriction = Session["ControlList"] as RestrictionIdName; //if (list == null) list = new List<RestrictionIdName>(); if (restrictionId != null) { var split = restrictionId.ToString().Split(new char[] { '_' }); var parent = GetParentRestriction(restriction, split, RestrictionFifth1); if (parent != null && _foundMain != null) //new { var list = parent.Children; //[restrictionId.ToString()]; var noOfChildRestrictions = parent.Children.Count; var thisId = (noOfChildRestrictions + 1); RestrictionIdName resClass = null; switch (e.Id) { case 0: resClass = GetRestriction(restrictionId.ToString(), "activity" , thisId.ToString(), restrictionId + "_" + thisId , "", new List <RestrictionIdName>()); var activityCompleteRestriction = (ActivityCompleteRestrictionUC) Page.LoadControl("~/Views/RestrictionAccess/ActivityCompleteRestrictionUC.ascx"); activityCompleteRestriction.SetIds(resClass.ParentId, resClass.AbsoluteId, resClass.RelativeId, resClass.Name); _foundMain.AddControl(activityCompleteRestriction); break; case 1: resClass = GetRestriction(restrictionId.ToString(), "date" , thisId.ToString(), restrictionId + "_" + thisId , "", new List <RestrictionIdName>()); var dateRestriction = (DateRestrictionUC) Page.LoadControl("~/Views/RestrictionAccess/DateRestrictionUC.ascx"); dateRestriction.SetIds(resClass.ParentId, resClass.AbsoluteId, resClass.RelativeId, resClass.Name); _foundMain.AddControl(dateRestriction); break; case 2: resClass = GetRestriction(restrictionId.ToString(), "grade" , thisId.ToString(), restrictionId + "_" + thisId , "", new List <RestrictionIdName>()); var gradeRestriction = (GradeRestrictionUC) Page.LoadControl("~/Views/RestrictionAccess/GradeRestrictionUC.ascx"); gradeRestriction.SetIds(resClass.ParentId, resClass.AbsoluteId, resClass.RelativeId, resClass.Name, 0); _foundMain.AddControl(gradeRestriction); break; case 3: resClass = GetRestriction(restrictionId.ToString(), "group" , thisId.ToString(), restrictionId + "_" + thisId , "", new List <RestrictionIdName>()); var groupRestriction = (GroupRestrictionUC) Page.LoadControl("~/Views/RestrictionAccess/GroupRestrictionUC.ascx"); groupRestriction.SetIds(resClass.ParentId, resClass.AbsoluteId, resClass.RelativeId, resClass.Name, 0); _foundMain.AddControl(groupRestriction); break; case 4: resClass = GetRestriction(restrictionId.ToString(), "userprofile" , thisId.ToString(), restrictionId + "_" + thisId , "", new List <RestrictionIdName>()); var userProfileRestriction = (UserProfileRestriction) Page.LoadControl("~/Views/RestrictionAccess/UserProfileRestriction.ascx"); userProfileRestriction.SetIds(resClass.ParentId, resClass.AbsoluteId, resClass.RelativeId, resClass.Name); _foundMain.AddControl(userProfileRestriction); break; case 5: resClass = GetRestriction(restrictionId.ToString(), "main" , thisId.ToString(), restrictionId + "_" + thisId , "", new List <RestrictionIdName>()); var restrictionSetUc = (RestrictionFifth) Page.LoadControl("~/Views/RestrictionAccess/Main/RestrictionFifth.ascx"); restrictionSetUc.SetIds(resClass.ParentId, resClass.AbsoluteId, resClass.RelativeId, resClass.Name); _foundMain.AddControl(restrictionSetUc); break; } if (resClass != null) { list.Add(resClass); PutJavaScript(); CallJavaScript(); //ScriptManager.RegisterStartupScript(this, typeof(Page), "UpdateMsg", "$(document).ready(function(){" + // ";alert('Overrides successfully Updated.');" + // "});", true); ////ScriptManager.RegisterStartupScript(this, typeof(Page), "UpdateMsg", "$(document).ready(function(){EnableControls();alert('Overrides successfully Updated.');DisableControls();});", true); //lblJavaScript.Text = "<script type='text/javascript'>showDialogue();</script>"; } //LoadFromType(); } } }
void Choose_RestrictionChoosenNew(object sender, Academic.ViewModel.IdAndNameEventArgs e) { var restrictionId = Session["CurrentRestrictionId"]; var restriction = Session["ControlList"] as RestrictionIdName; //if (list == null) list = new List<RestrictionIdName>(); if (restrictionId != null) { var split = restrictionId.ToString().Split(new char[] { '_' }); var parent = GetParentRestriction(restriction, split, RestrictionFifth1); if (parent != null && _foundMain != null) //new { var list = parent.Children; //[restrictionId.ToString()]; var noOfChildRestrictions = parent.Children.Count; var thisId = (noOfChildRestrictions + 1); RestrictionIdName resClass = null; switch (e.Id) { case 0: resClass = GetRestriction(restrictionId.ToString(), "activity" , thisId.ToString(), restrictionId + "_" + thisId , "", new List <RestrictionIdName>()); var activityCompleteRestriction = (ActivityCompleteRestrictionUC) Page.LoadControl("~/Views/RestrictionAccess/ActivityCompleteRestrictionUC.ascx"); activityCompleteRestriction.SetIds(resClass.ParentId, resClass.AbsoluteId, resClass.RelativeId, resClass.Name); _foundMain.AddControl(activityCompleteRestriction); break; case 1: resClass = GetRestriction(restrictionId.ToString(), "date" , thisId.ToString(), restrictionId + "_" + thisId , "", new List <RestrictionIdName>()); var dateRestriction = (DateRestrictionUC) Page.LoadControl("~/Views/RestrictionAccess/DateRestrictionUC.ascx"); dateRestriction.SetIds(resClass.ParentId, resClass.AbsoluteId, resClass.RelativeId, resClass.Name); _foundMain.AddControl(dateRestriction); break; case 2: resClass = GetRestriction(restrictionId.ToString(), "grade" , thisId.ToString(), restrictionId + "_" + thisId , "", new List <RestrictionIdName>()); var gradeRestriction = (GradeRestrictionUC) Page.LoadControl("~/Views/RestrictionAccess/GradeRestrictionUC.ascx"); gradeRestriction.SetIds(resClass.ParentId, resClass.AbsoluteId, resClass.RelativeId, resClass.Name, 0); _foundMain.AddControl(gradeRestriction); break; case 3: resClass = GetRestriction(restrictionId.ToString(), "group" , thisId.ToString(), restrictionId + "_" + thisId , "", new List <RestrictionIdName>()); var groupRestriction = (GroupRestrictionUC) Page.LoadControl("~/Views/RestrictionAccess/GroupRestrictionUC.ascx"); groupRestriction.SetIds(resClass.ParentId, resClass.AbsoluteId, resClass.RelativeId, resClass.Name, 0); _foundMain.AddControl(groupRestriction); break; case 4: resClass = GetRestriction(restrictionId.ToString(), "userprofile" , thisId.ToString(), restrictionId + "_" + thisId , "", new List <RestrictionIdName>()); var userProfileRestriction = (UserProfileRestriction) Page.LoadControl("~/Views/RestrictionAccess/UserProfileRestriction.ascx"); userProfileRestriction.SetIds(resClass.ParentId, resClass.AbsoluteId, resClass.RelativeId, resClass.Name); _foundMain.AddControl(userProfileRestriction); break; case 5: resClass = GetRestriction(restrictionId.ToString(), "main" , thisId.ToString(), restrictionId + "_" + thisId , "", new List <RestrictionIdName>()); var restrictionSetUc = (RestrictionFifth) Page.LoadControl("~/Views/RestrictionAccess/Main/RestrictionFifth.ascx"); restrictionSetUc.SetIds(resClass.ParentId, resClass.AbsoluteId, resClass.RelativeId, resClass.Name); _foundMain.AddControl(restrictionSetUc); break; } if (resClass != null) { list.Add(resClass); } //LoadFromType(); } } }