Exemplo n.º 1
0
        protected void btnCancel_Click(object sender, EventArgs e)
        {
            CourseManage cm = new CourseManage();
            DataRow      drr;
            int          sum   = 0;
            bool         IsAdd = true;

            foreach (GridViewRow dr in gvCourse.Rows)
            {
                if (((CheckBox)dr.FindControl("cbChoose")).Checked == true)
                {
                    sum += int.Parse(dr.Cells[6].Text);
                }
                if (((CheckBox)dr.FindControl("cbChoose")).Checked == true && dr.Cells[8].Text == " ")
                {
                    IsAdd = cm.IsAddCourse(dr.Cells[5].Text, sum);
                    if (IsAdd)
                    {
                        drr              = cm.CourseChooseDt.NewRow();
                        drr["ID"]        = 1;
                        drr["ModuleID"]  = long.Parse(dr.Cells[1].Text);
                        drr["StudentID"] = long.Parse(ViewState["StudentID"].ToString());
                        cm.AddCourseChoose(drr);
                    }
                }
            }
            bindDG();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取课程详细信息
        /// </summary>
        /// <param name="courseId">课程ID</param>
        /// <param name="studentId">学员ID</param>
        /// <returns></returns>
        public CourseDetails GetDetails(long courseId, long studentId)
        {
            var course = new CourseManage(courseId);

            var details = course.ConvertToCourseDetails(studentId);

            return(details);
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        void gvCourse_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
        {
            if (e.CommandName == "CancelCourse")
            {
                GridViewRow  drv = ((GridViewRow)(((Button)(e.CommandSource)).Parent.Parent));
                CourseManage cm  = new CourseManage();
                DataRow      dr  = cm.CourseChooseDt.NewRow();
                dr["ID"]   = long.Parse(drv.Cells[9].Text);
                dr["Flag"] = 0;
                cm.DeleteStudentCourse(dr);
                bindDG();
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 编辑课程
        /// </summary>
        /// <param name="courseId">课程ID</param>
        /// <param name="state">编辑过的资料</param>
        /// <returns></returns>
        public bool Modify(long courseId, long subjectId, string title, string image, string content, string remarks, string objective, int status)
        {
            CourseModifiedState state = new CourseModifiedState
            {
                Content   = content,
                Image     = image,
                Objective = objective,
                Remarks   = remarks,
                Status    = status,
                SubjectId = subjectId,
                Title     = title
            };

            CourseManage course = new CourseManage(courseId);

            return(course.ModifyTo(state));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 获取字段长度
        /// </summary>
        //protected void Getfieldlongth()
        //{
        //    CourseManage cm = new CourseDll.Bll.CourseManage();
        //    string tableName = "Modules";
        //    DataTable dt = cm.GetFieldLongth(tableName);
        //    if (dt.Rows.Count > 0)
        //    {
        //        modulenameL=int.Parse(dt.Rows[1]["长度"].ToString());
        //        xueshiL = int.Parse(dt.Rows[4]["长度"].ToString());
        //        startL = int.Parse(dt.Rows[5]["长度"].ToString());
        //        endL = int.Parse(dt.Rows[6]["长度"].ToString());
        //        totallong = modulenameL + xueshiL + startL + endL;
        //        gvCourse.Columns[1].HeaderStyle.Width = (int)Math.Round((double)(modulenameL / totallong * 80)) + '%';
        //        gvCourse.Columns[2].HeaderStyle.Width = (int)Math.Round((double)(modulenameL / totallong * 80)) + '%';
        //        gvCourse.Columns[3].HeaderStyle.Width = (int)Math.Round((double)(modulenameL / totallong * 80)) + '%';
        //        gvCourse.Columns[4].HeaderStyle.Width = (int)Math.Round((double)(modulenameL / totallong * 80)) + '%';
        //    }
        //}

        #endregion

        #region 方法
        /// <summary>
        /// 绑定
        /// </summary>
        public void bindDG()
        {
            //判断当前用户是否选课


            CourseManage cm        = new CourseManage();
            UserManage   um        = new UserManage();
            long         StudentID = um.GetOrAddUserIDByAccount(StudentNO);
            DataTable    dt        = cm.GetCourseManage(StudentID);

            ViewState["StudentID"] = StudentID;
            gvCourse.DataSource    = dt;
            gvCourse.DataBind();
            //
            int i   = 0;
            int sum = 0;

            foreach (DataRow dr in dt.Rows)
            {
                if (dr["SCID"].ToString() != "")
                {
                    i++;
                    sum += int.Parse(dr["ClassHours"].ToString());
                }
            }
            int    studyHour = int.Parse(System.Configuration.ConfigurationManager.AppSettings["StudyHour"]);
            string des       = "";

            if (sum >= studyHour)
            {
                des = "您已经达到学时要求";
            }
            else
            {
                des = "您还差" + (studyHour - sum) + "学时";
            }
            Des.Text = "亲,您已经选择了" + i + "个模块的课程,共" + sum + "学时,本课程要求" + studyHour + "学时," + des;
        }
Exemplo n.º 6
0
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            CourseManage courseManage = new CourseManage();

            courseManage.ShowDialog();
        }
Exemplo n.º 7
0
        private void 课程管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CourseManage courseManage = new CourseManage();

            courseManage.ShowDialog();
        }
Exemplo n.º 8
0
        /// <summary>
        /// 设置课程为“禁用”状态
        /// </summary>
        /// <param name="courseId"></param>
        /// <returns></returns>
        public bool SetDisable(long courseId)
        {
            CourseManage course = new CourseManage(courseId);

            return(course.SetDisable());
        }
Exemplo n.º 9
0
        /// <summary>
        /// 获取课程指定状态的题目集合
        /// </summary>
        /// <param name="courseId"></param>
        /// <param name="status">题目状态,为NULL时表示不限制</param>
        /// <returns></returns>
        public List <QuestionSimpleInfo> GetQuestions(long courseId, int?status = null)
        {
            var course = new CourseManage(courseId);

            return(course.GetQuestions(status));
        }
Exemplo n.º 10
0
        /// <summary>
        /// 获取课程信息
        /// </summary>
        /// <param name="courseId"></param>
        /// <returns></returns>
        public Course GetCourse(long courseId)
        {
            var course = new CourseManage(courseId);

            return(course.Course);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 删除课程
        /// </summary>
        /// <param name="courseId"></param>
        /// <returns></returns>
        public bool Delete(long courseId)
        {
            CourseManage course = new CourseManage(courseId);

            return(course.Delete());
        }