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

            memberTypeInfo.MDiscount = Convert.ToDecimal(txtDiscount.Text);
            memberTypeInfo.MTitle    = txtTitle.Text;
            if (btnSave.Text.Equals("添加"))
            {
                if (MemberTypeInfoBll.Insert(memberTypeInfo))
                {
                    MessageBox.Show("添加成功");
                    LoadList();
                    UpdateList();
                    btnCancel.PerformClick();
                }
                else
                {
                    MessageBox.Show("添加失败,请稍后重试");
                }
            }
            else
            {
                memberTypeInfo.MId = Convert.ToInt32(txtId.Text);
                if (MemberTypeInfoBll.Update(memberTypeInfo))
                {
                    MessageBox.Show("修改成功");
                    LoadList();
                    UpdateList();
                    btnCancel.PerformClick();
                }
                else
                {
                    MessageBox.Show("修改失败");
                }
            }
        }