Example #1
0
        private DataTable transferListToDataTable(List <Attendance> attenList)
        {
            StudentBLL stuBLL = new StudentBLL();

            DataTable dt = new DataTable();
            //设置自增长列
            DataColumn colNumber = new DataColumn("ID");

            colNumber.AutoIncrement     = true; //设置是否为自增列
            colNumber.AutoIncrementSeed = 1;    //设置自增初始值
            colNumber.AutoIncrementStep = 1;    //设置每次子增值
            dt.Columns.Add(colNumber);
            dt.Columns.Add("stuName", Type.GetType("System.String"));
            dt.Columns.Add("gender", Type.GetType("System.String"));
            dt.Columns.Add("status", Type.GetType("System.String"));
            dt.Columns.Add("remark", Type.GetType("System.String"));

            foreach (Attendance att in attenList)
            {
                Student stud = stuBLL.get(att.StudID);
                DataRow dr   = dt.NewRow();
                dr[1] = stud.Name;
                dr[2] = stud.Gender;
                dr[3] = att.Status;
                dr[4] = att.Remark;

                dt.Rows.Add(dr);
            }

            return(dt);
        }
Example #2
0
        public HttpResponseMessage GetQRImg(string wxid, string sid)
        {
            var wx = WXManager.Current[wxid];

            if (wx == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }
            var s = new StudentBLL(wx.DBConnect).GetByID(sid).QueryObject;

            if (s == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }
            QrEncoder qrEncoder = new QrEncoder(ErrorCorrectionLevel.H);
            QrCode    qrCode    = new QrCode();
            //var temp = string.Format("{0}{1}", !string.IsNullOrEmpty(s.IDNumber) ? s.IDNumber : s.ID.PadLeft(18, ' '), s.Name);
            //var base64 = Convert.ToBase64String(System.Text.ASCIIEncoding.UTF8.GetBytes(temp));
            var base64 = s.ID;

            qrEncoder.TryEncode(base64, out qrCode);

            var          renderer = new DrawingBrushRenderer(new FixedModuleSize(5, QuietZoneModules.Two));
            MemoryStream ms       = new MemoryStream();

            renderer.WriteToStream(qrCode.Matrix, ImageFormatEnum.JPEG, ms);

            HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);

            result.Content = new ByteArrayContent(ms.ToArray());
            //Inline是直接显示,attachment作为附件下载
            result.Content.Headers.ContentType = new MediaTypeHeaderValue("image/jpg");
            return(result);
        }
        /// <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
        }
Example #4
0
 public Form1()
 {
     InitializeComponent();
     bus = new StudentBLL();
     dataGridView1.DataSource          = bus.GetStudentList();// Can khoi tao laij myAdapter de khi chua load du lieu van insert vao DB duoc
     dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
 }
Example #5
0
        protected void ImageButton_submit_Click(object sender, ImageClickEventArgs e)
        {
            if (check())
            {
                StudentBLL stuBLL = new StudentBLL();

                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;

                stu.Name    = name;
                stu.Gender  = gender;
                stu.Birth   = birth;
                stu.Phone   = phone;
                stu.Address = address;
                stu.ClassID = classID;

                stuBLL.update(stu);

                Response.Write("<script>alert('修改成功!');location.href='showStudents.aspx';</script>");
            }
        }
