public List <OpportunityRegistered> GetOpportunityRegisteredByStudentId(int studentId)
        {
            var reader = dbHelper.GetRegisteredOpportunityByStudentId(Constant.SP_GetOpportunityRegisteredByStudentId, studentId);

            List <OpportunityRegistered> registeredList        = new List <OpportunityRegistered>();
            OpportunityRegistered        opportunityRegistered = null;

            while (reader.Read())
            {
                opportunityRegistered = new OpportunityRegistered();

                opportunityRegistered.OpportunityID     = Convert.ToInt32(reader["OpportunityID"]);
                opportunityRegistered.StudentId         = Convert.ToInt32(reader["StudentId"]);
                opportunityRegistered.Opportunity       = reader["Opportunity"].ToString();
                opportunityRegistered.Course            = reader["CourseName"].ToString();
                opportunityRegistered.Quarter           = reader["Quarter"].ToString();
                opportunityRegistered.Organization      = reader["Organization"].ToString();
                opportunityRegistered.EmailId           = reader["EmailId"].ToString();
                opportunityRegistered.Status            = reader["Status"].ToString();
                opportunityRegistered.HoursVolunteered  = reader["HoursVolunteered"].ToString();
                opportunityRegistered.ParternEvaluation = reader["PartnerEvaluation"].ToString();
                opportunityRegistered.StudentEvaluation = reader["StudentEvaluation"].ToString();
                opportunityRegistered.StudentReflection = reader["StudentReflection"].ToString();

                registeredList.Add(opportunityRegistered);
            }

            return(registeredList);
        }
        protected void RegistrationConfirmationPage(object sender, EventArgs e)
        {
            int studentId     = Convert.ToInt32(Session["Student_StudentID"]);
            int opportunityId = Convert.ToInt32(Session["Student_SelectedOpportunityID"]);
            //Response.Write("<script>window.open('RegistrationConfirmation.aspx','_blank');</script>");
            //this.ClientScript.RegisterClientScriptBlock(this.GetType(), "Close", "window.close()", true);
            OpportunityRegistered opportunityRegistered = new OpportunityRegistered();
            bool registrationResult = opportunityRegistered.RegisterOpportunity(studentId, opportunityId);

            if (registrationResult)
            {
                Response.Write("<script>window.open('RegistrationConfirmation.aspx','_blank');</script>");
                this.ClientScript.RegisterClientScriptBlock(this.GetType(), "Close", "window.close()", true);
            }
            else
            {
                lblAgreementCheckboxFullLegalNameWarning.Text = "Something went wrong with registration for this opportunity. Please check with administrator.";
            }
        }
        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();
            }
        }