private void cbb_Class_SelectedIndexChanged(object sender, EventArgs e)
 {
     BLL.CLASS_INFO   classBll = new BLL.CLASS_INFO();
     Model.CLASS_INFO classMdl = new Model.CLASS_INFO();
     classMdl = classBll.GetModel(this.cbb_Class.Properties.Items[this.cbb_Class.SelectedIndex].ToString());
     init_student(classMdl.CLASSNO);
 }
Esempio n. 2
0
        private void readData()
        {
            if (this._classno > 0)
            {
                BLL.CLASS_INFO   classBll = new BLL.CLASS_INFO();
                Model.CLASS_INFO classMdl = new Model.CLASS_INFO();

                classMdl = classBll.GetModel(_classno);
                if (classMdl == null)   //新增班级功能时
                {
                    blankData();
                }
                else                   //修改班级功能时
                {
                    BLL.MAJORDIRCT_INFO   majordirctBll = new BLL.MAJORDIRCT_INFO();
                    Model.MAJORDIRCT_INFO majordirctMdl = new Model.MAJORDIRCT_INFO();

                    majordirctMdl            = majordirctBll.GetModel((int)classMdl.MAJORDIRCTNO);
                    this.cbb_majordirct.Text = majordirctMdl.MAJORDIRCTNAME;

                    BLL.TEACHER_INFO   teacherBll = new BLL.TEACHER_INFO();
                    Model.TEACHER_INFO teacherMdl = new Model.TEACHER_INFO();
                    teacherMdl               = teacherBll.GetModel((int)classMdl.TEACHERNO1);
                    this.cbb_master.Text     = teacherMdl.NAME;
                    teacherMdl               = teacherBll.GetModel((int)classMdl.TEACHERNO2);
                    this.cbb_instructor.Text = teacherMdl.NAME;
                    teacherMdl               = teacherBll.GetModel((int)classMdl.TEACHERNO3);
                    this.cbb_organizer.Text  = teacherMdl.NAME;

                    this.te_classname.Text = classMdl.CLASSNAME;
                }
            }
        }
        /// <summary>
        /// 初始化所有班级列表
        /// </summary>
        private void init_class()
        {
            Student.BLL.CLASS_INFO classBll = new BLL.CLASS_INFO();
            DataSet ds = classBll.GetAllList();

            this.cbb_Class.Properties.Items.Clear();
            cbb_Class.EditValue           = null;
            cbb_Class.Properties.NullText = "--请选择--";

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                string className = ds.Tables[0].Rows[i]["CLASSNAME"].ToString();
                this.cbb_Class.Properties.Items.Add(className);
            }
            this.cbb_Class.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
        }
Esempio n. 4
0
        /// <summary>
        /// 保存方法
        /// </summary>
        /// <returns></returns>
        private bool saveData()
        {
            try
            {
                BLL.CLASS_INFO   classBll = new BLL.CLASS_INFO();
                Model.CLASS_INFO classMdl = new Model.CLASS_INFO();

                BLL.TEACHER_INFO   teacherBll = new BLL.TEACHER_INFO();
                Model.TEACHER_INFO teacherMdl = new Model.TEACHER_INFO();

                BLL.MAJORDIRCT_INFO   majordirctBll = new BLL.MAJORDIRCT_INFO();
                Model.MAJORDIRCT_INFO majordirctMdl = new Model.MAJORDIRCT_INFO();


                if (this.cbb_majordirct.SelectedIndex == -1)
                {
                    MessageBox.Show("专业方向不能为空!", "提示信息");
                    return(false);
                }

                if (!ToolHelper.IsNumeric(this.te_classname.Text))
                {
                    MessageBox.Show("班级名称必须为数字!", "提示信息");
                    return(false);
                }

                if (this.cbb_instructor.SelectedIndex == -1)
                {
                    MessageBox.Show("辅导员姓名不能为空!", "提示信息");
                    return(false);
                }

                if (this.cbb_organizer.SelectedIndex == -1)
                {
                    MessageBox.Show("组织员姓名不能为空!", "提示信息");
                    return(false);
                }

                if (this.cbb_master.SelectedIndex == -1)
                {
                    MessageBox.Show("班主任姓名不能为空!", "提示信息");
                    return(false);
                }

                if (this.te_classname.Text == "")
                {
                    MessageBox.Show("班级名称不能为空!", "提示信息");
                    return(false);
                }

                //取得专业编号
                majordirctMdl         = majordirctBll.GetModel(this.cbb_majordirct.Text);
                classMdl.MAJORDIRCTNO = majordirctMdl.MAJORDIRCTNO;
                //取得班主任编号
                teacherMdl          = teacherBll.GetModel(this.cbb_master.Text);
                classMdl.TEACHERNO1 = teacherMdl.TEACHERNO;
                //取得辅导员编号
                teacherMdl          = teacherBll.GetModel(this.cbb_instructor.Text);
                classMdl.TEACHERNO2 = teacherMdl.TEACHERNO;
                //取得组织员编号
                teacherMdl          = teacherBll.GetModel(this.cbb_organizer.Text);
                classMdl.TEACHERNO3 = teacherMdl.TEACHERNO;

                classMdl.CLASSNAME = te_classname.Text;

                if (this._enumStatus == StatusClass.AddNew)  //新增班级
                {
                    if (classBll.Exists(te_classname.Text))
                    {
                        MessageBox.Show("当前班级名称已经存在,请核查!", "提示信息");
                        return(false);
                    }
                    classBll.Add(classMdl);
                    return(true);
                }
                else if (this._enumStatus == StatusClass.Edit)  //修改班级
                {
                    classMdl.CLASSNO = _classno;
                    classBll.Update(classMdl);
                    return(true);
                }
                return(true);
            }
            catch (Exception exception)
            {
                MessageBox.Show("保存失败!", exception.Message);
                return(false);
            }
        }
