コード例 #1
0
        //修改按钮
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            //封装专业信息
            Speciality objSpeciality = new Speciality()
            {
                CollageName    = txtCollageName.Text.Trim(),
                SpecialityName = txtSpecialityName.Text.Trim(),
                Remark         = txtSpecialityRemakr.Text.Trim()
            };

            //提交对象
            //判断是否保存成功
            try
            {
                int result = objSpecialityService.UpdateSpeciality(objSpeciality);
                if (result == 1)
                {
                    MessageBox.Show("专业信息修改成功!", "修改提示");
                    this.DialogResult = DialogResult.OK;
                    this.txtSpecialityRemakr.Focus();
                }
                else
                {
                    MessageBox.Show("专业信息修改失败", "添加提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
ファイル: Form7.cs プロジェクト: IvanSlizhyk/StudentProject
        private void btn_update_Click(object sender, EventArgs e)
        {
            var specialityService = new SpecialityService(_unit, _unit);
            var speciality        = specialityService.GetSpecialityById(_entityId);

            speciality.Name       = NameText;
            speciality.TermNumber = TermNumberText;
            specialityService.SetFormEducationOfSpeciality((FormEducation)comboBox1.SelectedItem, speciality);
            specialityService.UpdateSpeciality(speciality);
            _unit.Commit();
            _context.Dispose();
            this.Close();
        }
コード例 #3
0
        //修改按钮
        private void btnUpdate_Click_1(object sender, EventArgs e)
        {
            //判断信息是否为空

            if (combSpecialityName.SelectedIndex == -1)
            {
                MessageBox.Show("不能修改专业名称!", "信息提示");
                this.combSpecialityName.Focus();
                return;
            }

            //封装学院信息
            Speciality objSpeciality = new Speciality()
            {
                SpecialityName = combSpecialityName.Text.Trim(),
                Remark         = txtSpecialityRemakr.Text.Trim()
            };

            //提交对象
            //判断是否保存成功
            try
            {
                int result = objSpecialityService.UpdateSpeciality(objSpeciality);
                if (result == 1)
                {
                    MessageBox.Show("专业信息修改成功!", "修改提示");
                    this.DialogResult = DialogResult.OK;
                    this.combSpecialityName.Focus();
                }
                else
                {
                    MessageBox.Show("专业信息修改失败", "修改提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }