public StudentHours GetVolunteeredAndPartnerApprovedHours(int studentId, int opportunityID) { var reader = dbHelper.GetVolunteeredAndPartnerApprovedHours(Constant.SP_GetStudentVolunteeredPartnerApprovedHoursByOpportunityId, studentId, opportunityID); StudentHours studentHours = new StudentHours(); reader.Read(); studentHours.HoursVolunteered = reader["HoursVolunteered"].ToString(); studentHours.PartnerApprovedHours = reader["PartnerApprovedHours"].ToString(); return(studentHours); }
private void DataBind() { int studentId = Convert.ToInt32(Session["Student_StudentID"]); OpportunityRegistered opportunityRegistered = new OpportunityRegistered(); List <OpportunityRegistered> result = opportunityRegistered.GetOpportunityRegisteredByStudentId(studentId); StudentHours studenthours = new StudentHours(); for (int i = 0; i < result.Count; i++) { StudentHours hours = studenthours.GetVolunteeredAndPartnerApprovedHours(result[i].StudentId, result[i].OpportunityID); result[i].HoursVolunteered = hours.HoursVolunteered + " / " + hours.PartnerApprovedHours; } Quarter quarter = new Quarter(); string currentQuarter = quarter.GetCurrentQuarterName(); string filterItem = DropDownList1.SelectedItem.Text; if (filterItem == "Current") { for (int i = 0; i < result.Count; i++) { if (result[i].Quarter != currentQuarter) { result.Remove(result[i]); } } } if (result.Count == 0) { OpportunityRegistered oppS = new OpportunityRegistered(); result.Add(oppS); gvOpportunity.DataSource = result; gvOpportunity.DataBind(); gvOpportunity.Rows[0].Visible = false; } else { gvOpportunity.DataSource = result; gvOpportunity.DataBind(); } }