protected new void Page_Init(object sender, EventArgs e) { base.Page_Init(sender, e); if (Tile == null || Tile.TileParms == null) return; //if (Tile.TileParms.GetParm("level") != null) // _level = (Base.Enums.EntityTypes)Tile.TileParms.GetParm("level"); _groupID = DataIntegrity.ConvertToInt(Tile.TileParms.GetParm("groupID")); _classID = DataIntegrity.ConvertToInt(Tile.TileParms.GetParm("classID")); _UseResourcesTileFilterToDisplay = (Tile.TileParms.GetParm("UseResourcesTileFilterToDisplay") ?? "").ToString().ToLower(); if (!String.IsNullOrEmpty(Request.QueryString["childPage"])) { _selectedTeacher = (Base.Classes.Teacher)Tile.TileParms.GetParm("selectedTeacher"); } if(_selectedTeacher!=null) { _groupStudentsDT = Group.GetIMGroupStudentsByUserId(_selectedTeacher.PersonID , _classID, _groupID); } else { _groupStudentsDT = Group.GetIMGroupStudentsByUserId(SessionObject.LoggedInUser.Page, _classID, _groupID); } expiredContentView = UserHasPermission(Permission.AllowViewForIMUsageRightExpiredContent); }
private void LoadInstructionAssignments() { UserInfo ui=null; string Key = string.Empty; if (!String.IsNullOrEmpty(Request.QueryString["childPage"])) { _selectedTeacher = (Base.Classes.Teacher)Tile.TileParms.GetParm("selectedTeacher"); if(_selectedTeacher!= null) { string kenticousername = KenticoHelper.GetKenticoUser(_selectedTeacher.EmployeeID.ToString()); ui = UserInfoProvider.GetUserInfo(kenticousername); SetTreeProvider(_selectedTeacher.EmployeeID.ToString()); } } else { ui = (UserInfo)Session["KenticoUserInfo"]; SetTreeProvider(SessionObject.LoggedInUser.ToString()); } List<FilterTypeValues> _NodeList = _groupStudentsDT .AsEnumerable() .Select(x => new FilterTypeValues { NodeId = x["NodeId"].ToString(), createddate = Convert.ToDateTime(x["CreatedDate"].ToString()) }) .ToList(); var whereClause = "0"; int counter = 0; foreach(var x in _NodeList.Distinct().ToList()) { if (counter == 0) whereClause = ""; whereClause = counter == 0 ? x.NodeId.ToString() : whereClause + "," + x.NodeId.ToString(); counter = 1; } _imNodeList = new List<UserNodeList>(); foreach (var tileResource in StrResourcesToShowOnTile) { _imNodeList.AddRange(KenticoHelper.GetKenticoDocsForInstuctionAssignmentTiles(ui, tileResource.Value, _treeProvider,"NodeID in (" + whereClause +")")); } //List<KeyValuePair<string, DateTime>> _NodeList = _groupStudentsDT // .AsEnumerable() // //.OrderBy(p => p["createddate"].ToString()) // .Select(s => new KeyValuePair<string, DateTime>(s.Field<string>("NodeID"), Convert.ToDateTime( s.Field<string>("createddate")))) // .ToList(); //_imNodeList.Where(x => string.Format("mm/dd/yy", x.ExpirationDate) != "12/31/99").ToList().Where(y => y.ExpirationDate.AddDays(IM_DueEnd) <= DateTime.Now.Date).ToList(); // ForEach(y => y.ExpirationDate = y.ExpirationDate.AddDays( IM_DueEnd)); if(!expiredContentView) { var _tempNodeList = new List<UserNodeList>(); _tempNodeList.AddRange(_imNodeList.Where(x => x.ExpirationDate == Convert.ToDateTime("12/31/9999 12:00:00 AM")).ToList()); _imNodeList = _imNodeList.Where(x => x.ExpirationDate < Convert.ToDateTime("12/31/9999 12:00:00 AM")).ToList(); if(_imNodeList.Count>0) { _tempNodeList.AddRange(_imNodeList.Where(y => y.ExpirationDate.AddDays(IMDueEnd) >= DateTime.Now.Date).ToList()); } _imNodeList = _tempNodeList; } _imNodeList = (from m in _imNodeList join n in _NodeList on m.NodeId equals n.NodeId select m).ToList().Distinct().ToList(); _imNodeList.ForEach(x => x.CreatedDate = (_NodeList.Where(y => y.NodeId == x.NodeId).FirstOrDefault().createddate)); _imNodeList = _imNodeList.OrderByDescending(x => x.CreatedDate).ToList(); ViewState["NodeList"] = _imNodeList; }