private void BtnAdd_Click(object sender, EventArgs e) { try { if (!CheckInputNotEmpty()) { return; } bType bType = new bType(); bType.BookType = this.tbBookTypeAdd.Text.Trim(); int ret = new bTypeManager().AddBookType(bType); if (ret > 0) { BookTypeDataBind(); MessageBox.Show(INSERTSUCCEED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(INSERTFAILED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, OPERATIONFAILSED, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
//单击修改事件 private void BtnUpdate_Click(object sender, EventArgs e) { try { if (!CheckUpdate()) { return; } bType bType = new bType(); bType.BTypeId = Convert.ToInt32(this.tbBookTypeId.Text.Trim()); bType.BookType = this.tbBookTypeUpdate.Text.Trim(); int ret = new bTypeManager().UpdateBookType(bType); if (ret > 0) { BookTypeDataBind(); MessageBox.Show(UPDATESUCCEED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(UPDATEFAILED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, OPERATIONFAILSED, MessageBoxButtons.OK, MessageBoxIcon.Information); } }