/// <summary> /// 修改数据 /// </summary> /// <param name="Item">model</param> /// <returns></returns> public static bool Update(D_Bill Item) { DataBase db = new DataBase(); DataBaseVisitor visitor = new BillDAL(); bool Flag = false, ReFlag = false; int N = 0; SqlParameter[] prams ={ db.MakeInParam("@BillName", SqlDbType.VarChar,50, Item.BillName), db.MakeInParam("@PrintTitle", SqlDbType.VarChar,50, Item.PrintTitle), db.MakeInParam("@Preview", SqlDbType.Bit,50, Item.Preview), db.MakeInParam("@Id", SqlDbType.BigInt,0,Item.Id) }; try { ReFlag = db.TransactSql(visitor, "Update", prams, out N); } catch (Exception ex) { throw ex; } finally { db.Dispose(); } if (ReFlag && N > 0) { Flag = true; } return Flag; }
//保存 private void Btn_Save_Click(object sender, EventArgs e) { D_Bill BillItem = new D_Bill(); BillItem.Id = Id; BillItem.BillName = this.Cmb_BillName.SelectedValue.ToString(); BillItem.PrintTitle = this.Tb_PrintTitle.Text.Trim(); Ini.IniWriteValue("Bill", "PrintMend", this.Txt_PrintMend.Text.Trim()); BillItem.Preview = this.Cb_Preview.Checked; if (BillItem.BillName == "" || BillItem.PrintTitle == "") { Function.MessageWarning("请把数据填写完整!"); return; } if (BillBLL.Update(BillItem)) { Function.Message("修改成功!"); DataBind(); } }