Пример #1
0
        protected void gvOpportunityAdmin_OnRowDataBound(object sender, GridViewRowEventArgs e)
        {
            CourseSection cs = new CourseSection();

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Label lblStatus = ((Label)e.Row.FindControl("lblStatus"));
                Label lblOppId  = ((Label)e.Row.FindControl("lblOppId"));

                string status = lblStatus.Text.Trim();
                if (status == "Pending")
                {
                    lblStatus.ForeColor = System.Drawing.Color.Red;
                }

                DropDownCheckBoxes ddckAddCourseSections = ((DropDownCheckBoxes)e.Row.FindControl("ddckAddCourseSections"));
                ddckAddCourseSections.DataSource     = cs.GetUnAssignedCourseSection(Convert.ToInt32(lblOppId.Text));
                ddckAddCourseSections.DataTextField  = "CourseSectionDisplayName";
                ddckAddCourseSections.DataValueField = "SectionID";
                ddckAddCourseSections.DataBind();

                DropDownCheckBoxes ddckRemoveCourseSections = ((DropDownCheckBoxes)e.Row.FindControl("ddckRemoveCourseSections"));
                ddckRemoveCourseSections.DataSource     = cs.GetAssignedCourseSection(Convert.ToInt32(lblOppId.Text));
                ddckRemoveCourseSections.DataTextField  = "CourseSectionDisplayName";
                ddckRemoveCourseSections.DataValueField = "SectionID";
                ddckRemoveCourseSections.DataBind();
            }
        }
Пример #2
0
        protected void checkBoxesAdd_SelcetedIndexChanged(object sender, EventArgs e)
        {
            //Get the button that raised the event
            ListControl ddcbListControl = (ListControl)sender;
            //Get the row that contains this button
            GridViewRow gvr      = (GridViewRow)ddcbListControl.NamingContainer;
            Label       lblOppId = (Label)gvr.FindControl("lblOppId");

            int    oppId            = Convert.ToInt32(lblOppId.Text);
            string courseSectionIDs = string.Empty;

            foreach (ListItem item in (sender as ListControl).Items)
            {
                if (item.Selected)
                {
                    courseSectionIDs += ";" + item.Value;
                }
            }
            if (!string.IsNullOrEmpty(courseSectionIDs) && courseSectionIDs.Length > 1)
            {
                courseSectionIDs = courseSectionIDs.Substring(1);
                CourseSection cs = new CourseSection();
                cs.AddCourseSectionToOpportunity(oppId, courseSectionIDs);
                DataBind();
            }
        }
Пример #3
0
        public List <CourseSection> GetAssignedCourseSection(int opportunityId)
        {
            var reader = dbHelper.GetAssignedCourseSection(Constant.SP_GetAssignedCourseSection, opportunityId);

            List <CourseSection> courseSectionList = new List <CourseSection>();
            CourseSection        courseSection     = null;

            while (reader.Read())
            {
                courseSection                  = new CourseSection();
                courseSection.CourseId         = Convert.ToInt32(reader["CourseId"]);
                courseSection.SectionId        = Convert.ToInt32(reader["SectionId"]);
                courseSection.CourseName       = reader["CourseName"].ToString();
                courseSection.CourseShortName  = reader["CourseShortName"].ToString();
                courseSection.QuarterShortName = reader["QuarterShortName"].ToString();
                courseSection.QuarterName      = reader["QuarterName"].ToString();
                courseSection.RoomNumber       = reader["RoomNumber"].ToString();
                courseSection.ClassHours       = reader["ClassHours"].ToString();
                courseSection.NumberOfSlots    = Convert.ToInt32(reader["NumberOfSlots"]);
                courseSection.SectionName      = reader["SectionName"].ToString();

                courseSectionList.Add(courseSection);
            }

            return(courseSectionList);
        }