/// <summary> /// 删除收货单位数据 /// </summary> /// <param name="nId"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public bool DeleteReceiver(long nId, long nOpStaffId, string strOpStaffName, out string strErrText) { try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (DDDAO dao = new DDDAO()) { //读取收货单位档案数据 Receiver data = dao.LoadReceiver(nId, nOpStaffId, strOpStaffName, out strErrText); if (data == null) return false; //删除收货单位档案数据 if (!dao.DeleteReceiver(nId, nOpStaffId, strOpStaffName, out strErrText)) return false; //删除距离数据 if (!dao.DeleteReceiverDistances(data.Name, 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="listDistance"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public long InsertReceiver(Receiver data, List<ReceiverDistance> listDistance, long nOpStaffId, string strOpStaffName, out string strErrText) { long nReceiverId = 0; try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (DDDAO dao = new DDDAO()) { //新增收货单位数据 nReceiverId = dao.InsertReceiver(data, nOpStaffId, strOpStaffName, out strErrText); if (nReceiverId <= 0) return 0; //新增距离数据 foreach (ReceiverDistance distance in listDistance) { if (!dao.InsertReceiverDistance(distance, nOpStaffId, strOpStaffName, out strErrText)) { return 0; } } } transScope.Complete(); } return nReceiverId; } catch (Exception e) { strErrText = e.Message; return 0; } }
/// <summary> /// 删除承运单位档案 /// </summary> /// <param name="nId"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public bool DeleteCarrier(long nId, long nOpStaffId, string strOpStaffName, out string strErrText) { try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (DDDAO dao = new DDDAO()) { //删除承运单位档案数据 if (!dao.DeleteCarrier(nId, nOpStaffId, strOpStaffName, out strErrText)) { return false; } //删除车辆数据 if (!dao.DeleteCarrierCars(nId, nOpStaffId, strOpStaffName, out strErrText)) { return false; } //删除驾驶员数据 if (!dao.DeleteCarrierDrivers(nId, nOpStaffId, strOpStaffName, out strErrText)) { return false; } //删除运费价格数据 if (!dao.DeleteCarrierTransportPrices(nId, nOpStaffId, strOpStaffName, out strErrText)) { return false; } } transScope.Complete(); } return true; } catch (Exception e) { strErrText = e.Message; return false; } }
/// <summary> /// 删除国家自定义数据 /// </summary> /// <param name="nCountryId">国家编码</param> /// <param name="nOpStaffId">操作员工编码</param> /// <param name="strOpStaffName">操作员工姓名</param> /// <param name="strErrText">出错信息</param> /// <returns>成功返回True,否则返回False</returns> public bool DeleteCountry(long nCountryId, long nOpStaffId, string strOpStaffName, out string strErrText) { try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (DDDAO dao = new DDDAO()) { if (!dao.DeleteCountry(nCountryId, 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="listCar"></param> /// <param name="listDriver"></param> /// <param name="listExpression"></param> /// <param name="listTransportPrice"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public bool UpdateCarrier(Carrier data, List<CarrierCar> listCar, List<CarrierDriver> listDriver, List<CarrierSettlementExpression> listExpression, List<CarrierTransportPrice> listTransportPrice, long nOpStaffId, string strOpStaffName, out string strErrText) { try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (DDDAO dao = new DDDAO()) { //修改承运单位档案数据 if (!dao.UpdateCarrier(data, nOpStaffId, strOpStaffName, out strErrText)) { return false; } //修改车辆数据 List<CarrierCar> listOldCar = dao.LoadCarrierCars(data.Id, nOpStaffId, strOpStaffName, out strErrText); if (listOldCar == null) { return false; } foreach (CarrierCar oldCar in listOldCar) { if (!listCar.Exists(delegate(CarrierCar newCar) { return oldCar.Id == newCar.Id; })) { //删除车辆数据 if (!dao.DeleteCarrierCar(oldCar.Id, nOpStaffId, strOpStaffName, out strErrText)) { return false; } } } foreach (CarrierCar newCar in listCar) { if (newCar.Id > 0) { //修改车辆数据 if (!dao.UpdateCarrierCar(newCar, nOpStaffId, strOpStaffName, out strErrText)) { return false; } } } foreach (CarrierCar newCar in listCar) { if (newCar.Id == 0) { //新增车辆数据 if (!dao.InsertCarrierCar(newCar, nOpStaffId, strOpStaffName, out strErrText)) { return false; } } } //修改驾驶员数据 if (!dao.DeleteCarrierDrivers(data.Id, nOpStaffId, strOpStaffName, out strErrText)) { return false; } foreach (CarrierDriver driver in listDriver) { if (!dao.InsertCarrierDriver(driver, nOpStaffId, strOpStaffName, out strErrText)) { return false; } } //修改结算公式数据 if (!dao.DeleteCarrierSettlementExpressions(data.Id, nOpStaffId, strOpStaffName, out strErrText)) { return false; } foreach (CarrierSettlementExpression expression in listExpression) { if (!dao.InsertCarrierSettlementExpression(expression, nOpStaffId, strOpStaffName, out strErrText)) { return false; } } //修改承运价格数据 if (!dao.DeleteCarrierTransportPrices(data.Id, nOpStaffId, strOpStaffName, out strErrText)) { return false; } foreach (CarrierTransportPrice price in listTransportPrice) { if (!dao.InsertCarrierTransportPrice(price, 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="listDistance"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public bool UpdateReceiver(Receiver data, List<ReceiverDistance> listDistance, long nOpStaffId, string strOpStaffName, out string strErrText) { try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (DDDAO dao = new DDDAO()) { //修改收货单位档案数据 if (!dao.UpdateReceiver(data, nOpStaffId, strOpStaffName, out strErrText)) return false; //修改距离数据 if (!dao.DeleteReceiverDistances(data.Name, nOpStaffId, strOpStaffName, out strErrText)) { return false; } foreach (ReceiverDistance distance in listDistance) { if (!dao.InsertReceiverDistance(distance, nOpStaffId, strOpStaffName, out strErrText)) { return false; } } } transScope.Complete(); } return true; } catch (Exception e) { strErrText = e.Message; return false; } }
/// <summary> /// 读取所有承运单位的车辆数据 /// </summary> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public List<CarrierCar> LoadCars(long nOpStaffId, string strOpStaffName, out string strErrText) { try { List<CarrierCar> dataResult = null; using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (DDDAO dao = new DDDAO()) { dataResult = dao.LoadCars(nOpStaffId, strOpStaffName, out strErrText); } transScope.Complete(); } return dataResult; } catch (Exception e) { strErrText = e.Message; return null; } }
/// <summary> /// 读取指定承运单位、起点和讫点的运输价格数据 /// </summary> /// <param name="nCarrierId"></param> /// <param name="strStartCountry"></param> /// <param name="strStartProvince"></param> /// <param name="strStartCity"></param> /// <param name="strDestCountry"></param> /// <param name="strDestProvince"></param> /// <param name="strDestCity"></param> /// <param name="strPlanType"></param> /// <param name="dtCreateTime"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public CarrierTransportPrice LoadCarrierTransportPrice(long nCarrierId, string strStartCountry, string strStartProvince, string strStartCity, string strDestCountry, string strDestProvince, string strDestCity, string strPlanType, DateTime dtCreateTime, long nOpStaffId, string strOpStaffName, out string strErrText) { try { CarrierTransportPrice dataResult = null; using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (DDDAO dao = new DDDAO()) { dataResult = dao.LoadCarrierTransportPrice(nCarrierId, strStartCountry, strStartProvince, strStartCity, strDestCountry, strDestProvince, strDestCity, strPlanType, dtCreateTime, nOpStaffId, strOpStaffName, out strErrText); } transScope.Complete(); } return dataResult; } catch (Exception e) { strErrText = e.Message; return null; } }
/// <summary> /// 读取指定省份自定义数据 /// </summary> /// <param name="nProvinceId">省份编码</param> /// <param name="nOpStaffId">操作员工编码</param> /// <param name="strOpStaffName">操作员工姓名</param> /// <param name="strErrText">出错信息</param> /// <returns>省份数据集</returns> public Province LoadProvince(long nProvinceId, long nOpStaffId, string strOpStaffName, out string strErrText) { try { Province dsRet = null; using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (DDDAO dao = new DDDAO()) { dsRet = dao.LoadProvince(nProvinceId, nOpStaffId, strOpStaffName, out strErrText); if (dsRet == null) return null; } transScope.Complete(); } return dsRet; } catch (Exception e) { strErrText = e.Message; return null; } }
/// <summary> /// 根据货物编号读取所有货物编号数据 /// </summary> /// <param name="nOpStaffId">操作员工编码</param> /// <param name="strOpStaffName">操作员工姓名</param> /// <param name="strErrText">出错信息</param> /// <returns></returns> public List<Goods> LoadAllGoodsByGoodsNo(string strGoodsNo, long nOpStaffId, string strOpStaffName, out string strErrText) { try { List<Goods> dsRet = null; using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (DDDAO dao = new DDDAO()) { dsRet = dao.LoadAllGoodsByGoodsNo(strGoodsNo, nOpStaffId, strOpStaffName, out strErrText); if (dsRet == null) return null; } transScope.Complete(); } return dsRet; } catch (Exception e) { strErrText = e.Message; return null; } }
/// <summary> /// 新增运费限价记录 /// </summary> /// <param name="data"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public bool InsertTransportLimitedPrice(TransportLimitedPrice data, long nOpStaffId, string strOpStaffName, out string strErrText) { try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (DDDAO dao = new DDDAO()) { if (!dao.InsertTransportLimitedPrice(data, nOpStaffId, strOpStaffName, out strErrText)) return false; } transScope.Complete(); } return true; } catch (Exception e) { strErrText = e.Message; return false; } }
/// <summary> /// 读取所有运费限价数据 /// </summary> /// <param name="strPlanType"></param> /// <param name="strStartCountry"></param> /// <param name="strStartProvince"></param> /// <param name="strStartCity"></param> /// <param name="strDestCountry"></param> /// <param name="strDestProvince"></param> /// <param name="strDestCity"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public List<TransportLimitedPrice> LoadTransportLimitedPricesByConditions(string strPlanType, string strStartCountry, string strStartProvince, string strStartCity, string strDestCountry, string strDestProvince, string strDestCity, long nOpStaffId, string strOpStaffName, out string strErrText) { try { List<TransportLimitedPrice> dataResult = null; using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (DDDAO dao = new DDDAO()) { dataResult = dao.LoadTransportLimitedPricesByConditions(strPlanType, strStartCountry, strStartProvince, strStartCity, strDestCountry, strDestProvince, strDestCity, nOpStaffId, strOpStaffName, out strErrText); } transScope.Complete(); } return dataResult; } catch (Exception e) { strErrText = e.Message; return null; } }
/// <summary> /// 读取指定运费限价数据 /// </summary> /// <param name="nId"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public TransportLimitedPrice LoadTransportLimitedPrice(long nId, long nOpStaffId, string strOpStaffName, out string strErrText) { try { TransportLimitedPrice dataResult = null; using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (DDDAO dao = new DDDAO()) { dataResult = dao.LoadTransportLimitedPrice(nId, nOpStaffId, strOpStaffName, out strErrText); } transScope.Complete(); } return dataResult; } catch (Exception e) { strErrText = e.Message; return null; } }
/// <summary> /// 读取指定起点到指定收货单位的距离 /// </summary> /// <param name="strReceiverName"></param> /// <param name="strStartCountry"></param> /// <param name="strStartProvince"></param> /// <param name="strStartCity"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public ReceiverDistance LoadReceiverDistance(string strReceiverName, string strStartCountry, string strStartProvince, string strStartCity, long nOpStaffId, string strOpStaffName, out string strErrText) { try { ReceiverDistance dataResult = null; using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (DDDAO dao = new DDDAO()) { dataResult = dao.LoadReceiverDistance(strReceiverName, strStartCountry, strStartProvince, strStartCity, nOpStaffId, strOpStaffName, out strErrText); } transScope.Complete(); } return dataResult; } catch (Exception e) { strErrText = e.Message; return null; } }
/// <summary> /// 读取指定国家省份自定义数据 /// </summary> /// <param name="strCountryName">国家名称</param> /// <param name="nOpStaffId">操作员工编码</param> /// <param name="strOpStaffName">操作员工姓名</param> /// <param name="strErrText">出错信息</param> /// <returns></returns> public List<Province> LoadProvincesByCountry(string strCountryName, long nOpStaffId, string strOpStaffName, out string strErrText) { try { List<Province> dataResult = null; strErrText = String.Empty; using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (DDDAO dao = new DDDAO()) { dataResult = dao.LoadProvincesByCountry(strCountryName, nOpStaffId, strOpStaffName, out strErrText); } transScope.Complete(); } return dataResult; } catch (Exception e) { strErrText = e.Message; return null; } }
/// <summary> /// 读取承运单位指定结算公式数据 /// </summary> /// <param name="nCarrierId"></param> /// <param name="strPlanType"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public CarrierSettlementExpression LoadCarrierSettlementExpression(long nCarrierId, string strPlanType, long nOpStaffId, string strOpStaffName, out string strErrText) { try { CarrierSettlementExpression dataResult = null; using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (DDDAO dao = new DDDAO()) { dataResult = dao.LoadCarrierSettlementExpression(nCarrierId, strPlanType, nOpStaffId, strOpStaffName, out strErrText); } transScope.Complete(); } return dataResult; } catch (Exception e) { strErrText = e.Message; return null; } }
/// <summary> /// 新增承运单位档案 /// </summary> /// <param name="data"></param> /// <param name="listCar"></param> /// <param name="listDriver"></param> /// <param name="listExpression"></param> /// <param name="listTransportPrice"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public long InsertCarrier(Carrier data, List<CarrierCar> listCar, List<CarrierDriver> listDriver, List<CarrierSettlementExpression> listExpression, List<CarrierTransportPrice> listTransportPrice, long nOpStaffId, string strOpStaffName, out string strErrText) { long nCarrierId = 0; try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (DDDAO dao = new DDDAO()) { //新增承运单位档案数据 nCarrierId = dao.InsertCarrier(data, nOpStaffId, strOpStaffName, out strErrText); if (nCarrierId <= 0) return 0; //新增车辆数据 foreach (CarrierCar car in listCar) { car.CarrierId = nCarrierId; if (!dao.InsertCarrierCar(car, nOpStaffId, strOpStaffName, out strErrText)) { return 0; } } //新增驾驶员数据 foreach (CarrierDriver driver in listDriver) { driver.CarrierId = nCarrierId; if (!dao.InsertCarrierDriver(driver, nOpStaffId, strOpStaffName, out strErrText)) { return 0; } } //新增结算公式数据 foreach (CarrierSettlementExpression expression in listExpression) { expression.CarrierId = nCarrierId; if (!dao.InsertCarrierSettlementExpression(expression, nOpStaffId, strOpStaffName, out strErrText)) { return 0; } } //新增承运价格数据 foreach (CarrierTransportPrice price in listTransportPrice) { price.CarrierId = nCarrierId; if (!dao.InsertCarrierTransportPrice(price, nOpStaffId, strOpStaffName, out strErrText)) { return 0; } } } transScope.Complete(); } return nCarrierId; } catch (Exception e) { strErrText = e.Message; return 0; } }
/// <summary> /// 读取指定时间段内发生业务的承运单位数据 /// </summary> /// <param name="strStartTime"></param> /// <param name="strEndTime"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public List<Carrier> LoadGenerateBusinessCarriersByTimespan(string strStartTime, string strEndTime, long nOpStaffId, string strOpStaffName, out string strErrText) { try { List<Carrier> dataResult = null; strErrText = String.Empty; using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (DDDAO dao = new DDDAO()) { dataResult = dao.LoadGenerateBusinessCarriersByTimespan(strStartTime, strEndTime, nOpStaffId, strOpStaffName, out strErrText); } transScope.Complete(); } return dataResult; } catch (Exception e) { strErrText = e.Message; return null; } }