private void tsbCancel_Click(object sender, EventArgs e) { txtID.Text = String.Empty; CtrlHelper.DisableTextBox(txtID); txtName.Text = String.Empty; CtrlHelper.DisableTextBox(txtName); tsbAdd.Enabled = true; tsbEdit.Enabled = true; fState = FormState.List; }
private void tsbSave_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(iParas.Title)) { if ((fState == FormState.Edit) && (String.IsNullOrEmpty(txtID.Text))) { MessageBox.Show(iParas.DisplayName + "编号不能为空!", PublicConsts.PC_Tip); return; } if (String.IsNullOrEmpty(txtName.Text)) { MessageBox.Show(iParas.DisplayName + "名称不能为空!", PublicConsts.PC_Tip); return; } iParas.NameValue = txtName.Text; if ((!iParas.IsIdentity) || (fState == FormState.Edit)) { iParas.IdValue = txtID.Text; } try { if (fState == FormState.New) { iParas.Add(); tsbAdd.Enabled = true; } else { iParas.Edit(); tsbEdit.Enabled = true; } } catch (Exception ex) { MessageBox.Show("系统错误:" + ex.Message, PublicConsts.PC_Tip); return; } txtID.Text = String.Empty; CtrlHelper.DisableTextBox(txtID); txtName.Text = String.Empty; CtrlHelper.DisableTextBox(txtName); tsbSave.Enabled = false; tsbCancel.Enabled = false; fState = FormState.List; OnBindData(); } }
private void BaseParamForm_Load(object sender, EventArgs e) { if (!DesignMode) { OnInitAuth(); } fState = FormState.List; if (!String.IsNullOrEmpty(iParas.Title)) { OnBindData(); } txtID.Text = String.Empty; CtrlHelper.DisableTextBox(txtID); txtName.Text = String.Empty; CtrlHelper.DisableTextBox(txtName); }