Example #6
0
        private void  除学生信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("确定要删除该学生吗?同时会删除该学生的成绩!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }
            string StuNo = (this.dgvStudent.CurrentRow.DataBoundItem as Student).StudentNo;

            try
            {
                if (StudentBLL.DelStudentByStuNo(StuNo))
                {
                    MessageBox.Show("删除学生信息成功!", "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ShowStu();
                }
                else
                {
                    MessageBox.Show("删除学生信息失败!", "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("删除学生信息出现异常\n!" + ex.Message, "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #7
0
        protected void New_Click(object sender, EventArgs e)
        {
            Student stu = new Student();

            if (!HeFaXingJianCe())
            {
                HeFa.Text = " 该学号已存在!";
            }
            setInFor(stu);
            Admin a = new Admin();

            a.Id        = Xuehao.Text;
            a.Password  = "******";
            a.Privilege = 0;
            AdminBLL.Add(a);
            bool bo = StudentBLL.Add(stu);

            if (stu.Main)
            {
                Jianche.Text = "录入成功";
            }
            else
            {
                Jianche.Text = bo.ToString();
            }
        }
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     if (txtPayableAmt.Text != "0" || string.IsNullOrEmpty(txtPayableAmt.Text))
     {
         int result = StudentBLL.MakePayment(tempStudentID, float.Parse(txtPayableAmt.Text),
                                             DateTime.Parse(dtpDate.Value.ToString(dateFormat)), StaffId, txtRemark.Text);
         MessageBox.Show(result == 1
                     ? SportRegistrationSystem.lblPaymentSuccess
                     : SportRegistrationSystem.lblPaymentFailed);
         if (result == 1)
         {
             DialogResult dialogResult = MessageBox.Show("Print Receipt?", "Print Receipt Prompt", MessageBoxButtons.YesNo);
             if (dialogResult == DialogResult.Yes)
             {
                 PrintDialog   printDialog   = new PrintDialog();
                 PrintDocument printDocument = new PrintDocument();
                 printDialog.Document     = printDocument;
                 printDocument.PrintPage += CreateReceipt;
                 if (printDialog.ShowDialog() == DialogResult.OK)
                 {
                     printDocument.Print();
                 }
             }
         }
         StudentMenuForm form = new StudentMenuForm(StaffId, passedPermission);
         form.Show();
         this.Close();
     }
     else
     {
         MessageBox.Show(SportRegistrationSystem.lblInvalidValue);
     }
 }
        public StudentPaymentForm(int username, int permission, string studentName)
        {
            InitializeComponent();
            StaffId              = username;
            passedPermission     = permission;
            lblStudentName.Text  = SportRegistrationSystem.lblStudentName;
            lblGrade.Text        = SportRegistrationSystem.lblGrade;
            lblAge.Text          = SportRegistrationSystem.lblAge;
            lblPayableAmt.Text   = SportRegistrationSystem.lblPayableAmt;
            lblDate.Text         = SportRegistrationSystem.lblDate;
            lblLastPaid.Text     = SportRegistrationSystem.lblLastPaid;
            lblRemark.Text       = SportRegistrationSystem.lblRemark;
            dtpDate.CustomFormat = dateFormat;
            dtpDate.Format       = DateTimePickerFormat.Custom;
            btnSubmit.Text       = SportRegistrationSystem.lblSubmit;
            btnCancel.Text       = SportRegistrationSystem.lblCancel;
            DataTable     dt = StudentBLL.LoadStudent(studentName);
            List <string> studentNameList = StudentBLL.GetStudentName(dt);

            foreach (string student in studentNameList)
            {
                cbStudentName.Items.Add(student);
            }
            cbStudentName.SelectedIndex = 0;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            x           = StudentBLL.FindAboutId(Session["stuid"].ToString().Trim());
            Label2.Text = x.Name;

            Count.Text = VacationBLL.Count(a).ToString();
        }
        public string ABC()
        {
            y = StudentBLL.FindAboutId(getId());
            string x = "/HeadSculpture/" + y.Imgurl;

            return(x);
        }
Example #12
0
        private WXResponseMsgBase 查询绑定(string publicWX, WXRequestMsg msg)
        {
            string response = _DefaultResponse;
            var    sid      = new WXBindingBLL(WXManager.Current[publicWX].DBConnect).GetBindingStudentID(msg.FromUserName, msg.ToUserName);

            if (string.IsNullOrEmpty(sid))
            {
                response = "您还没有绑定学号。";
            }
            else
            {
                var s = new StudentBLL(WXManager.Current[publicWX].DBConnect).GetByID(sid).QueryObject;
                if (s == null)
                {
                    response = string.Format("学号:{0}\n{1}", sid, "没有找到学生信息");
                }
                else
                {
                    StringBuilder sb = new StringBuilder();
                    sb.AppendLine(string.Format("学号:{0}", s.ID));
                    sb.AppendLine(string.Format("姓名:{0}", s.Name));
                    if (s.Grade.HasValue)
                    {
                        sb.AppendLine(string.Format("年级:{0}", GradeHelper.Instance.GetName(s.Grade.Value)));
                    }
                    if (!string.IsNullOrEmpty(s.ClassName))
                    {
                        sb.AppendLine(string.Format("班级:{0}", s.ClassName));
                    }
                    response = sb.ToString();
                }
            }
            return(new WXTextResponseMsg(msg.FromUserName, msg.ToUserName, DateTime.Now, response));
        }
Example #13
0
        private void button1_Click(object sender, EventArgs e)
        {
            StudentBLL stbll = new StudentBLL();
            DataTable  Dsst  = stbll.GetAllStudent();

            dtgvSinhvien.DataSource = Dsst;
        }
Example #14
0
        private void bind()
        {
            string id = Request.QueryString["id"].ToString();

            ClassBLL classBLL = new ClassBLL();

            clazz = classBLL.get(id);

            //初始化DropDownList_teacher的绑定值
            TeacherBLL teachBLL = new TeacherBLL();

            DropDownList_teacher.DataSource     = teachBLL.getClassTeachers();
            DropDownList_teacher.DataTextField  = "name";
            DropDownList_teacher.DataValueField = "ID";
            DropDownList_teacher.DataBind();

            //初始化DropDownList_monitor的绑定值
            StudentBLL studBLL = new StudentBLL();

            DropDownList_monitor.DataSource     = studBLL.getByClassId(id);
            DropDownList_monitor.DataTextField  = "name";
            DropDownList_monitor.DataValueField = "ID";
            DropDownList_monitor.DataBind();
            DropDownList_monitor.Items.Insert(0, "无");

            TextBox_className.Text = clazz.Name;
            PageUtil.bindDropDownList(DropDownList_depart, clazz.Depart);
            PageUtil.bindDropDownList(DropDownList_grade, clazz.Grade);
            PageUtil.bindDropDownList(DropDownList_teacher, clazz.TeacherID);
            PageUtil.bindDropDownList(DropDownList_monitor, clazz.MonitorID);
        }
Example #15
0
        /// <summary>
        /// 微信端提交勾班数据
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public JObject Greate(JObject value)
        {
            JObject reslut = new JObject();
            int     signID = value["signID"].Value <int>();

            value.Remove("signID");
            EF.StudentSignInfo info    = new EF.StudentSignInfo();
            var            studentInfo = new StudentBLL().GetCurrentStudent(Request);
            StudentSignBLL bll         = new StudentSignBLL();

            if (studentInfo != null && signID > -1)
            {
                //如果已经保存过了则直接返回
                if (bll.Find(item => item.SignID == signID && item.StudentID == studentInfo.ID).Any())
                {
                    reslut["msg"] = "保存无效,不能再许改!";
                    return(reslut);
                }
                var list = value["list"].ToObject <List <bool> >();
                info.FirstDay_Morning   = list[0];
                info.FirstDay_Afternoon = list[1];
                info.FirstDay_Evening   = list[2];

                info.SecondDay_Morning   = list[3];
                info.SecondDay_Afternoon = list[4];
                info.SecondDay_Evening   = list[5];

                info.ThirdDay_Morning   = list[6];
                info.ThirdDay_Afternoon = list[7];
                info.ThirdDay_Evening   = list[8];

                info.FourthDay_Morning   = list[9];
                info.FourthDay_Afternoon = list[10];
                info.FourthDay_Evening   = list[11];

                info.FifthDay_Morning   = list[12];
                info.FifthDay_Afternoon = list[13];
                info.FifthDay_Evening   = list[14];

                info.SixthDay_Morning   = list[15];
                info.SixthDay_Afternoon = list[16];
                info.SixthDay_Evening   = list[17];

                info.SeventhDay_Morning   = list[18];
                info.SeventhDay_Afternoon = list[19];
                info.SeventhDay_Evening   = list[20];
                info.SignID     = signID;
                info.StudentID  = studentInfo.ID;
                info.CreateTime = DateTime.Now;
                if (bll.Add(info) == 1)
                {
                    reslut["status"] = true;
                    return(reslut);
                }
                reslut["msg"] = "保存出错!";
                return(reslut);
            }
            return(null);
        }
Example #16
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         x = StudentBLL.FindAboutId(getId());
         setStudent(x);
     }
 }
        private void ShowInGridView()
        {
            aStudentBll = new StudentBLL();
            List <Student> students = new List <Student>();

            students = aStudentBll.RetriveData();
            studentGridView.DataSource = students;
        }
Example #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string a = Session["stuid"].ToString().Trim();

            y           = StudentBLL.FindAboutId(a);
            Name.Text   = y.Name;
            xuehao.Text = y.Id;
        }
Example #19
0
        //选择选项卡卡页时发生
        private void tbClassInfo_Selecting(object sender, TabControlCancelEventArgs e)
        {
            //从数据库加载学生数据
            CCWin.SkinControl.SkinDataGridView dgv = tbClassInfo.SelectedTab.Controls[0].Controls[0] as CCWin.SkinControl.SkinDataGridView;   //得到Datagridview
            StudentBLL bll = new StudentBLL();

            dgv.DataSource = bll.GetAllStudentByClassInfoId((int)tbClassInfo.SelectedTab.Tag);
        }
Example #20
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;
                }
            }
        }
