/// <summary> /// 新增客户 /// </summary> /// <param name="data"></param> /// <param name="listTransportPrice"></param> /// <param name="listForceFeePrice"></param> /// <param name="listStorageFeePrice"></param> /// <param name="nOpStaffId">操作员工编码</param> /// <param name="strOpStaffName">操作员工姓名</param> /// <param name="strErrText">出错信息</param> /// <returns>成功返回True,否则返回False</returns> public long InsertCustomer(Customer data, List<CustomerTransportPrice> listTransportPrice, List<CustomerForceFeePrice> listForceFeePrice, List<CustomerStorageFeePrice> listStorageFeePrice, long nOpStaffId, string strOpStaffName, out string strErrText) { long nCustomerId = 0; try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (CustomerDAO dao = new CustomerDAO()) { //新增客户数据 nCustomerId = dao.InsertCustomer(data, nOpStaffId, strOpStaffName, out strErrText); if (nCustomerId <= 0) return 0; //新增客户结算价格数据 foreach (CustomerTransportPrice price in listTransportPrice) { price.CustomerId = nCustomerId; if (!dao.InsertCustomerTransportPrice(price, nOpStaffId, strOpStaffName, out strErrText)) { return 0; } } //新增客户力支费价格数据 foreach (CustomerForceFeePrice price in listForceFeePrice) { price.CustomerId = nCustomerId; if (!dao.InsertCustomerForceFeePrice(price, nOpStaffId, strOpStaffName, out strErrText)) { return 0; } } //新增客户仓储费价格数据 foreach (CustomerStorageFeePrice price in listStorageFeePrice) { price.CustomerId = nCustomerId; if (!dao.InsertCustomerStorageFeePrice(price, nOpStaffId, strOpStaffName, out strErrText)) { return 0; } } } transScope.Complete(); } return nCustomerId; } catch (Exception e) { strErrText = e.Message; return 0; } }