Пример #1
0
        private void AddCourseInfoForm_Load(object sender, EventArgs e)
        {
            //绑定班级
            DataSet ds_Class = new BLL.tbClassInfo().GetAllList();

            this.cboxClassId.DataSource    = ds_Class.Tables[0];
            this.cboxClassId.DisplayMember = "ClassName";
            this.cboxClassId.ValueMember   = "ClassId";

            //如果是修改,则绑定数据
            if (this.FS == FormStatus.Update)
            {
                Model.tbCourseInfo model = new BLL.tbCourseInfo().GetModel(this.CourseId);
                if (model != null)
                {
                    this.txtCourseId.Text          = model.CourseId.ToString();
                    this.txtCourseName.Text        = model.CourseName;
                    this.cboxClassId.SelectedValue = model.ClassId;
                    this.cboxSemester.Text         = model.Semester;
                }
                else
                {
                    MessageBox.Show("该条记录不存在,请确认");
                    this.Close();
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 窗体加载
        /// </summary>
        private void AddStudentInfoForm_Load(object sender, EventArgs e)
        {
            //绑定班级下拉框
            DataSet ds_Class = new BLL.tbClassInfo().GetAllList();

            this.cboxClassId.DataSource    = ds_Class.Tables[0];
            this.cboxClassId.DisplayMember = "ClassName";
            this.cboxClassId.ValueMember   = "ClassId";
            if (this.FS == FormStatus.Update)
            {
                Model.tbStudentInfo model = new BLL.tbStudentInfo().GetModel(this.StuNo);
                if (model != null)
                {
                    this.txtStuId.Text             = model.StuId.ToString();
                    this.txtStuNo.Text             = model.StuNo;
                    this.txtStuName.Text           = model.StuName;
                    this.cboxStuSex.Text           = model.StuSex;
                    this.cboxStuNation.Text        = model.StuNation;
                    this.txtStupolitics.Text       = model.Stupolitics;
                    this.txtStuContact.Text        = model.StuContact;
                    this.txtStuPostCode.Text       = model.StuPostCode;
                    this.txtStuFamilyAddress.Text  = model.StuFamilyAddress;
                    this.cboxClassId.SelectedValue = model.ClassId;
                    if (model.StuPhoto != null && model.StuPhoto.Length > 0)
                    {
                        this.picBoxStuPhoto.Image = Image.FromStream(new System.IO.MemoryStream(model.StuPhoto));
                    }
                }
                else
                {
                    MessageBox.Show("未找到相关数据,请确认");
                    this.Close();
                }
            }
        }
Пример #3
0
        //加载
        private void AddClass_Load(object sender, EventArgs e)
        {
            //绑定专业下拉框
            DataSet ds_Specialty = new BLL.tbSpecialtyInfo().GetAllList();

            this.cboxSpecialty.DataSource    = ds_Specialty.Tables[0];
            this.cboxSpecialty.DisplayMember = "SpecialtyName";
            this.cboxSpecialty.ValueMember   = "SpecialtyId";

            //加载数据
            if (this.FS == FormStatus.Update)
            {
                Model.tbClassInfo model = new BLL.tbClassInfo().GetModel(this.ClassId);
                if (model != null)
                {
                    this.txtClassId.Text             = model.ClassId.ToString();
                    this.txtClassName.Text           = model.ClassName;
                    this.cboxSpecialty.SelectedValue = model.SpecialtyId.ToString();
                    this.txtClassroomId.Text         = model.classroomId;
                    this.txteductionalSystem.Text    = model.eductionalSystem;
                    this.TimePickerEnterTime.Value   = model.enterTime;
                    this.txtMarks.Text = model.Marks;
                }
                else
                {
                    MessageBox.Show("未找到相关数据,请确认");
                }
            }
        }
Пример #4
0
        //查询
        private void btnQuery_Click(object sender, EventArgs e)
        {
            string strWhere = " 1=1 ";

            if (!string.IsNullOrEmpty(this.txtClassName.Text.Trim()))
            {
                strWhere += " and ClassName like '%" + this.txtClassName.Text.Trim() + "%'";
            }
            if (this.cboxSpeicalty.SelectedValue.ToString() != "0")
            {
                strWhere += " and SpecialtyId ='" + this.cboxSpeicalty.SelectedValue.ToString() + "'";
            }
            DataSet ds = new BLL.tbClassInfo().GetListByClassInfoView(strWhere);

            this.myDataGridView1.DataSource = ds.Tables[0];
        }
Пример #5
0
        //加载
        private void ClassForm_Load(object sender, EventArgs e)
        {
            //绑定专业 下拉框
            DataSet ds_Specialty = new BLL.tbSpecialtyInfo().GetAllList();
            DataRow dr           = ds_Specialty.Tables[0].NewRow();

            dr["SpecialtyId"]   = 0;
            dr["SpecialtyName"] = "--请选择--";
            ds_Specialty.Tables[0].Rows.InsertAt(dr, 0);
            this.cboxSpeicalty.DataSource    = ds_Specialty.Tables[0];
            this.cboxSpeicalty.ValueMember   = "SpecialtyId";
            this.cboxSpeicalty.DisplayMember = "SpecialtyName";

            DataSet ds = new BLL.tbClassInfo().GetListByClassInfoView("");

            this.myDataGridView1.DataSource = ds.Tables[0];
        }
Пример #6
0
        //保存
        private void btnOK_Click(object sender, EventArgs e)
        {
            bool flag = Common.FormHelp.CheckTextBox(this.panel1.Controls, this.txtClassId, this.txtMarks);

            if (!flag)
            {
                MessageBox.Show("请将信息输入完整");
                return;
            }
            Model.tbClassInfo model = new Model.tbClassInfo();
            model.ClassName        = this.txtClassName.Text.Trim();
            model.SpecialtyId      = int.Parse(this.cboxSpecialty.SelectedValue.ToString());
            model.classroomId      = this.txtClassroomId.Text.Trim();
            model.eductionalSystem = this.txteductionalSystem.Text.Trim();
            model.enterTime        = this.TimePickerEnterTime.Value.Date;
            model.Marks            = this.txtMarks.Text.Trim();
            bool SaveStatus = false;

            try
            {
                if (this.FS == FormStatus.Add)   //新增
                {
                    int id = new BLL.tbClassInfo().Add(model);
                    this.txtClassId.Text = id.ToString();
                    SaveStatus           = true;
                }
                else if (this.FS == FormStatus.Update) //修改
                {
                    model.ClassId = int.Parse(this.txtClassId.Text.Trim());
                    SaveStatus    = new BLL.tbClassInfo().Update(model);
                }
                if (SaveStatus)
                {
                    MessageBox.Show("保存成功");
                    this.FS = FormStatus.Update;
                }
                else
                {
                    MessageBox.Show("保存失败,请重试或联系管理员");
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }