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

            AttendanceBLL attendBLL = new AttendanceBLL();
            attend = attendBLL.get(id);

            CourseTableBLL ctBLL = new CourseTableBLL();
            CourseTable ct = ctBLL.get(attend.CourTableID);

            ClassBLL classBLL = new ClassBLL();
            TeacherBLL teacherBLL = new TeacherBLL();
            CourseBLL courseBLL = new CourseBLL();
            StudentBLL stuBLL = new StudentBLL();

            #region 绑定页面数据
            Label_class.Text = classBLL.get(ct.ClassID).Name;
            Label_course.Text = courseBLL.get(ct.CourId).Name;
            Label_teacher.Text = teacherBLL.get(ct.TeachID).Name;
            Label_student.Text = stuBLL.get(attend.StudID).Name;
            Label_oldStatus.Text = attend.Status;
            Label_week.Text = ct.Week;
            Label_weekDay.Text = ct.WeekDay;
            Label_courseTime.Text = ct.CourseTime;
            Label_place.Text = ct.Place;

            #endregion
        }
        protected void Button_submit_Click(object sender, EventArgs e)
        {
            ClassBLL classBLL = new ClassBLL();
            if (!string.IsNullOrEmpty(classBLL.get(DropDownList_class.SelectedValue).MonitorID))
            {

                AttendanceBLL attendBLL = new AttendanceBLL();

                Attendance attend = new Attendance();

                attend.Status = DropDownList_status.SelectedValue;
                attend.Remark = "";
                attend.Recorder = "班长";
                attend.RecorderID = classBLL.get(DropDownList_class.SelectedValue).MonitorID;
                attend.StudID = DropDownList_student.SelectedValue;
                attend.CourTableID = Label_courTableId.Text;

                attendBLL.save(attend);

                Response.Write("<script>alert('添加成功!');location.href='increaseStudentAttendanceRecords.aspx';</script>");
            }
            else
            {
                Response.Write("<script>alert('添加失败!该班级没有班长!');location.href='increaseStudentAttendanceRecords.aspx';</script>");
            }
        }
Exemple #3
0
        public object get(string id)
        {
            Attendance att = null;

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

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

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

            if (ds.Tables[0].Rows.Count != 0)
            {
                att = new Attendance();

                att.Id = ds.Tables[0].Rows[0][0].ToString();
                att.Status = ds.Tables[0].Rows[0][1].ToString();
                att.Remark = ds.Tables[0].Rows[0][2].ToString();
                att.Recorder = ds.Tables[0].Rows[0][3].ToString();
                att.RecorderID = ds.Tables[0].Rows[0][4].ToString();
                att.StudID = ds.Tables[0].Rows[0][5].ToString();
                att.CourTableID = ds.Tables[0].Rows[0][6].ToString();
            }

            return att;
        }
        protected void ImageButton_delete_Click(object sender, EventArgs e)
        {
            LinkButton linkButton = sender as LinkButton;

            string id = linkButton.CommandArgument;

            Attendance attend = new Attendance();
            attend.Id = id;

            AttendanceBLL attendBLL = new AttendanceBLL();
            attendBLL.delete(attend);

            Response.Write("<script>alert('删除成功!');location.href='attendanceStatistics.aspx';</script>");
        }
Exemple #5
0
        public void bind()
        {
            courTableID = Request.QueryString["courTableID"];

            User user = Session["User"] as User;

            TeacherBLL teachBLL = new TeacherBLL();
            StudentBLL studBLL = new StudentBLL();
            CourseTableBLL ctBLL = new CourseTableBLL();
            CourseTable ct = ctBLL.get(courTableID);

            ClassBLL classBll = new ClassBLL();
            Class cla = classBll.get(ct.ClassID);
            className.Text = cla.Name;

            dt = studBLL.getByClassId(ct.ClassID).Tables[0];

            if (Session["attenList"] != null)
            {
                attenList = Session["attenList"] as List<Attendance>;
            }
            else
            {
                attenList = new List<Attendance>();
                foreach (DataRow dr in dt.Rows)
                {
                    Attendance attend = new Attendance();
                    attend.Status = "正常";
                    attend.Remark = "";
                    attend.Recorder = "教师";
                    attend.RecorderID = teachBLL.getByUserId(user.Id).Id;
                    attend.StudID = dr["ID"].ToString();
                    attend.CourTableID = courTableID;

                    attenList.Add(attend);
                }
            }

            AspNetPager1.RecordCount = dt.Rows.Count;

            int from = (AspNetPager1.CurrentPageIndex - 1) * AspNetPager1.PageSize + 1;
            int to = from + AspNetPager1.PageSize - 1 > AspNetPager1.RecordCount ? AspNetPager1.RecordCount : from + AspNetPager1.PageSize - 1;

            GridView1.DataSource = PageUtil.resort(PageUtil.getPaged(dt, from, to));
            GridView1.DataBind();

            initStatusAndRemark();
        }
        protected void Button_submit_Click(object sender, EventArgs e)
        {
            AttendanceBLL attendBLL = new AttendanceBLL();

            Attendance attend = new Attendance();

            attend.Status = DropDownList_status.SelectedValue;
            attend.Remark = "";
            attend.Recorder = "教师";
            attend.RecorderID = DropDownList_teacher.SelectedValue;
            attend.StudID = DropDownList_student.SelectedValue;
            attend.CourTableID = Label_courTableId.Text;

            attendBLL.save(attend);

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