public void SaveCustomerTakeDelivery(CustomerTakeDeliveryEntity takeDeliveryEntity, LoggingSessionInfo loggingSessionInfo,string deliveryId) { TransactionHelper tranHelper = new TransactionHelper(loggingSessionInfo); IDbTransaction tran = tranHelper.CreateTransaction(); List<EqualsCondition> lstWhereCondition = new List<EqualsCondition>(); lstWhereCondition.Add(new EqualsCondition() { FieldName = "CustomerId", Value = loggingSessionInfo.ClientID }); lstWhereCondition.Add(new EqualsCondition() { FieldName = "DeliveryId", Value = takeDeliveryEntity.DeliveryId }); var takeDeliveryList = Query(lstWhereCondition.ToArray(), null); //除本次保存数据的此商户下提货配置信息 var takeDeliveryList_d = takeDeliveryList.Where(m => m.Id != takeDeliveryEntity.Id).ToArray(); //删除除本次保存数据的此商户下提货配置信息 if (takeDeliveryList_d != null && takeDeliveryList_d.Count() > 0) { Delete(takeDeliveryList_d, tran); } if (takeDeliveryEntity.Id == null || string.IsNullOrWhiteSpace(takeDeliveryEntity.Id.ToString())) { takeDeliveryEntity.Id = Guid.NewGuid(); Create(takeDeliveryEntity, tran); } else { Update(takeDeliveryEntity, tran); } //修改配送方式状态 DeliveryBLL deliverBll = new DeliveryBLL(loggingSessionInfo); deliverBll.Update( new DeliveryEntity() { DeliveryId = deliveryId, Status = takeDeliveryEntity.Status } ,tran ); tran.Commit(); }
/// <summary> ///保存送货到家配置信息 /// </summary> /// <param name="DeliveryStrategyEntity"></param> /// <param name="BasicSettingEntity"></param> /// add by donal 2014-10-22 13:29:07 public void SaveDeliveryStrategyAndBasicSetting(CustomerDeliveryStrategyEntity DeliveryStrategyEntity, CustomerBasicSettingEntity BasicSettingEntity, LoggingSessionInfo loggingSessionInfo, string deliveryId) { TransactionHelper tranHelper = new TransactionHelper(loggingSessionInfo); IDbTransaction tran = tranHelper.CreateTransaction(); CustomerBasicSettingBLL basicSettingBLL = new CustomerBasicSettingBLL(loggingSessionInfo); #region 除信息 //此商户下送货到家信息 CustomerDeliveryStrategyEntity[] DeliveryStrategyList = QueryByEntity( new CustomerDeliveryStrategyEntity { CustomerId = loggingSessionInfo.ClientID, DeliveryId = DeliveryStrategyEntity.DeliveryId }, null ); //此商户下基数设置(描述)信息 CustomerBasicSettingEntity[] BasicSettingList = basicSettingBLL.QueryByEntity(new CustomerBasicSettingEntity { SettingCode = "DeliveryStrategy", CustomerID = loggingSessionInfo.ClientID }, null ); //除本次保存数据的此商户下送货到家信息 CustomerDeliveryStrategyEntity[] DeliveryStrategyList_d = DeliveryStrategyList.Where(m => m.Id != DeliveryStrategyEntity.Id).ToArray(); //除本次保存数据的此商户下基数设置(描述)信息 CustomerBasicSettingEntity[] BasicSettingList_d = BasicSettingList.Where(m => m.SettingID != BasicSettingEntity.SettingID).ToArray(); if (DeliveryStrategyList_d != null && DeliveryStrategyList_d.Count() > 0) { Delete(DeliveryStrategyList_d, tran); } if (BasicSettingList_d != null && BasicSettingList_d.Count() > 0) { basicSettingBLL.Delete(BasicSettingList_d, tran); } #endregion #region 保存 if (DeliveryStrategyEntity.Id == null || string.IsNullOrWhiteSpace(DeliveryStrategyEntity.Id.ToString())) { DeliveryStrategyEntity.Id = Guid.NewGuid(); Create(DeliveryStrategyEntity, tran); } else { Update(DeliveryStrategyEntity, tran); } if (BasicSettingEntity.SettingID == null || string.IsNullOrWhiteSpace(BasicSettingEntity.SettingID.ToString())) { BasicSettingEntity.SettingID = Guid.NewGuid(); basicSettingBLL.Create(BasicSettingEntity, tran); } else { basicSettingBLL.Update(BasicSettingEntity, tran); } //修改配送方式状态 DeliveryBLL deliveryBll = new DeliveryBLL(loggingSessionInfo); deliveryBll.Update( new DeliveryEntity() { DeliveryId = deliveryId, Status = DeliveryStrategyEntity.Status } , tran ); #endregion tran.Commit(); }