Esempio n. 5
0
        private void readData()
        {
            if (this._stuno.Length > 0)
            {
                BLL.STUDENT_INFO   studentBll = new BLL.STUDENT_INFO();
                Model.STUDENT_INFO studentMdl = new Model.STUDENT_INFO();

                studentMdl = studentBll.GetModel(_stuno, "");
                if (studentMdl == null)   //新增专业功能时
                {
                    init_class();
                    init_dormitory();
                    blankData();
                }
                else                   //修改专业功能时
                {
                    BLL.CLASS_INFO       classBll     = new BLL.CLASS_INFO();
                    Model.CLASS_INFO     classMdl     = new Model.CLASS_INFO();
                    BLL.DORMITORY_INFO   dormitoryBll = new BLL.DORMITORY_INFO();
                    Model.DORMITORY_INFO dormitoryMdl = new Model.DORMITORY_INFO();

                    init_class();
                    init_dormitory();

                    classMdl = classBll.GetModel((int)studentMdl.CLASSNO);
                    this.cbb_classno.Text       = classMdl.CLASSNAME;
                    dormitoryMdl                = dormitoryBll.GetModel((decimal)studentMdl.DORMITORY_ID);
                    this.cbb_plate.Text         = dormitoryMdl.DORMITORY_PLATE;
                    this.te_stuno.Text          = studentMdl.STUNO;
                    this.te_name.Text           = studentMdl.NAME;
                    this.cbb_sex.Text           = studentMdl.SEX;
                    this.cbb_nation.Text        = studentMdl.NATION;
                    this.te_idcard.Text         = studentMdl.IDCARD;
                    this.cbb_political.Text     = studentMdl.POLITICAL;
                    this.cbb_source.Text        = studentMdl.SOURCE;
                    this.te_email.Text          = studentMdl.EMAIL;
                    this.te_zipcode.Text        = studentMdl.ZIPCODE;
                    this.te_familyaddress.Text  = studentMdl.FAMILYADDRESS;
                    this.te_phone.Text          = studentMdl.PHONE;
                    this.te_familyphone.Text    = studentMdl.FAMILYPHONE;
                    this.te_fatherphone.Text    = studentMdl.FATHERPHONE;
                    this.te_motherphone.Text    = studentMdl.MOTHERPHONE;
                    this.te_qqno.Text           = studentMdl.QQNO;
                    this.te_micromessageno.Text = studentMdl.MICROMESSAGENO;
                    if (studentMdl.PICTURE != null)
                    {
                        byte[] b = (byte[])studentMdl.PICTURE;
                        if (b.Length > 0)
                        {
                            MemoryStream stream = new MemoryStream(b, true);
                            stream.Write(b, 0, b.Length);
                            this.pb_picture.Image = new Bitmap(stream);
                            stream.Close();
                        }
                    }
                    else
                    {
                        this.pb_picture.Image = null;
                    }

                    switch (studentMdl.STATUS)
                    {
                    case 1:
                        this.cbb_status.Text = "正常"; break;

                    case 2:
                        this.cbb_status.Text = "休学"; break;

                    case 3:
                        this.cbb_status.Text = "退学"; break;

                    case 4:
                        this.cbb_status.Text = "毕业"; break;
                    }
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 保存方法
        /// </summary>
        /// <returns></returns>
        private bool saveData()
        {
            try
            {
                BLL.CLASS_INFO       classBll     = new BLL.CLASS_INFO();
                Model.CLASS_INFO     classMdl     = new Model.CLASS_INFO();
                BLL.DORMITORY_INFO   dormitoryBll = new BLL.DORMITORY_INFO();
                Model.DORMITORY_INFO dormitoryMdl = new Model.DORMITORY_INFO();
                BLL.STUDENT_INFO     studentBll   = new BLL.STUDENT_INFO();
                Model.STUDENT_INFO   studentMdl   = new Model.STUDENT_INFO();

                if (this.te_stuno.Text == "")
                {
                    MessageBox.Show("学生学号不能为空!", "提示信息");
                    return(false);
                }

                if (!ToolHelper.IsNumeric(this.te_stuno.Text))
                {
                    MessageBox.Show("学生学号必须为数字!", "提示信息");
                    return(false);
                }

                if (this.te_name.Text == "")
                {
                    MessageBox.Show("学生姓名不能为空!", "提示信息");
                    return(false);
                }

                if (this.cbb_classno.SelectedIndex == -1)
                {
                    MessageBox.Show("学生所属班级不能为空!", "提示信息");
                    return(false);
                }

                if (this.cbb_status.SelectedIndex == -1)
                {
                    MessageBox.Show("学生状态不能为空!", "提示信息");
                    return(false);
                }

                if (this.cbb_plate.SelectedIndex == -1)
                {
                    MessageBox.Show("学生宿舍不能为空!", "提示信息");
                    return(false);
                }

                classMdl                  = classBll.GetModel(this.cbb_classno.Properties.Items[this.cbb_classno.SelectedIndex].ToString());
                studentMdl.CLASSNO        = classMdl.CLASSNO;
                dormitoryMdl              = dormitoryBll.GetModel(this.cbb_plate.Properties.Items[this.cbb_plate.SelectedIndex].ToString());
                studentMdl.DORMITORY_ID   = dormitoryMdl.DORMITORY_ID;
                studentMdl.NAME           = te_name.Text;
                studentMdl.STUNO          = this.te_stuno.Text;
                studentMdl.SEX            = this.cbb_sex.Text;
                studentMdl.NATION         = this.cbb_nation.Text;
                studentMdl.POLITICAL      = this.cbb_political.Text;
                studentMdl.SOURCE         = this.cbb_source.Text;
                studentMdl.PHONE          = te_phone.Text;
                studentMdl.FATHERPHONE    = te_fatherphone.Text;
                studentMdl.MOTHERPHONE    = te_motherphone.Text;
                studentMdl.FAMILYPHONE    = te_familyphone.Text;
                studentMdl.FAMILYADDRESS  = te_familyaddress.Text;
                studentMdl.ZIPCODE        = te_zipcode.Text;
                studentMdl.QQNO           = te_qqno.Text;
                studentMdl.MICROMESSAGENO = te_micromessageno.Text;
                if (pb_picture.Image != null)
                {
                    byte[] imageBytes = GetImageBytes(pb_picture.Image);
                    studentMdl.PICTURE = imageBytes;
                }
                switch (this.cbb_status.Properties.Items[this.cbb_status.SelectedIndex].ToString())
                {
                case "正常":
                    studentMdl.STATUS = 1; break;

                case "休学":
                    studentMdl.STATUS = 2; break;

                case "退学":
                    studentMdl.STATUS = 3; break;

                case "毕业":
                    studentMdl.STATUS = 4; break;
                }

                if (this._enumStatus == StatusClass.AddNew)  //新增学生信息
                {
                    if (studentBll.Exists(te_stuno.Text))
                    {
                        MessageBox.Show("当前学生学号已经存在,请核查!", "提示信息");
                        return(false);
                    }

                    studentBll.Add(studentMdl);
                    return(true);
                }
                else if (this._enumStatus == StatusClass.Edit)  //修改姓名
                {
                    studentMdl.STUNO = _stuno;
                    studentBll.Update(studentMdl);
                    return(true);
                }
                return(true);
            }
            catch (Exception exception)
            {
                MessageBox.Show("保存失败!" + exception.Message, exception.Message);
                return(false);
            }
        }