protected msMembershipLeader ConvertLeaderSearchResult(SearchResult searchResult) { if (searchResult == null || searchResult.Table == null || searchResult.Table.Rows.Count == 0) { return(null); } return(MemberSuiteObject.FromDataRow(searchResult.Table.Rows[0]).ConvertTo <msMembershipLeader>()); }
protected void setTimeSlots() { timeslots = new List <msSessionTimeSlot>(); using (var api = GetServiceAPIProxy()) { Search sTimeSlots = new Search { Type = msSessionTimeSlot.CLASS_NAME }; sTimeSlots.AddOutputColumn("ID"); sTimeSlots.AddOutputColumn("Name"); sTimeSlots.AddOutputColumn("StartTime"); sTimeSlots.AddOutputColumn("EndTime"); sTimeSlots.AddOutputColumn("AllowMultipleSessions"); sTimeSlots.AddCriteria(Expr.Equals(msSessionTimeSlot.FIELDS.Event, targetEvent.ID)); sTimeSlots.AddSortColumn("StartTime"); sTimeSlots.AddSortColumn("Name"); foreach (DataRow drResult in api.GetSearchResult(sTimeSlots, 0, null).Table.Rows) { timeslots.Add(MemberSuiteObject.FromDataRow(drResult).ConvertTo <msSessionTimeSlot>()); } } pnlSessions.Visible = false; // add the NULL timeslot, for sessions that have not been placed into time slots timeslots.Insert(0, new msSessionTimeSlot { Name = "Events Happening During this Event", ID = null }); // if there's one session, one session at all, then the panel is shown rptSessions.DataSource = timeslots; rptSessions.DataBind(); if (targetRegistrationFee.MaximumNumberOfSessions != null) { cvMaxSession.ErrorMessage = string.Format( "You have selected too many sessions. When registering using the '{0}' fee, you are allowed a maximum of {1} sessions.", targetRegistrationFee.Name, targetRegistrationFee.MaximumNumberOfSessions.Value); } }
protected void loadLeaders() { //If there's no chapters on this membership then the owner can't be a chapter leader if (dvChapterMembership.Count == 0) { leaders = new Dictionary <string, msMembershipLeader>(); return; } Search sLeaders = GetChapterLeaderSearch(null); sLeaders.AddOutputColumn("Chapter"); sLeaders.Criteria.Clear(); sLeaders.AddCriteria(Expr.Equals("Individual", ConciergeAPI.CurrentEntity.ID)); SearchOperationGroup chapterGroup = new SearchOperationGroup(); chapterGroup.FieldName = "Chapter"; chapterGroup.GroupType = SearchOperationGroupType.Or; foreach (DataRowView drvChapterMembership in dvChapterMembership) { chapterGroup.Criteria.Add(Expr.Equals("Chapter", drvChapterMembership["Chapter"].ToString())); } sLeaders.AddCriteria(chapterGroup); SearchResult srLeaders = APIExtensions.GetSearchResult(sLeaders, 0, null); leaders = new Dictionary <string, msMembershipLeader>(); foreach (DataRow drLeader in srLeaders.Table.Rows) { //Store and clear the chapter to avoid a casting exception string chapterId = drLeader["Chapter"].ToString(); drLeader["Chapter"] = DBNull.Value; msMembershipLeader leader = MemberSuiteObject.FromDataRow(drLeader).ConvertTo <msMembershipLeader>(); leaders[chapterId] = leader; } }