示例#1
0
        protected void ImageButton_submit_Click(object sender, ImageClickEventArgs e)
        {
            if (check())
            {
                ClassBLL classBLL = new ClassBLL();

                string className = TextBox_className.Text.Trim();
                string depart = DropDownList_depart.SelectedValue.Trim();
                string grade = DropDownList_grade.SelectedValue.Trim();
                string teacherID = DropDownList_teacher.SelectedValue.Trim();

                Class clazz = new Class();
                clazz.Depart = depart;
                clazz.Grade = grade;
                clazz.Name = className;
                clazz.StudCount = "0";
                clazz.MonitorID = null;
                clazz.TeacherID = teacherID;

                classBLL.save(clazz);

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

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

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

            CourseTable ct = ctBLL.get(courTableID);
            Class clazz = classBLL.get(ct.ClassID);

            #region 页面数据绑定
            className.Text = clazz.Name;
            courseName.Text = courBLL.get(ct.CourId).Name;
            teacherName.Text = teacherBLL.get(ct.TeachID).Name;
            week.Text = "第" + ct.Week + "周";
            weekDay.Text = ct.WeekDay;
            classtTime.Text = ct.CourseTime;
            classAddress.Text = ct.Place;

            CommonBLL commBLL = new CommonBLL();

            DataTable dt = commBLL.getAbsentStudent(courTableID,false);

            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.getPaged(dt, from, to);
            GridView1.DataBind();
            #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>");
            }
        }
        /// <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 Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ClassBLL classBLL = new ClassBLL();
                CourseBLL courBLL = new CourseBLL();
                TeacherBLL teachBLL = new TeacherBLL();
                //绑定页面查询条件的数据
                DropDownList_class.DataSource = classBLL.getAll();
                DropDownList_class.DataTextField = "name";
                DropDownList_class.DataBind();
                DropDownList_class.Items.Insert(0, "全部班级");

                DropDownList_course.DataSource = courBLL.getAll();
                DropDownList_course.DataTextField = "name";
                DropDownList_course.DataBind();
                DropDownList_course.Items.Insert(0, "全部课程");

                DropDownList_teacher.DataSource = teachBLL.getTeachers();
                DropDownList_teacher.DataTextField = "name";
                DropDownList_teacher.DataBind();
                DropDownList_teacher.Items.Insert(0, "全部教师");

                bind();
            }
        }
示例#6
0
        protected void ImageButton_submit_Click(object sender, ImageClickEventArgs e)
        {
            if (check())
            {
                ClassBLL classBLL = new ClassBLL();
                StudentBLL stuBLL = new StudentBLL();
                UserBLL userBLL = new UserBLL();

                string stuId = TextBox_stuId.Text.Trim();
                string name = TextBox_name.Text.Trim();
                string gender = RadioButton_male.Checked ? "男" : "女";
                string birth = DropDownList_yearPart1.SelectedValue + DropDownList_yearPart2.SelectedValue + DropDownList_yearPart3.SelectedValue + DropDownList_yearPart4.SelectedValue;
                birth += DropDownList_month.SelectedValue;
                string phone = TextBox_phone.Text.Trim();
                string address = TextBox_address.Text.Trim();
                string classID = DropDownList_class.SelectedValue;

                if (stuBLL.getByStuId(stuId) == null)
                {
                    if (userBLL.getByUsername(stuId) == null)
                    {
                        #region 在用户表中创建新用户
                        User user = new User();
                        user.UserName = stuId;
                        user.Password = EncryptUtil.MD5Encrypt("12345678");
                        user.Type = "4";
                        userBLL.save(user);
                        #endregion

                        Class clazz = classBLL.get(classID);
                        clazz.StudCount = (Convert.ToInt32(clazz.StudCount) + 1).ToString();
                        classBLL.update(clazz);

                        Student stu = new Student();
                        stu.StuId = stuId;
                        stu.Name = name;
                        stu.Gender = gender;
                        stu.Birth = birth;
                        stu.Phone = phone;
                        stu.Address = address;
                        stu.ClassID = classID;
                        stu.UserID = userBLL.getByUsername(stuId).Id;

                        stuBLL.save(stu);
                        Response.Write("<script>alert('添加成功!');location.href='addStudent.aspx';</script>");
                    }
                    else
                        Response.Write("<script>alert('添加失败,用户名已存在!');location.href='addStudent.aspx';</script>");
                }
                else
                {
                    checkStuId.ErrorMessage = "学号已存在!";
                    checkStuId.IsValid = false;
                }

            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ClassBLL classBLL = new ClassBLL();
         //绑定页面查询条件的数据
         DropDownList_class.DataSource = classBLL.getAll();
         DropDownList_class.DataTextField = "name";
         DropDownList_class.DataBind();
         DropDownList_class.Items.Insert(0, "全院");
         bind();
     }
 }
示例#8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ClassBLL classBLL = new ClassBLL();

                DropDownList_class.DataSource = classBLL.getAll();
                DropDownList_class.DataTextField = "name";
                DropDownList_class.DataValueField = "ID";
                DropDownList_class.DataBind();
                bind();
            }
        }
