Пример #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            MemberTypeInfo mti = new MemberTypeInfo();

            mti.MTitle    = txtTitle.Text;
            mti.MDiscount = Convert.ToDecimal(txtDiscount.Text);
            if (!btnSave.Text.Equals("保存"))
            {
                mti.MId = Convert.ToInt32(txtId.Text);
                if (mtiBll.UpdateMTI(mti))
                {
                    LoadList();
                    txtId.Text       = "添加时无编号";
                    txtDiscount.Text = "";
                    txtTitle.Text    = "";
                    btnSave.Text     = "保存";
                }
                else
                {
                    MessageBox.Show("修改失败");
                }
                result = DialogResult.OK;
                return;
            }
            if (mtiBll.AddMTI(mti))
            {
                LoadList();
            }
            else
            {
                MessageBox.Show("添加失败");
            }
            result = DialogResult.OK;
        }