private void BtnUpdate_Click(object sender, EventArgs e) { try { if (!CheckUpdate()) { return; } uType uType = new uType(); uType.UTypeId = Convert.ToInt32(this.tbUserTypeId.Text.Trim()); uType.UserType = this.tbUserTypeUpdate.Text.Trim(); int ret = new uTypeManager().UpdateUserType(uType); if (ret > 0) { MessageBox.Show(UPDATESUCCEED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information); UserTypeDataBind(); } else { MessageBox.Show(UPDATEFAILED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, OPERATIONFAILSED, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void BtnAdd_Click(object sender, EventArgs e) { try { if (!CheckInputNotEmpty()) { return; } uType uType = new uType(); uType.UserType = this.tbUserTypeAdd.Text.Trim(); int ret = new uTypeManager().AddUserType(uType); if (ret > 0) { MessageBox.Show(INSERTSUCCEED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information); UserTypeDataBind(); } else { MessageBox.Show(INSERTFAILED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, OPERATIONFAILSED, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
//读者类别绑定 private void StuTypeBind() { uTypeManager uTypeManager = new uTypeManager(); this.comboStudentType.DataSource = uTypeManager.GetUserData(); this.comboStudentType.DisplayMember = "userType"; }