Exemple #1
0
        public ActionResult SetProvider(int nodeId, string providerName, string providerOrderId, string providerInformation, string newFollowUpDate, bool updateStatusAndFollowUpDate = true)
        {
            var json = new ResultResponse();

            try
            {
                var eventType = PROVIDER_DATA_UPDATED_EVENT_TYPE;
                if (updateStatusAndFollowUpDate)
                {
                    eventType = EVENT_TYPE;
                }

                var eventId = _orderItemManager.GenerateEventId(eventType);
                if (updateStatusAndFollowUpDate)
                {
                    _orderItemManager.SetFollowUpDate(nodeId, Convert.ToDateTime(newFollowUpDate), eventId, false, false);
                }

                _orderItemManager.SetProviderName(nodeId, providerName, eventId, false, false);
                _orderItemManager.SetProviderOrderId(nodeId, providerOrderId, eventId, false, false);
                _orderItemManager.SetProviderInformation(nodeId, providerInformation, eventId, false, false);

                if (updateStatusAndFollowUpDate)
                {
                    _orderItemManager.SetStatus(nodeId, "03:Beställd", eventId, false, false);
                }

                _orderItemManager.SaveWithoutEventsAndWithSynchronousReindexing(nodeId);

                json.Success = true;
                json.Message = "Sparade data för beställning.";
            }
            catch (Exception e)
            {
                json.Success = false;
                json.Message = "Error: " + e.Message;
            }

            return(Json(json, JsonRequestBehavior.AllowGet));
        }