Exemple #1
0
        public object get(string id)
        {
            CourseTable courTable = null;

            string selectSql = "SELECT * FROM t_courseTable WHERE ID=@ID";

            SqlParameter[] sqlParas = new SqlParameter[] { new SqlParameter("@ID", id) };

            DataSet ds = SQLServerDBUtil.query(selectSql, sqlParas);

            if (ds.Tables[0].Rows.Count != 0)
            {
                courTable = new CourseTable();
                courTable.Id = ds.Tables[0].Rows[0][0].ToString();
                courTable.Semester = ds.Tables[0].Rows[0][1].ToString();
                courTable.Week = ds.Tables[0].Rows[0][2].ToString();
                courTable.WeekDay = ds.Tables[0].Rows[0][3].ToString();
                courTable.Place = ds.Tables[0].Rows[0][4].ToString();
                courTable.CourseTime = ds.Tables[0].Rows[0][5].ToString();
                courTable.TeachID = ds.Tables[0].Rows[0][6].ToString();
                courTable.ClassID = ds.Tables[0].Rows[0][7].ToString();
                courTable.CourId = ds.Tables[0].Rows[0][8].ToString();
            }

            return courTable;
        }
        protected void ImageButton_delete_Click(object sender, ImageClickEventArgs e)
        {
            ImageButton imageButton = sender as ImageButton;

            string id = imageButton.CommandArgument;

            AttendanceBLL attendBLL = new AttendanceBLL();
            CourseTableBLL ctBLL = new CourseTableBLL();
            CourseTable ct = ctBLL.get(id);

            string filter = "courId='" + ct.CourId + "' and teachID='" + ct.TeachID + "' and classID='" + ct.ClassID;
            filter += "' and semester='" + ct.Semester + "' and weekDay='" + ct.WeekDay + "' and courseTime='" + ct.CourseTime + "'";

            DataTable dt = PageUtil.getProcessedDataTable(ctBLL.getAll().Tables[0], filter,null,false);

            foreach (DataRow dr in dt.Rows)
            {
                attendBLL.deleteByCourseTableId(dr["ID"].ToString());
                CourseTable tempCt = new CourseTable();
                tempCt.Id = dr["ID"].ToString();
                ctBLL.delete(tempCt);
            }

            Response.Write("<script>alert('删除成功!');location.href='showCourseTable.aspx';</script>");
        }
Exemple #3
0
 /// <summary>
 /// 删除课程表信息
 /// </summary>
 /// <param name="courTable"></param>
 public void delete(CourseTable courTable)
 {
     dal.delete(courTable);
 }
Exemple #4
0
 /// <summary>
 /// 更新课程表信息
 /// </summary>
 /// <param name="courTable"></param>
 public void update(CourseTable courTable)
 {
     dal.update(courTable);
 }