Example #21
0
        private void enrollButton_Click(object sender, EventArgs e)
        {
            Student aStudent = new Student(Convert.ToInt16(regNoTextBox.Text), nameTextBox.Text, emailTextBox.Text);

            StudentBLL aStudentBLL = new StudentBLL();
            string     msg         = aStudentBLL.Save(aStudent);

            MessageBox.Show(msg);
        }
        public StudentViewUpdateForm(int username, int permission)
        {
            StaffId          = username;
            passedPermission = permission;
            InitializeComponent();
            DataTable dt = StudentBLL.LoadStudent();

            dataGridView1.DataSource = dt;
            btnBack.Text             = SportRegistrationSystem.lblBack;
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            DataTable dt = (DataTable)dataGridView1.DataSource;

            StudentBLL.UpdateStudentTable(dt);
            StudentMenuForm form = new StudentMenuForm(StaffId, passedPermission);

            form.Show();
            Close();
        }
Example #24
0
 private void btnDel_Click(object sender, EventArgs e)
 {
     StudentBLL objstudentBLLClass = new StudentBLL();
     string StuNum = dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString();
     if (objstudentBLLClass.DeleteStudent(StuNum) == true)
     { MessageBox.Show("数据删除成功"); }
     else
     { MessageBox.Show("数据删除失败"); }
     dataGridView1.DataSource = objstudentBLLClass.ShowStuInfo();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         x = StudentBLL.FindAboutId(getId());
         setStudent(x);
         //Idxuehao.Text = getId().ToString();
         //Yichang.Text = x.ei.ToString();
     }
 }