示例#9
0
        protected void ImageButton_delete_Click(object sender, ImageClickEventArgs e)
        {
            ImageButton imageButton = sender as ImageButton;

            string id = imageButton.CommandArgument;

            Class clazz = new Class();
            clazz.Id = id;

            ClassBLL classBLL = new ClassBLL();
            classBLL.delete(clazz);

            Response.Write("<script>alert('删除成功!');location.href='showClasses.aspx';</script>");
        }
示例#10
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();
        }
示例#11
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            #region //
            //ClassBLL objClass1BLL = new ClassBLL();
            //ClassModel objClass = new ClassModel();
            //objClass.ClaNum = txtbClassNum.Text;
            //objClass.ClaName = txtbClass.Text;
            //objClass.DeptNum = txtbDeptNum.Text;
            //objClass.ProNum = txtbcmbProNum.Text;

            //if (objClass1BLL.AddClass(objClass) == true)
            //    MessageBox.Show("数据添加成功");
            //else
            //    MessageBox.Show("数据添加成功");
            //dgvClass.DataSource = objClass1BLL.ShowClass();
            #endregion

            #region 使用实体类在各层传递数据:

            if (cmbClaNum.Text == "" || cmbClaName.Text == "")
            {
                MessageBox.Show("班号、班名都不能为空!\n 请重新输入!");
            }
            else
            {
                ClassBLL objClassBLL = new ClassBLL();

                ClassModel objClassModel = new ClassModel();

                objClassModel.ClaNum = cmbClaNum.Text;
                objClassModel.ClaName = cmbClaName.Text;
                objClassModel.DeptNum = cmbDeptNum.Text;
                objClassModel.DeptName = cmbDeptName.Text;
                objClassModel.ProNum = cmbProNum.Text;
                //objClassModel.ProName = cmbProName.Text;

                if (objClassBLL.AddClass(objClassModel)==true)
                {
                    MessageBox.Show("添加成功!");
                }
                else
                    MessageBox.Show("添加失败!");
            }
            #endregion

            ShowClass();
        }
示例#12
0
        /// <summary>
        /// 绑定数据源
        /// </summary>
        private void bind()
        {
            string classId = Request.QueryString["classID"];

            ClassBLL classBLL = new ClassBLL();
            CommonBLL commBLL = new CommonBLL();

            Label_className.Text = classBLL.get(classId).Name;

            DataTable dt = commBLL.getWeekAverageAttendaceRateByClassID(classId, false);

            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.getPaged(dt, from, to);
            GridView1.DataBind();
        }
示例#13
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            #region 使用实体类在各层传递数据
            ClassBLL objClass1BLL = new ClassBLL();
            ClassModel objClassModel = new ClassModel();

            objClassModel.ClaNum = cmbClaNum.Text;

            if (objClass1BLL.DeleteClass(objClassModel) == true)
            {
                objClass1BLL.DeleteClass(objClassModel);
                MessageBox.Show("数据删除成功");

            }
            else
            {
                MessageBox.Show("数据删除失败");
            }
            #endregion

            ShowClass();
        }
示例#14
0
        protected void ImageButton_delete_Click(object sender, ImageClickEventArgs e)
        {
            ImageButton imageButton = sender as ImageButton;

            string id = imageButton.CommandArgument;

            ClassBLL classBLL = new ClassBLL();
            StudentBLL stuBLL = new StudentBLL();
            UserBLL userBLL = new UserBLL();

            Student stu = stuBLL.get(id);
            User user = userBLL.get(stu.UserID);

            stuBLL.delete(stu);
            userBLL.delete(user);

            Class clazz = classBLL.get(stu.ClassID);
            clazz.StudCount = (Convert.ToInt32(clazz.StudCount) - 1).ToString();
            classBLL.update(clazz);

            Response.Write("<script>alert('删除成功!');location.href='showStudents.aspx';</script>");
        }
示例#15
0
        public void bind()
        {
            List<Attendance> attenList = Session["attenList"] as List<Attendance>;

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

            CourseTable ct = ctBLL.get(attenList[0].CourTableID);
            Class clazz = classBLL.get(ct.ClassID);

            #region 页面数据绑定
            className.Text = clazz.Name;
            courseName.Text = courBLL.get(ct.CourId).Name;
            teacherName.Text = teachBll.get(ct.TeachID).Name;
            week.Text = "第" + ct.Week + "周";
            weekDay.Text = ct.WeekDay;
            classtTime.Text = ct.CourseTime;
            classAddress.Text = ct.Place;

            lateNumber.Text = attenList.Where(x => x.Status.Equals("迟到")).ToList().Count.ToString();
            absences.Text = attenList.Where(x => !x.Status.Equals("正常")).ToList().Count.ToString();
            allNumber.Text = clazz.StudCount;
            attRate.Text = FormatUtil.doubleToPercent(attenList.Where(x => x.Status.Equals("正常")).ToList().Count / Convert.ToDouble(clazz.StudCount));

            DataTable dt = transferListToDataTable(attenList);

            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();
            #endregion
        }
        public void bind()
        {
            User user = (User)Session["user"];

            ClassBLL classBLL = new ClassBLL();
            StudentBLL studBll = new StudentBLL();
            Student stud = studBll.getByUserId(user.Id);

            Class clazz = classBLL.get(stud.ClassID);

            className.Text = clazz.Name;

            CommonBLL commBLL = new CommonBLL();

            DataTable dt = commBLL.getClassStudentAttendStatistics(clazz.Id, stud.Id, false);

            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.getPaged(dt, from, to);
            GridView1.DataBind();
        }
