Exemplo n.º 1
0
        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>");

            }
        }
Exemplo n.º 2
0
        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>");

            }
        }