//保存 protected void btnSubmit_Click(object sender, EventArgs e) { decimal accb = MyCommFun.Obj2Decimal(txtaccountBalance.Text.Trim(), -1); if (accb == -1) { JscriptMsg("余额输入有错误!", "", "Error"); return; } BLL.wx_xjhongbao_base wxpayBll = new wx_xjhongbao_base(); int id = MyCommFun.Obj2Int(hidId.Value, 0); Model.wx_xjhongbao_base baseModel = new Model.wx_xjhongbao_base(); if (id == 0) { //新增 Model.wx_userweixin weixin = GetWeiXinCode(); baseModel.wid = weixin.id; baseModel.createDate = DateTime.Now; baseModel.totalLQMoney = 0; } else { //修改 baseModel = wxpayBll.GetModel(id); } baseModel.accountBalance = (int)(accb * 100); baseModel.remark = txtremark.Value.Trim(); bool ret = false; if (id == 0) { int retNum = wxpayBll.Add(baseModel); if (retNum > 0) { ret = true; } } else { ret = wxpayBll.Update(baseModel); } if (ret) { JscriptMsg("修改信息成功!", "basesetting.aspx", "Success"); } else { JscriptMsg("保存过程中发生错误!", "", "Error"); return; } }
private void AddBaseInfo(int wid) { BLL.wx_xjhongbao_base xjBll = new wx_xjhongbao_base(); Model.wx_xjhongbao_base baseModel = xjBll.GetModelByWid(wid); if (baseModel == null || baseModel.id == 0) { baseModel = new Model.wx_xjhongbao_base(); baseModel.wid = wid; baseModel.createDate = DateTime.Now; baseModel.totalLQMoney = 0; baseModel.accountBalance = 0; baseModel.remark = ""; baseModel.warningInfo = ""; int retNum = xjBll.Add(baseModel); } }