public void AddFee(FillFee fee, BusiLog busiLog) { using (SqlConnection conn = ConnectionPool.BorrowConnection()) { //conn.Open(); SqlTransaction trans = conn.BeginTransaction(); try { SqlHelper.ExecuteNonQuery(trans, CommandType.Text, "update tbMebCompanyPrepay set cnnPrepayFee = cnnPrepayFee+" + fee.cnnFillFee.ToString() + " where cnvcCompanyID='" + fee.cnvcCompanyID.ToString() + "'"); FillFeeAccess.AddFee(trans, fee); BusiLogAccess.AddBusiLog(trans, busiLog); trans.Commit(); } catch (SqlException sex) { trans.Rollback(); throw sex; } catch (Exception ex) { trans.Rollback(); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } } }
public void AddCompany(MebCompanyPrepay company, FillFee fee, BusiLog busiLog) { using (SqlConnection conn = ConnectionPool.BorrowConnection()) { //conn.Open(); SqlTransaction trans = conn.BeginTransaction(); try { MebCompanyPrepayAccess.AddCompany(trans, company); FillFeeAccess.AddFee(trans, fee); BusiLogAccess.AddBusiLog(trans, busiLog); trans.Commit(); } catch (SqlException sex) { trans.Rollback(); throw sex; } catch (Exception ex) { trans.Rollback(); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } } }
private void dgCompany_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { try { string strFillFee = ((TextBox)e.Item.Cells[7].Controls[0]).Text; if (strFillFee.Trim().Length == 0) { Popup("请输入正确充值金额,如:22"); return; } if (!IsNumeric(strFillFee)) { Popup("请输入正确充值金额,如:22"); return; } Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = DateTime.Now; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcComments = "充值:" + e.Item.Cells[1].Text + "|" + strFillFee; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcOperType = "BS012"; busiLog.cnvcSource = "网站"; FillFee fee = new FillFee(); fee.cndOperDate = busiLog.cndOperDate; fee.cnnFillFee = Decimal.Parse(strFillFee); fee.cnnSerial = busiLog.cnnSerial; Guid guidAcctID = new Guid(e.Item.Cells[2].Text); fee.cnvcAcctID = guidAcctID; Guid guidCompanyID = new Guid(e.Item.Cells[0].Text); fee.cnvcCompanyID = guidCompanyID; fee.cnvcCompanyName = e.Item.Cells[1].Text; fee.cnvcDeptID = e.Item.Cells[5].Text; fee.cnvcDeptName = e.Item.Cells[6].Text; fee.cnvcOperName = busiLog.cnvcOperName; PrepayFeeFacade.AddFee(fee, busiLog); this.dgCompany.EditItemIndex = -1; this.BindCompany(); Popup("充值成功!"); } catch (System.Exception ex) { Popup(ex.Message); } }
public static void AddFee(FillFee fee, BusiLog busiLog) { try { BusinessRules.Prepay.PrepayFee prepay = new BusinessRules.Prepay.PrepayFee(); prepay.AddFee(fee, busiLog); } catch (SqlException sex) { LogAdapter.WriteDatabaseException(sex); throw new Exception("数据库访问异常。"); } catch (Exception ex) { LogAdapter.WriteFeaturesException(ex); throw new Exception("业务规则层异常。"); } }
private void AddCompany() { MebCompanyPrepay company = new MebCompanyPrepay(); company.cnnPrepayFee = Decimal.Parse(txtPrepayFee.Text); company.cnvcAcctID = Guid.NewGuid(); company.cnvcCompanyID = Guid.NewGuid(); company.cnvcCompanyName = txtCompanyName.Text; company.cnvcDeptID = ddlDept.SelectedValue; company.cnvcDeptName = ddlDept.SelectedItem.Text; company.cnbValidate = chkValidate.Checked; Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = DateTime.Now; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcComments = "添加单位:" + txtCompanyName.Text; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcOperType = "BS011"; busiLog.cnvcSource = "网站"; FillFee fee = new FillFee(); fee.cndOperDate = busiLog.cndOperDate; fee.cnnFillFee = company.cnnPrepayFee; fee.cnvcAcctID = company.cnvcAcctID; fee.cnvcCompanyID = company.cnvcCompanyID; fee.cnvcCompanyName = company.cnvcCompanyName; fee.cnvcDeptID = company.cnvcDeptID; fee.cnvcDeptName = company.cnvcDeptName; fee.cnnSerial = busiLog.cnnSerial; fee.cnvcOperName = busiLog.cnvcOperName; PrepayFeeFacade.AddCompany(company, fee, busiLog); }
// 这里写你的代码 //充值 public static void AddFee(SqlTransaction trans, FillFee fee) { EntityMapping.Create(fee, trans); }