Exemple #5
0
 /// <summary>
 /// 保存课程表信息
 /// </summary>
 /// <param name="courTable"></param>
 public void save(CourseTable courTable)
 {
     dal.save(courTable);
 }
        protected void ImageButton_submit_Click(object sender, ImageClickEventArgs e)
        {
            if (check())
            {
                AttendanceBLL attendBLL = new AttendanceBLL();
                CourseTableBLL ctBLL = new CourseTableBLL();
                string filter = "courId='" + ct.CourId + "' and teachID='" + ct.TeachID + "' and classID='" + ct.ClassID;
                filter += "' and semester='" + ct.Semester + "' and weekDay='" + ct.WeekDay + "' and courseTime='" + ct.CourseTime + "'";

                #region 先删除旧数据
                DataTable dt = PageUtil.getProcessedDataTable(ctBLL.getAll().Tables[0], filter,null, false);

                foreach (DataRow dr in dt.Rows)
                {
                    attendBLL.deleteByCourseTableId(dr["ID"].ToString());
                    CourseTable tempCt = new CourseTable();
                    tempCt.Id = dr["ID"].ToString();
                    ctBLL.delete(tempCt);
                }
                #endregion

                #region 后添加新数据
                string semester = DropDownList_semester_from.SelectedValue + "-" + DropDownList_semester_to.SelectedValue + "学年" + DropDownList_semester_end.SelectedValue;
                int week_from = Convert.ToInt32(DropDownList_week_from.SelectedValue);
                int week_to = Convert.ToInt32(DropDownList_week_to.SelectedValue);
                string weekDay = DropDownList_weekDay.SelectedValue;
                string place = TextBox_place.Text;
                string courseTime = DropDownList_courseTime.SelectedValue + "节";
                string teachId = ct.TeachID;
                string classId = ct.ClassID;
                string courId = ct.CourId;

                CourseTable courTable = new CourseTable();
                courTable.Semester = semester;
                courTable.WeekDay = weekDay;
                courTable.Place = place;
                courTable.CourseTime = courseTime;
                courTable.TeachID = teachId;
                courTable.ClassID = classId;
                courTable.CourId = courId;

                for (int i = week_from; i <= week_to; i++)
                {
                    courTable.Week = i.ToString();
                    ctBLL.save(courTable);
                }
                #endregion

                Response.Write("<script>alert('修改成功!');location.href='showCourseTable.aspx';</script>");

            }
        }
        /// <summary>
        /// 绑定数据源
        /// </summary>
        private void bind()
        {
            string id = Request.QueryString["ID"].ToString();
            string week = Request.QueryString["week"].ToString();

            CourseBLL courBLL = new CourseBLL();
            TeacherBLL teacherBLL = new TeacherBLL();
            ClassBLL classBLL = new ClassBLL();
            CourseTableBLL ctBLL = new CourseTableBLL();

            ct = ctBLL.get(id);

            #region 页面数据绑定
            Label_course.Text = courBLL.get(ct.CourId).Name;
            Label_teacher.Text = teacherBLL.get(ct.TeachID).Name;
            Label_class.Text = classBLL.get(ct.ClassID).Name;
            PageUtil.bindDropDownList(DropDownList_semester_from, ct.Semester.Substring(0, 4));
            PageUtil.bindDropDownList(DropDownList_semester_to, ct.Semester.Substring(5, 4));
            PageUtil.bindDropDownList(DropDownList_semester_end, ct.Semester.Substring(9, 3));
            PageUtil.bindDropDownList(DropDownList_week_from, week.Split('-')[0]);
            PageUtil.bindDropDownList(DropDownList_week_to, week.Split('-')[1]);
            PageUtil.bindDropDownList(DropDownList_weekDay, ct.WeekDay);
            TextBox_place.Text = ct.Place;
            PageUtil.bindDropDownList(DropDownList_courseTime, ct.CourseTime.Split('节')[0]);
            #endregion
        }
        protected void ImageButton_submit_Click(object sender, ImageClickEventArgs e)
        {
            if (check())
            {
                string semester = DropDownList_semester_from.SelectedValue + "-" + DropDownList_semester_to.SelectedValue + "学年" + DropDownList_semester_end.SelectedValue;
                int week_from = Convert.ToInt32(DropDownList_week_from.SelectedValue);
                int week_to = Convert.ToInt32(DropDownList_week_to.SelectedValue);
                string weekDay = DropDownList_weekDay.SelectedValue;
                string place = TextBox_place.Text;
                string courseTime = DropDownList_courseTime.SelectedValue + "节" ;
                string teachId = DropDownList_teacher.SelectedValue;
                string classId = DropDownList_class.SelectedValue;
                string courId = DropDownList_course.SelectedValue;

                CourseTableBLL courTableBLL = new CourseTableBLL();

                CourseTable courTable = new CourseTable();
                courTable.Semester = semester;
                courTable.WeekDay = weekDay;
                courTable.Place = place;
                courTable.CourseTime = courseTime;
                courTable.TeachID = teachId;
                courTable.ClassID = classId;
                courTable.CourId = courId;

                for (int i = week_from; i <= week_to; i++)
                {
                    courTable.Week = i.ToString();
                    courTableBLL.save(courTable);
                }

                Response.Write("<script>alert('添加成功!');location.href='addCourseTable.aspx';</script>");

            }
        }