コード例 #1
0
        public List <OpportunityRegistration> GetOpportunityListByStudentId(int studentId)
        {
            var reader = dbHelper.GetOpportunityRegistrationByStudentId(Constant.SP_GetOpportunityListByStudentId, studentId);

            List <OpportunityRegistration> regirationList          = new List <OpportunityRegistration>();
            OpportunityRegistration        opportunityRegistration = null;

            while (reader.Read())
            {
                opportunityRegistration = new OpportunityRegistration();

                opportunityRegistration.OpportunityID        = Convert.ToInt32(reader["OpportunityID"]);
                opportunityRegistration.Position             = reader["Position"].ToString();
                opportunityRegistration.Organization         = reader["Organization"].ToString();
                opportunityRegistration.Location             = reader["Location"].ToString();
                opportunityRegistration.SlotsAvailable       = reader["SlotsAvailable"].ToString();
                opportunityRegistration.DistanceFromSU       = reader["DistanceFromSU"].ToString();
                opportunityRegistration.MinimumAge           = reader["MinimumAge"].ToString();
                opportunityRegistration.CRCRequiredByPartner = reader["CRCRequired"].ToString();
                opportunityRegistration.TimeCommittment      = reader["TimeCommittment"].ToString();
                opportunityRegistration.JobDescription       = reader["JobDescription"].ToString();

                regirationList.Add(opportunityRegistration);
            }

            return(regirationList);
        }
コード例 #2
0
        private void DataBind()
        {
            int studentId = Convert.ToInt32(Session["Student_StudentID"]);
            OpportunityRegistration opportunityRegistration = new OpportunityRegistration();

            List <OpportunityRegistration> oppList = opportunityRegistration.GetOpportunityListByStudentId(studentId);

            if (oppList.Count == 0)
            {
                OpportunityRegistration oppS = new OpportunityRegistration();
                oppList.Add(oppS);
                gvOpportunity.DataSource = oppList;
                gvOpportunity.DataBind();
                gvOpportunity.Rows[0].Visible = false;
            }
            else
            {
                gvOpportunity.DataSource = oppList;
                gvOpportunity.DataBind();
            }
        }