Example #26
0
        ///EFEntity(即EF实体类)、DAL(调用EF)、BLL(调用DAL)、UI(即MVC,Controller调用BLL)
        ///以上除UI(MVC)以外都是类库项目
        ///1.在DAL层中调用EF,对数据库中的数据操作,查询返回的数据封装在DTO中
        ///2.在BLL层调用DAL,数据也封装在DTO中
        ///3.在UI层,MVC中的Controller调用BLL,获取数据为DTO
        ///4.将DTO数据封装为ViewModel传输到MVC中的View中(此步骤省略,直接使用了DTO作为ViewModel)
        #endregion
        public ActionResult Retrieve2()
        {
            ///添加对BLL和DTO的引用
            StudentBLL stuBLL = new StudentBLL();
            StudentDTO stuDTO = stuBLL.GetById(1);//查询Id=1的学生

            //我们可以在MVC的项目中,添加一个相关的ViewModel,把stuDTO中的数据赋予相关的ViewModel中
            //此处。我们直接使用DTO做ViewModel,因为这个DTO对象满足当前我们需要传输数据的要求
            return(View(stuDTO));
        }
Example #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string y = Session["stuid"].ToString().Trim();

            if (!IsPostBack)
            {
                x = StudentBLL.FindAboutId(getId());
                setStudent(x);
            }
        }
