private int AttendeesDataBind() { List <Person> people; int GrandTotal = 0; if (!ShowActiveCheck.Checked) { people = CD.GetAttendees(Convert.ToInt32(hfOccurrence.Value)); } else { people = CD.GetAttendees(Convert.ToInt32(hfOccurrence.Value)).Where(x => x.Checkout.Date == new DateTime(1900, 1, 1)).ToList(); } TotalAttendeesLabel.Text = people.Where(x => x.PersonType == Arena.Enums.OccurrenceAttendanceType.Person && x.Checkin >= DateTime.Today && x.Checkout == DateTime.Parse("1/1/1900")).Count().ToString(); TotalVolunteersLabel.Text = people.Where(x => x.PersonType == Arena.Enums.OccurrenceAttendanceType.Leader && x.Checkin >= DateTime.Today && x.Checkout == DateTime.Parse("1/1/1900")).Count().ToString(); GrandTotal = people.Where(x => x.Checkin >= DateTime.Today && x.Checkout == DateTime.Parse("1/1/1900")).Count(); GrandTotalLabel.Text = GrandTotal.ToString(); AttendeesList.DataSource = people; AttendeesList.DataBind(); return(GrandTotal); }
async void ListviewcloseClicked(object sender, EventArgs e1) { var args = (TappedEventArgs)e1; AttendeesList t2 = args.Parameter as AttendeesList; var itemToRemove = attList.Single(r => r.name == t2.name); attList.Remove(itemToRemove); attnListView.ItemsSource = attList; attnListView.RowHeight = 30; attnListView.HeightRequest = 30 * attList.Count; // taxes obj = (taxes)args; }
public IActionResult UnRSVP(int ActivityId) { AttendeesList bailing = _context.attendeesList.SingleOrDefault( ps => ps.userID == (int)HttpContext.Session.GetInt32("userID") && ps.activityID == ActivityId); if (bailing != null) { _context.attendeesList.Remove(bailing); _context.SaveChanges(); } return(RedirectToAction("Splash")); }
private void ShowAttendees() { if (mv.ActiveViewIndex == 0 && !string.IsNullOrEmpty(hfOccurrence.Value) && !string.IsNullOrEmpty(hfPopupOpen.Value)) { int TotalAttendees = this.AttendeesDataBind(); SetMoveAllStatus(TotalAttendees); if (!string.IsNullOrEmpty(this.GridSortExpression)) { AttendeesList.Sort(this.GridSortExpression, SortDirection.Ascending); } } }
public IActionResult Respond(int ActivityID) { AttendeesList newSession = new AttendeesList { userID = (int)HttpContext.Session.GetInt32("userID"), activityID = ActivityID }; AttendeesList existingSession = _context.attendeesList.SingleOrDefault( r => r.userID == (int)HttpContext.Session.GetInt32("userID") && r.activityID == ActivityID); if (existingSession == null) { _context.attendeesList.Add(newSession); _context.SaveChanges(); } return(RedirectToAction("Splash")); }
async void ListviewcloseClicked(object sender, EventArgs e1) { attnListView.ItemsSource = attList1; var args = (TappedEventArgs)e1; AttendeesList t2 = args.Parameter as AttendeesList; var itemToRemove = attList.Single(r => r.name == t2.name); attList.Remove(itemToRemove); int cusid = App.cusdict.FirstOrDefault(x => x.Value == t2.name.ToString()).Key; atnIdsList.Remove(cusid); attnListView.ItemsSource = attList; attnListView.RowHeight = 40; attnListView.HeightRequest = 40 * attList.Count; mainstack.HeightRequest = mainstack.HeightRequest - 40; // taxes obj = (taxes)args; }
protected void AttendeesList_Sorting(object sender, GridViewSortEventArgs e) { List <Person> people; this.GridSortExpression = e.SortExpression; if (AttendeesList.DataSource == null) { this.AttendeesDataBind(); } people = (List <Person>)AttendeesList.DataSource; IEnumerable _data = people; Type dataSourceType = _data.GetType(); Type dataItemType = typeof(object); if (dataSourceType.HasElementType) { dataItemType = dataSourceType.GetElementType(); } else if (dataSourceType.IsGenericType) { dataItemType = dataSourceType.GetGenericArguments()[0]; } else if (_data is IEnumerable) { IEnumerator dataEnumerator = _data.GetEnumerator(); if (dataEnumerator.MoveNext() && dataEnumerator.Current != null) { dataItemType = dataEnumerator.Current.GetType(); } } //var fieldType = dataItemType.GetProperty(e.SortExpression); object sorterObject = null; Type sorterType = null; // We'll handle things like LINQ to SQL differently by passing the love // on to the provider. PropertyInfo property = dataItemType.GetProperty(e.SortExpression.Split('\u0020')[0]); sorterType = typeof(Arena.Custom.SECC.Checkin.Sort.GenericSorter <,>).MakeGenericType(dataItemType, property.PropertyType); sorterObject = Activator.CreateInstance(sorterType); AttendeesList.DataSource = sorterType.GetMethod("Sort", new Type[] { dataSourceType, typeof(string), typeof(SortDirection) }) .Invoke(sorterObject, new object[] { _data, e.SortExpression.Split('\u0020')[0], e.SortExpression.EndsWith("ASC") ? SortDirection.Ascending : SortDirection.Descending }); if (e.SortExpression.EndsWith("ASC")) { e.SortExpression = e.SortExpression.Replace("ASC", "DESC"); } else { e.SortExpression = e.SortExpression.Replace("DESC", "ASC"); } foreach (DataControlField dcf in AttendeesList.Columns) { if (dcf.SortExpression.StartsWith(e.SortExpression.Split('\u0020')[0])) { dcf.SortExpression = e.SortExpression; break; } } AttendeesList.DataBind(); }