示例#17
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            #region 使用实体类在三层中传递数据
            ClassBLL objClass1BLL = new ClassBLL();
            ClassModel objClassModel = new ClassModel();

            DataBaseOperaClass objDataBase = new DataBaseOperaClass();

            objClassModel.ClaNum = cmbClaNum.Text;
            dgvClass.DataSource = objClass1BLL.SearchClass(objClassModel);
            #endregion
            ShowClass();
        }
示例#18
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            #region //
            //ClassBLL objClass1BLL = new ClassBLL();
            //ClassModel objClass = new ClassModel();
            ////objClass.ClaNum = dgvClass[0, dgvClass.CurrentRow.Index].Value.ToString();
            //objClass.ClaNum = txtClassNum.Text;
            //objClass.ClaName = txtClassName.Text;
            //objClass.DeptNum = cmbDeptNum.Text;
            //objClass.ProNum = cmbProNum.Text;
            //if (objClass1BLL.ChangeClass(objClass) == true)
            //    MessageBox.Show("数据修改成功");
            //else
            //    MessageBox.Show("数据修改失败");

            //dgvClass.DataSource = objClass1BLL.ShowClass();
            #endregion

            #region 使用实体类在各层传递数据
            //if (txtStuNum.Text == "")
            if (cmbClaNum.Text == "" || cmbClaName.Text == "")
            {
                MessageBox.Show("班号、班名不能为空!\n 请重新输入!");
            }
            else
            {

                ClassBLL objClassBLL = new ClassBLL();

                ClassModel objClassModel = new ClassModel();

                objClassModel.ClaName = cmbClaName.Text;
                objClassModel.ClaNum = cmbClaNum.Text;
                objClassModel.DeptNum = cmbDeptNum.Text;
                objClassModel.ProNum = cmbProNum.Text;

                if(objClassBLL.ChangeClass(objClassModel)==true)
                {
                    MessageBox.Show("修改成功!");
                }
                else
                    MessageBox.Show("修改失败!");
            }
            #endregion

            ShowClass();
        }
示例#19
0
 private void ShowClass()
 {
     ClassBLL objClass1BLL = new ClassBLL();
     dgvClass.DataSource = objClass1BLL.ShowClass();
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CourseTableBLL ctBLL = new CourseTableBLL();
                ClassBLL classBLL = new ClassBLL();
                CourseBLL courBLL = new CourseBLL();
                TeacherBLL teachBLL = new TeacherBLL();

                DropDownList_class.DataSource = classBLL.getAll();
                DropDownList_class.DataTextField = "name";
                DropDownList_class.DataValueField = "ID";
                DropDownList_class.DataBind();

                DropDownList_course.DataSource = courBLL.getByClassId(DropDownList_class.SelectedValue);
                DropDownList_course.DataTextField = "name";
                DropDownList_course.DataValueField = "ID";
                DropDownList_course.DataBind();

                string filterTeacher = "classID='" + DropDownList_class.SelectedValue + "' and courId='" + DropDownList_course.SelectedValue + "'";
                DataTable tempDt = PageUtil.getProcessedDataTable(ctBLL.getAll().Tables[0], filterTeacher, null, false);

                DataView dv = tempDt.DefaultView;
                tempDt = dv.ToTable(true, "teachID");
                foreach (DataRow dr in tempDt.Rows)
                {
                    Teacher teacher = teachBLL.get(dr["teachID"].ToString());
                    DropDownList_teacher.Items.Add(new ListItem(teacher.Name, teacher.Id));
                }

                bind();
            }
        }
示例#21
0
        /// <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
        }
示例#22
0
        /// <summary>
        /// 绑定数据源
        /// </summary>
        private void bind()
        {
            CourseBLL courBLL = new CourseBLL();
            TeacherBLL teacherBLL = new TeacherBLL();
            ClassBLL classBLL = new ClassBLL();

            //绑定 "课程名称" 数据源
            DropDownList_course.DataSource = courBLL.getAll();
            DropDownList_course.DataTextField = "name";
            DropDownList_course.DataValueField = "ID";
            DropDownList_course.DataBind();

            //绑定 "任课老师" 数据源
            DropDownList_teacher.DataSource = teacherBLL.getTeachers();
            DropDownList_teacher.DataTextField = "name";
            DropDownList_teacher.DataValueField = "ID";
            DropDownList_teacher.DataBind();

            //绑定 "班级名称" 数据源
            DropDownList_class.DataSource = classBLL.getAll();
            DropDownList_class.DataTextField = "name";
            DropDownList_class.DataValueField = "ID";
            DropDownList_class.DataBind();
        }