/// <summary> /// 新增特殊结算价格数据 /// </summary> /// <param name="data"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public bool InsertDeliverBillCustomerTransportPrice(DeliverBillCustomerTransportPrice data, long nOpStaffId, string strOpStaffName, out string strErrText) { try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (SettlementDAO dao = new SettlementDAO()) { if (!dao.InsertDeliverBillCustomerTransportPrice(data, nOpStaffId, strOpStaffName, out strErrText)) return false; } transScope.Complete(); } return true; } catch (Exception e) { strErrText = e.Message; return false; } }
/// <summary> /// 新增特殊结算价格数据 /// </summary> /// <param name="data"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public bool InsertDeliverBillCustomerTransportPrice(DeliverBillCustomerTransportPrice data, long nOpStaffId, string strOpStaffName, out string strErrText) { //创建存储过程参数 SqlParameter[] Params = { MakeParam(DELIVERBILLID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.DeliverBillId), MakeParam(TRANSPORTPRICE_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.TransportPrice), MakeParam(TRANSPORTCHARGES_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.TransportCharges), MakeParam(REMARK_PARAM, SqlDbType.NVarChar, 100, ParameterDirection.Input, (object)data.Remark??System.DBNull.Value), MakeParam(OPSTAFFID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)nOpStaffId), MakeParam(OPSTAFFNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)strOpStaffName), }; if (Execute("InsertDeliverBillCustomerTransportPrice", Params, out strErrText) >= 0) return true; else return false; }
public ActionResult NewDeliverBillCustomerTransportPrice(DeliverBillCustomerTransportPriceViewModel model) { if (ModelState.IsValid) { //创建数据 DeliverBillCustomerTransportPrice data = new DeliverBillCustomerTransportPrice(); data.Id = 0; data.DeliverBillId = model.DeliverBillId; data.TransportPrice = model.ActualTransportPrice; data.TransportCharges = model.ActualTransportCharges; data.Remark = model.Remark; //保存数据 string strErrText; SettlementSystem settlement = new SettlementSystem(); if (settlement.InsertDeliverBillCustomerTransportPrice(data, LoginAccountId, LoginStaffName, out strErrText)) { return Json(string.Empty); } else { return Json(strErrText); } } return View(model); }