Example #28
0
        public JArray GetStudent()
        {
            var students = new StudentBLL().GetAll().Select(item => new{
                ID   = item.ID,
                Name = item.UserInfo.Name,
            }).ToList();
            var json = JArray.Parse(JsonConvert.SerializeObject(students));

            return(json);
        }
 protected void New_Click(object sender, EventArgs e)
 {
     if (AdminBLL.Delete(name) || StudentBLL.Delete(name))
     {
         Response.Redirect("/WebReturn/UserNew_Return.aspx");
     }
     else
     {
         Response.Redirect("/WebReturn/UserNew_Return0.aspx");
     }
 }
        private void studentSaveButton_Click(object sender, System.EventArgs e)
        {
            aStudent         = new Student();
            aStudent.RegNo   = studentRegNoTextBox.Text;
            aStudent.Email   = emailStudentTextBox.Text;
            aStudent.Address = addressStudentTextBox.Text;

            aStudentBll = new StudentBLL();
            string msg = aStudentBll.Save(aStudent);

            MessageBox.Show(msg);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string y = Session["stuid"].ToString().Trim();

            //  if (!IsPostBack)
            //  {
            x = StudentBLL.FindAboutId(getId());
            setStudent(x);
            Liebiao.DataSource = VacationBLL.VacationGet3(getId());
            Liebiao.DataBind();
            //    }
        }
Example #32
0
 private void btnModify_Click_1(object sender, EventArgs e)
 {
     StudentBLL objstudentBBLClass = new StudentBLL();
     StudentModel objStudentModel = new StudentModel();
     objStudentModel.StuNum = dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString();
     objStudentModel.StuName = txtStuName.Text;
     objStudentModel.StuSex = cbxStuSex.Text;
     objStudentModel.Address = txtAddress.Text;
     if (objstudentBBLClass.UpdateStudent(objStudentModel) == true)
     { MessageBox.Show("数据修改成功"); }
     else
     { MessageBox.Show("数据修改失败"); }
     dataGridView1.DataSource = objstudentBBLClass.ShowStuInfo();
 }
Example #33
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     StudentBLL objstudentBBLClass = new StudentBLL();
     StudentModel objStudentModel = new StudentModel();
     objStudentModel.StuNum = txtStuNum.Text;
     objStudentModel.StuName = txtStuName.Text;
     objStudentModel.StuSex = cbxStuSex.Text;
     objStudentModel.Address = txtAddress.Text;
     objStudentModel.ClaNum = txtClaNum.Text;
     if (objstudentBBLClass.Insertstudent(objStudentModel) == true)
         MessageBox.Show("数据添加成功");
     else
         MessageBox.Show("数据添加失败");
     dataGridView1.DataSource = objstudentBBLClass.ShowStuInfo();
 }
Example #34
0
 private void Form1_Load(object sender, EventArgs e)
 {
     StudentBLL objStudentBLL = new StudentBLL();
     dataGridView1.DataSource = objStudentBLL.ShowStuInfo();
 }