示例#1
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="ManageGradeItemsController" /> class.
 /// </summary>
 /// <param name="assignmentPage">The assignment page.</param>
 public ManageGradeItemsController(ManageAssignmentPage assignmentPage)
 {
     this.assignmentPage = assignmentPage;
     this.semesterDal    = new SemesterDAL();
     this.courseDal      = new CourseDAL();
     this.rubricDal      = new CourseRubricDAL();
     this.gradeItemDal   = new GradeItemDAL();
     this.CRN            = assignmentPage.CRN;
 }
        protected void btnAddCourse_Click(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["chosenCRN"] != null)
            {
                var        current     = HttpContext.Current.Session["User"] as User;
                StudentDAL courseAdder = new StudentDAL();
                int        crn         = (int)HttpContext.Current.Session["chosenCRN"];

                try
                {
                    SemesterDAL semesterChecker = new SemesterDAL();
                    if (semesterChecker.CheckIfAddDropHasPassed(this.ddlSemester.SelectedValue))
                    {
                        CourseSignUpHelper helper = new CourseSignUpHelper();
                        if (helper.CheckIfStudentCanSignUpForCourseBasedOnPreReqs(crn, current.UserId))
                        {
                            if (helper.CheckIfCanSignUpForCourseBasedOnTimes(crn, current.UserId,
                                                                             this.ddlSemester.SelectedValue))
                            {
                                courseAdder.addCourseByCRNAndStudentUID(crn, current.UserId);
                                Response.Redirect("BrowseCourses.aspx", false);
                            }
                            else
                            {
                                this.lblCourseToAdd.Text =
                                    "You can't sign up for this course, its time conflicts with another course you have already signed up for.";
                            }
                        }
                        else
                        {
                            this.lblCourseToAdd.Text =
                                "You can't sign up for this course due to pre-requisite requirements" + Environment.NewLine;
                            this.lblCourseToAdd.Text += helper.GetPreReqsAndFormatForDisplay(crn);
                        }
                    }
                    else
                    {
                        {
                            this.lblCourseToAdd.Text = "The add drop deadline for this semester has already passed.";
                        }
                    }
                }

                catch (Exception ex)
                {
                    if (ex.Message.Equals("This course is still in progress."))
                    {
                        this.lblCourseToAdd.Text = ex.Message;
                    }
                    else
                    {
                        this.lblCourseToAdd.Text = "You are already in this course";
                        HttpContext.Current.Session["chosenCRN"] = null;
                    }
                }
            }
        }
示例#3
0
        // 修改验证是否存在
        public static bool IsTrue(string Name, int Id)
        {
            Semester model = SemesterDAL.GetIdByName(Name);

            if (model != null && model.SemesterId != 0 && model.SemesterId != Id)
            {
                return(true);
            }
            return(false);
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="TeacherHomePageController" /> class.
 /// </summary>
 /// <param name="page">The page.</param>
 public TeacherHomePageController(TeacherHomePAge page)
 {
     if (page == null)
     {
         throw new ArgumentException("page cannot be null");
     }
     this.homePage             = page;
     this.courseDAL            = new CourseDAL();
     this.gradedItemDal        = new GradeItemDAL();
     this.desktopGradedItemDal = new DesktopGradedItemDAL();
     this.semesterDal          = new SemesterDAL();
 }
示例#5
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!";
            }
        }
示例#6
0
 /// <summary>
 /// 查询全部
 ///</summary>
 public static List <Semester> AllData(string WhereSrc, string PXzd, string PXType)
 {
     return(SemesterDAL.AllData(WhereSrc, PXzd, PXType));
 }
示例#7
0
 /// <summary>
 /// 根据主键查询实体
 ///</summary>
 public static Semester GetIdBySemester(int Id)
 {
     return(SemesterDAL.GetIdBySemester(Id));
 }
示例#8
0
 /// <summary>
 /// 分页
 ///</summary>
 public static List <Semester> PageSelectSemester(int pageSize, int pageIndex, string WhereSrc, string PXzd, string PXType)
 {
     pageIndex = pageIndex - 1;
     return(SemesterDAL.PageSelectSemester(pageSize, pageIndex, WhereSrc, PXzd, PXType));
 }
示例#9
0
 /// <summary>
 /// 查询条数
 ///</summary>
 public static int CountNumber(string NewWHere)
 {
     return(SemesterDAL.CountNumber(NewWHere));
 }
示例#10
0
 /// <summary>
 /// 根据主键删除
 ///</summary>
 public static int DeleteSemester(int Id)
 {
     return(SemesterDAL.DeleteSemester(Id));
 }
示例#11
0
 /// <summary>
 /// 根据ID修改
 ///</summary>
 public static int UpdateSemester(Semester SemesterModel)
 {
     return(SemesterDAL.UpdateSemester(SemesterModel));
 }
示例#12
0
 /// <summary>
 /// 添加
 ///</summary>
 public static int AddSemester(Semester SemesterModel)
 {
     return(SemesterDAL.AddSemester(SemesterModel));
 }
 public RubricController(ManageRubricPage rubricPage)
 {
     this.rubricPage  = rubricPage;
     this.courseDAL   = new CourseDAL();
     this.semesterDal = new SemesterDAL();
 }