//populate the dates that the kid has booked private void populateDates() { List <DateTime> dates = new List <DateTime>(); MiscDB miscdb = new MiscDB(db); dates = miscdb.BookingWeeksFromKid(kids[kidslistbox.SelectedIndex].Forename); bookinglistbox.Items.Clear(); foreach (DateTime date in dates) { bookinglistbox.Items.Add(date.ToShortDateString()); } daysbookedlbl.Text = "Days Booked: " + dates.Count.ToString(); if (dates.Count > 0) { bookinglistbox.SelectedIndex = 0; } setPrice(dates); }
//create a table to show the kids in the group and when they will change group private void createTableForGroup(int groupid) { table = new DataTable(); table.Columns.Add("Child Name"); table.Columns.Add("Child DOB"); table.Columns.Add("Child Group"); table.Columns.Add("Months till group change"); table.Columns.Add("Needs Attenion"); MiscDB miscdb = new MiscDB(db); data = miscdb.GetGroupDetails(groupid); attention = new List <int>(); foreach (List <string> current in data) { int change = MiscFunctions.CalculateGroupChange(current[2], groupid); attention.Add(change); string Attention = "No"; if (change <= 0) { Attention = "Yes"; } table.Rows.Add(current[0] + " " + current[1], current[2], MiscFunctions.getgroupfromage(current[2]), change.ToString(), Attention); } GroupDetails.DataSource = table; GroupDetails.AllowUserToAddRows = false; int x = 0; foreach (DataGridViewRow row in GroupDetails.Rows) //need to loop through rows in order to color the attention column accordingly { if (attention[x] > 0) { row.Cells[4].Style.BackColor = Color.LimeGreen; } else { row.Cells[4].Style.BackColor = Color.Red; } x++; } }