private void ProcessOrderReponse(TrackOrderModel order, ResponseRd response) { try { using (var repository = new StoreRepository()) { repository.Db.Configuration.ValidateOnSaveEnabled = false; if (response != null && response.IsSuccess && response.Order != null && String.IsNullOrWhiteSpace(response.Order.statusField) == false) { if (order.LastStatus == response.Order.statusField) { return; } repository.UpdateOrderStatus(order.OrderToStoreId, response.Order.statusField, response.Order.promiseTimeField.ToDateTimeSafe()); return; } if (response != null && response.IsSuccess == false) { _eventLog.WriteEntry(String.Format("Order Call Failed OrderId: {0} AtoOrderId: {1} - Error: {2} | {3}", order.OrderToStoreId, order.AtoOrderId, String.IsNullOrWhiteSpace(response.ExcMsg) ? "" : response.ErrMsg, String.IsNullOrWhiteSpace(response.ResultData) ? "" : response.ResultData), EventLogEntryType.Warning); } repository.UpdateOrderStatusFailedRetrieve(order.OrderToStoreId, order.FailedStatusCounter); } } catch (Exception ex) { _eventLog.WriteEntry(ex.Message + " -ST- " + ex.StackTrace, EventLogEntryType.Error); } }
private void SaveOrderStatus(OrderModelDto model, ResponseRd response) { try { using (var repository = new StoreRepository()) { repository.UpdateOrderMode(model.OrderToStoreId, response.Order.orderIdField, response.Order.statusField, response.Order.modeField, response.Order.modeChargeField, response.Order.promiseTimeField.ToDateTimeSafe()); if (SettingsData.Store.EnableSendEmail) { repository.SaveOrderToStoreEmail(model.OrderToStoreId); } } } catch (Exception ex) { SharedLogger.LogError(ex); } }