/// <summary> /// 图书编号信息方法 /// </summary> /// <param name="i">1代表插入数据 2代表修改数据 3代表删除数据 4确认删除数据哈哈</param> /// <param name="bi"></param> /// <returns></returns> public static string sysBookID(int i, Model.BookId bi) { string str = "proc_BookIDSave"; SqlParameter[] Parameter = { new SqlParameter("@num", SqlDbType.Int), new SqlParameter("@ISBN", SqlDbType.NVarChar), new SqlParameter("@BookID", SqlDbType.NVarChar), new SqlParameter("@损坏程度", SqlDbType.NVarChar), new SqlParameter("@备注", SqlDbType.NVarChar), new SqlParameter("@注销日期", SqlDbType.Date), new SqlParameter("@backvalue", SqlDbType.NVarChar, 150), }; Parameter[0].Value = i; Parameter[1].Value = bi.TbISBN; Parameter[2].Value = bi.TbBookID; Parameter[3].Value = bi.CbDamage; Parameter[4].Value = bi.TbBookIdMemo; Parameter[5].Value = bi.DtpLogoutDate; Parameter[6].Direction = ParameterDirection.Output; SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, str, Parameter); return(Convert.ToString(Parameter[6].Value.ToString())); }
//修改保存 private void btOk_Click(object sender, EventArgs e) { try { #region 修改传值 Model.BookId bi = new Model.BookId(); bi.TbBookID = this.tbBookID.Text; bi.TbISBN = this.tbISBN.Text; bi.CbDamage = this.cbDamage.Text; bi.TbBookIdMemo = this.tbBookIdMemo.Text; #endregion string a = BLL.BookIdBLL.sysBookID(2, bi); if (a == "修改成功!") { MessageBox.Show(a, "提示"); this.Close();//关闭当前窗体 Bookidevent(null); } else { MessageBox.Show(a, "提示"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public event Bookiddelegate Bookidevent; //声明委托事件 public frmUpdateBookID(Model.BookId bi) { InitializeComponent(); #region 显示要修改的值 this.tbBookID.Text = bi.TbBookID; this.tbISBN.Text = bi.TbISBN; this.cbDamage.Text = bi.CbDamage; this.tbBookIdMemo.Text = bi.TbBookIdMemo; #endregion }
//选中确定 private void btnReadOK_Click(object sender, EventArgs e) { if (this.Text == "注销列表选择") { Model.BookId bi = new Model.BookId(); bi.TbBookID = dataGridViewRead[0, bsID.Position].Value.ToString().Trim(); IDevent(bi.TbBookID); this.Close(); } if (this.Text == "ISBN列表选择") { Model.BookId bi = new Model.BookId(); bi.TbISBN = dataGridViewRead[0, bsISBN.Position].Value.ToString().Trim(); ISBNevent(bi.TbISBN); this.Close(); } if (this.Text == "读者列表选择") { Model.BorrowInfo br = new Model.BorrowInfo(); br.TbBorrowReadId = dataGridViewRead[0, bsRead.Position].Value.ToString().Trim(); Readevent(br.TbBorrowReadId); this.Close(); } if (this.Text == "图书列表选择") { Model.BorrowInfo br = new Model.BorrowInfo(); br.TbBorrowBookId = dataGridViewRead[0, bsBook.Position].Value.ToString().Trim(); //委托事件传值 Bookevent(br.TbBorrowBookId); //选择完成后 关闭当前窗体 this.Close(); } if (this.Text == "图书编号列表选择") { Model.Back bc = new Model.Back(); bc.TbBackBookId = dataGridViewRead[0, bsBookID.Position].Value.ToString().Trim(); bc.CbBackDamage = dataGridViewRead["损坏程度", bsBookID.Position].Value.ToString().Trim(); BookIDevent(bc.TbBackBookId, bc.CbBackDamage); this.Close(); } }