private void FillMembers() { m_dtLastWorkout = DateTime.MinValue; m_sLastWorkout = ""; m_sLastWorkout = ""; m_iWeeklyTotalMets = 0; DateTime dtDay1 = DateTime.MinValue; DateTime dtDay2 = DateTime.MinValue; DateTime dtDay3 = DateTime.MinValue; DateTime dtDay4 = DateTime.MinValue; DateTime dtDay5 = DateTime.MinValue; DateTime dtDay6 = DateTime.MinValue; DateTime dtDay7 = DateTime.MinValue; DateTime today = DateTime.Now.Date; DateTime lastWeek = today.AddDays(-7).Date; string sToday = today.Month.ToString() + "/" + today.Day.ToString() + "/" + today.Year.ToString(); string sLastWeek = lastWeek.Month.ToString() + "/" + lastWeek.Day.ToString() + "/" + lastWeek.Year.ToString(); // Testing - this guy has data // AA1F476C-6628-4934-BE8C-47FB1DFAD2A8 // 2009-01-20 00:00:00.000 // 2009-01-28 00:00:00.000 // m_sUserId = "AA1F476C-6628-4934-BE8C-47FB1DFAD2A8"; // sLastWeek = "1/20/2009"; // sToday = "1/28/2009"; // get the dates PALClass objPALClass = new PALClass(m_Connection); DataSet entries = objPALClass.PAL_GET_PalEntries_BY_UserId(m_sUserId, sLastWeek, sToday); int tableCount = entries.Tables.Count; int rowsCount = entries.Tables[0].Rows.Count; int properIndex = rowsCount; if (tableCount > 0 && rowsCount > 0) { foreach (DataRow DR in entries.Tables[0].Rows) { if( !Convert.IsDBNull(DR["PAL_ENTRY_DATE"]) ) { DateTime dtDr = Convert.ToDateTime(DR["PAL_ENTRY_DATE"].ToString()).Date; if( properIndex == 1 && dtDay1 == DateTime.MinValue) { dtDay1 = dtDr; } if (properIndex == 2 && dtDay2 == DateTime.MinValue) { dtDay2 = dtDr; } if (properIndex == 3 && dtDay3 == DateTime.MinValue) { dtDay3 = dtDr; } if (properIndex == 4 && dtDay4 == DateTime.MinValue) { dtDay4 = dtDr; } if (properIndex == 5 && dtDay5 == DateTime.MinValue) { dtDay5 = dtDr; } if (properIndex == 6 && dtDay6 == DateTime.MinValue) { dtDay6 = dtDr; } if (properIndex == 7 && dtDay7 == DateTime.MinValue) { dtDay7 = dtDr; } properIndex--; } if( !Convert.IsDBNull(DR["MET_EQUIVALENT"]) ) m_iWeeklyTotalMets += Convert.ToInt16(DR["MET_EQUIVALENT"].ToString()); } } m_dtLastWorkout = GetLastWorkout(dtDay1, dtDay2, dtDay3, dtDay4, dtDay5, dtDay6, dtDay7); if (m_dtLastWorkout != DateTime.MinValue) { m_sLastWorkout = GetDateString(m_dtLastWorkout); m_sWorkoutHistory = GetWorkoutHistory(dtDay1, dtDay2, dtDay3, dtDay4, dtDay5, dtDay6, dtDay7); } else { m_sLastWorkout = "No workout history in the past week."; m_sWorkoutHistory = "No workout history in the past week."; } // get the weekly total mets triangle image as well as the left position of the marker and the left position of the total number MetsTriangle mt = GetMetsTriangle(m_iWeeklyTotalMets); m_sTriangleImage = mt.image; m_sProgressNumberLeft = mt.numberLeftPos; m_sProgressMarkerLeft = mt.markerLeftPos; // get the current program, the current step, and the step image by looking at the last entry in palstarts table DataSet starts = objPALClass.PAL_GET_PalStarts(m_sUserId, "1", "0"); tableCount = entries.Tables.Count; int startCount = starts.Tables[0].Rows.Count; if (tableCount > 0 && startCount > 0) { DataRow drStarts = starts.Tables[0].Rows[startCount-1]; if (!Convert.IsDBNull(drStarts["PROGRAM_NAME"])) m_sCurrentProgram = drStarts["PROGRAM_NAME"].ToString(); if (!Convert.IsDBNull(drStarts["LEVEL_ID"])) m_sCurrentStage = drStarts["LEVEL_ID"].ToString(); if (!Convert.IsDBNull(drStarts["PROGRAM_CURRENT_STEP"])) m_iCurrentStep = Convert.ToInt16(drStarts["PROGRAM_CURRENT_STEP"].ToString()); } m_sStepImage = GetStepImage(m_iCurrentStep); }