/// <summary> /// 新增发票数据 /// </summary> /// <param name="data"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public long InsertCustomerTransportChargesSettlement(CustomerTransportChargesSettlement data, long nOpStaffId, string strOpStaffName, out string strErrText) { //创建存储过程参数 SqlParameter[] Params = { MakeParam(ID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Output, (object)data.Id), MakeParam(INVOICENO_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.InvoiceNo), MakeParam(CUSTOMERID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.CustomerId), MakeParam(CUSTOMERNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)data.CustomerName), MakeParam(INVOICETYPE_PARAM, SqlDbType.NVarChar, 10, ParameterDirection.Input, (object)data.InvoiceType), MakeParam(INVOICEAMOUNT_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.InvoiceAmount), 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), }; SqlParameterCollection outParams; if (Execute("InsertCustomerTransportChargesSettlement", Params, out outParams, out strErrText) < 0) { return(0); } else { return((long)outParams[ID_PARAM].Value); } }
/// <summary> /// 新增发票 /// </summary> /// <param name="data"></param> /// <param name="listDetail"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public long InsertCustomerTransportChargesSettlement(CustomerTransportChargesSettlement data, List <CustomerTransportChargesSettlementDetail> listDetail, long nOpStaffId, string strOpStaffName, out string strErrText) { long nCustomerTransportChargesSettlementId = 0; try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (SettlementDAO dao = new SettlementDAO()) { //新增发票数据 nCustomerTransportChargesSettlementId = dao.InsertCustomerTransportChargesSettlement(data, nOpStaffId, strOpStaffName, out strErrText); if (nCustomerTransportChargesSettlementId <= 0) { return(0); } //新增发票明细数据 foreach (CustomerTransportChargesSettlementDetail detail in listDetail) { detail.CustomerTransportChargesSettlementId = nCustomerTransportChargesSettlementId; if (!dao.InsertCustomerTransportChargesSettlementDetail(detail, nOpStaffId, strOpStaffName, out strErrText)) { return(0); } } } transScope.Complete(); } return(nCustomerTransportChargesSettlementId); } catch (Exception e) { strErrText = e.Message; return(0); } }
/// <summary> /// 新增发票 /// </summary> /// <param name="data"></param> /// <param name="listDetail"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public long InsertCustomerTransportChargesSettlement(CustomerTransportChargesSettlement data, List <CustomerTransportChargesSettlementDetail> listDetail, long nOpStaffId, string strOpStaffName, out string strErrText) { SettlementRule rule = new SettlementRule(); return(rule.InsertCustomerTransportChargesSettlement(data, listDetail, nOpStaffId, strOpStaffName, out strErrText)); }