예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataBind();
                SemesterDAL tester         = new SemesterDAL();
                var         stuffSemesters = tester.GetAllSemesters();
                int         count          = 0;
                foreach (Semester sem in stuffSemesters)
                {
                    if (sem.StartDate <DateTime.Now& sem.EndDate> DateTime.Now)
                    {
                        this.ddlSemesters.SelectedIndex = count;
                    }
                    count++;
                }
            }


            GradeItemDAL checker = new GradeItemDAL();
            int          crn     = Int32.Parse(this.ddlCourses.SelectedValue);
            Dictionary <string, string> items = checker.GetUniqueGradedItemsByCRN(crn);

            try
            {
                var selected = items.First(o => o.Value.Equals(this.ddlAssignments.SelectedValue));
                Dictionary <string, string> list = (Dictionary <string, string>) this.odsAssignments.Select();
                string stuff = list.Values.ToList()[0];

                string selectedValue = selected.Value;

                bool visible = checker.getPublicStatusByCRNandGradeName(crn,
                                                                        selectedValue);
                this.cbxVisibility.Checked = visible;
            }
            catch (Exception ex)
            {
                this.lblError.Text = "There are no assignments for this course. Whoops!";
            }
        }