예제 #1
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            //验证类别名称

            if (txtName.Text.Trim() == "")
            {
                MessageBoxEx.Show("请输入商品类别名称!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtName.Focus();
                return;
            }



            Dong.BLL.Category   bll   = new Dong.BLL.Category();
            Dong.Model.Category model = new Dong.Model.Category();
            model.Name = txtName.Text;
            model.Id   = int.Parse(this.Tag.ToString());
            if (bll.Update(model))
            {
                MessageBoxEx.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                frmCategory fvip = (frmCategory)this.Owner;
                fvip.refreshData();
                this.Close();
            }
            else
            {
                MessageBoxEx.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            //验证单位名称

            if (txtName.Text.Trim() == "")
            {
                MessageBoxEx.Show("请输入商品类别!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtName.Focus();
                return;
            }



            Dong.BLL.Category   bll   = new Dong.BLL.Category();
            Dong.Model.Category model = new Dong.Model.Category();
            model.Name = txtName.Text;

            if (bll.Add(model))
            {
                MessageBoxEx.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                frmCategory frm = (frmCategory)this.Owner;
                frm.refreshData();
                this.Close();
            }
            else
            {
                MessageBoxEx.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }