Пример #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (formHelper.inputCheck(groupBox1))
            {
                SetPara();

                #region  检查要插入的字段是否已存在;
                if (pLogic.PSearchNameModel(productClass.PnId, productClass.PmId))
                {
                    MessageBox.Show("该记录已存在,请从新操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    ClearAction();
                    cbxPKind.Focus();
                    return;
                }
                #endregion

                #region 插入产品信息记录
                if (pLogic.FrmPoeductInsert(productClass))
                {
                    ClearAction();
                    //  MessageBox.Show("新增记录成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    SetDataGridView("", 0);
                }
                else
                {
                    MessageBox.Show("新增记录失败,请从新操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                #endregion
            }
            //try
            //{
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message.ToString());
            //}
            //finally
            //{

            //}
        }