/// <summary> /// Delete orderdetails /// </summary> /// <param name="request"></param> /// <returns></returns> public CloseOrderDetailsResponse CloseOrderDetails(CloseOrderDetailsRequest request) { OrderDetailsService service = new OrderDetailsService(); OrderService orderService = new OrderService(); CloseOrderDetailsResponse response = new CloseOrderDetailsResponse(); try { using (TransactionScope scope = new TransactionScope()) { response.IsFailed = !(service.CloseOrderDetails(request.OrderDetailsBE)); if (service.GetOrderDetailsByOrderId(request.OrderDetailsBE.OrderId).Count == 0) { orderService.DeleteOrder(request.OrderDetailsBE.OrderId); } // The Complete method commits the transaction. If an exception has been thrown, // Complete is not called and the transaction is rolled back. scope.Complete(); } } catch (Exception ex) { response.IsFailed = true; response.Message = ex.Message; } return(response); }
/// <summary> /// Update a piece of orderdetails through orderdetailsid --by Eric /// </summary> /// <param name="orderdetailId"></param> /// <returns>IsDelete </returns> public bool CloseOrderDetails(OrderDetailsBE orderdetailsBE) { CloseOrderDetailsRequest request = new CloseOrderDetailsRequest(); request.OrderDetailsBE = orderdetailsBE; CloseOrderDetailsResponse response = MyChannelFactory.CreateChannel().CloseOrderDetails(request); if (response != null) { if (response.IsFailed == true) { throw (new Exception(response.Message)); } } return(response.IsFailed); }
/// <summary> /// Update a piece of orderdetails through orderdetailsid --by Eric /// </summary> /// <param name="orderdetailId"></param> /// <returns>IsDelete </returns> public bool CloseOrderDetails(OrderDetailsBE orderdetails) { CloseOrderDetailsRequest request = new CloseOrderDetailsRequest(); request.OrderDetailsBE = orderdetails; CloseOrderDetailsResponse response = MyChannelFactory.CreateChannel().CloseOrderDetails(request); if (response != null) { if (response.IsFailed == true) { ILog log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); log.Error("error", new Exception(response.Message)); log.Fatal("fatal", new Exception(response.Message)); throw (new Exception(response.Message)); } } return(response.IsFailed); }