Beispiel #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //try
            //{
            if (formHelper.inputCheck(groupBox1))
            {
                // 获取要插入信息的内容;
                SetPara();

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

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