Exemplo n.º 1
0
 /// <summary>
 /// This function will call the ProcessDocument Method internally and will make async result compelted
 /// </summary>
 /// <param name="state">current MeridianAsyncResult </param>
 /// <returns></returns>
 private void CompleteProcess(object state)
 {
     var meridianAsyncResult = state as MeridianAsyncResult;
     ProcessShippingSchedule objProcessShippingSchedule = new ProcessShippingSchedule();
     meridianAsyncResult.Result = objProcessShippingSchedule.ProcessDocument(meridianAsyncResult.CurrentOperationContext);
     meridianAsyncResult.Completed();
 }
Exemplo n.º 2
0
        /*Async Method Implementation
         *
         * /// <summary>
         * /// This function will call the ProcessDocument Method internally and will make async result compelted
         * /// </summary>
         * /// <param name="state">current MeridianAsyncResult </param>
         * /// <returns></returns>
         * private void CompleteProcess(object state)
         * {
         *  var meridianAsyncResult = state as MeridianAsyncResult;
         *  ProcessShippingSchedule objProcessShippingSchedule = new ProcessShippingSchedule();
         *  meridianAsyncResult.Result = objProcessShippingSchedule.ProcessDocument(meridianAsyncResult.CurrentOperationContext);
         *  meridianAsyncResult.Completed();
         * }
         *
         * /// <summary>
         * /// This function will call the ProcessRequisitionDocument Method internally and will make async result compelted
         * /// </summary>
         * /// <param name="state">current MeridianAsyncResult </param>
         * /// <returns></returns>
         * private void CompleteRequisitionProcess(object state)
         * {
         *  var meridianAsyncResult = state as MeridianAsyncResult;
         *  ProcessRequisition objProcessRequisition = new ProcessRequisition();
         *  meridianAsyncResult.Result = objProcessRequisition.ProcessRequisitionDocument(meridianAsyncResult.CurrentOperationContext);
         *  meridianAsyncResult.Completed();
         * }
         *
         * /// <summary>
         * /// This function will call the ProcessShippingScheduleResponseRequest Method internally and will make async result compelted
         * /// </summary>
         * /// <param name="state">current MeridianAsyncResult </param>
         * /// <returns></returns>
         * private void CompleteShippingScheduleResponseProcess(object state)
         * {
         *  var meridianAsyncResult = state as MeridianAsyncResult;
         *  ProcessShippingScheduleResponse objProcess = new ProcessShippingScheduleResponse();
         *  meridianAsyncResult.Result = objProcess.ProcessShippingScheduleResponseRequest(meridianAsyncResult.CurrentOperationContext);
         *  meridianAsyncResult.Completed();
         * }
         *
         #region Async Method implementation
         *
         * /// <summary>
         * /// To get transportion data
         * /// </summary>
         * /// <param name="callback"> delegate that references a method that is called when the asynchronous operation completes </param>
         * /// <param name="asyncState">user-defined object can be used to pass application-specific state information to the method invoked when the asynchronous operation completes </param>
         * public IAsyncResult BeginSubmitDocument(AsyncCallback callback, object asyncState)
         * {
         *  var meridianAsyncResult = new MeridianAsyncResult(OperationContext.Current, callback, asyncState);
         *  ThreadPool.QueueUserWorkItem(CompleteProcess, meridianAsyncResult);
         *  return meridianAsyncResult;
         * }
         *
         * /// <summary>
         * /// To return processed data i.e. XElement
         * /// </summary>
         * /// <param name="asyncResult"> object of IAsyncResult which will hold the result of current processing</param>
         * public XElement EndSubmitDocument(IAsyncResult asyncResult)
         * {
         *  var meridianAsyncResult = asyncResult as MeridianAsyncResult;
         *  meridianAsyncResult.AsyncWait.WaitOne();
         *  if (!meridianAsyncResult.Result.Status.Equals(MeridianGlobalConstants.MESSAGE_ACKNOWLEDGEMENT_FAILURE, StringComparison.OrdinalIgnoreCase))
         *      meridianAsyncResult.Result.Status = SendFileToFTP(meridianAsyncResult.Result).GetAwaiter().GetResult() ? MeridianGlobalConstants.MESSAGE_ACKNOWLEDGEMENT_SUCCESS : MeridianGlobalConstants.MESSAGE_ACKNOWLEDGEMENT_FAILURE;
         *  return XElement.Parse(MeridianSystemLibrary.GetMeridian_Status(meridianAsyncResult.Result.Status, meridianAsyncResult.Result.UniqueID, meridianAsyncResult.Result.IsSchedule));
         * }
         *
         * /// <summary>
         * /// To get transportion data
         * /// </summary>
         * /// <param name="callback"> delegate that references a method that is called when the asynchronous operation completes </param>
         * /// <param name="asyncState">user-defined object can be used to pass application-specific state information to the method invoked when the asynchronous operation completes </param>
         * public IAsyncResult BeginRequisition(AsyncCallback callback, object asyncState)
         * {
         *  var meridianAsyncResult = new MeridianAsyncResult(OperationContext.Current, callback, asyncState);
         *  ThreadPool.QueueUserWorkItem(CompleteRequisitionProcess, meridianAsyncResult);
         *  return meridianAsyncResult;
         * }
         *
         * /// <summary>
         * /// To return processed data i.e. XElement
         * /// </summary>
         * /// <param name="asyncResult"> object of IAsyncResult which will hold the result of current processing</param>
         * public XElement EndRequisition(IAsyncResult asyncResult)
         * {
         *  var meridianAsyncResult = asyncResult as MeridianAsyncResult;
         *  meridianAsyncResult.AsyncWait.WaitOne();
         *  if (!meridianAsyncResult.Result.Status.Equals(MeridianGlobalConstants.MESSAGE_ACKNOWLEDGEMENT_FAILURE, StringComparison.OrdinalIgnoreCase))
         *      meridianAsyncResult.Result.Status = SendFileToFTP(meridianAsyncResult.Result).GetAwaiter().GetResult() ? MeridianGlobalConstants.MESSAGE_ACKNOWLEDGEMENT_SUCCESS : MeridianGlobalConstants.MESSAGE_ACKNOWLEDGEMENT_FAILURE;
         *  return XElement.Parse(MeridianSystemLibrary.GetMeridian_Status(meridianAsyncResult.Result.Status, meridianAsyncResult.Result.UniqueID, meridianAsyncResult.Result.IsSchedule));
         * }
         *
         * /// <summary>
         * /// To get transportion data
         * /// </summary>
         * /// <param name="callback"> delegate that references a method that is called when the asynchronous operation completes </param>
         * /// <param name="asyncState">user-defined object can be used to pass application-specific state information to the method invoked when the asynchronous operation completes </param>
         * public IAsyncResult BeginShippingScheduleResponse(AsyncCallback callback, object asyncState)
         * {
         *  var meridianAsyncResult = new MeridianAsyncResult(OperationContext.Current, callback, asyncState);
         *  ThreadPool.QueueUserWorkItem(CompleteShippingScheduleResponseProcess, meridianAsyncResult);
         *  return meridianAsyncResult;
         * }
         *
         * /// <summary>
         * /// To return processed data i.e. XElement
         * /// </summary>
         * /// <param name="asyncResult"> object of IAsyncResult which will hold the result of current processing</param>
         * public XElement EndShippingScheduleResponse(IAsyncResult asyncResult)
         * {
         *  var meridianAsyncResult = asyncResult as MeridianAsyncResult;
         *  meridianAsyncResult.AsyncWait.WaitOne();
         *  if (!meridianAsyncResult.Result.Status.Equals(MeridianGlobalConstants.MESSAGE_ACKNOWLEDGEMENT_FAILURE, StringComparison.OrdinalIgnoreCase))
         *      meridianAsyncResult.Result.Status = SendFileToFTP(meridianAsyncResult.Result).GetAwaiter().GetResult() ? MeridianGlobalConstants.MESSAGE_ACKNOWLEDGEMENT_SUCCESS : MeridianGlobalConstants.MESSAGE_ACKNOWLEDGEMENT_FAILURE;
         *  return XElement.Parse(MeridianSystemLibrary.GetMeridian_Status(meridianAsyncResult.Result.Status, meridianAsyncResult.Result.UniqueID, meridianAsyncResult.Result.IsSchedule));
         * }
         *
         #endregion Async Method implementation
         *
         */

        /// <summary>
        /// Soap Method to pass xCBL XML data to the web serivce
        /// </summary>
        /// <param name="ShippingSchedule">XmlElement the xCBL XML data to parse</param>
        /// <returns>XElement - XML Message Acknowledgement response indicating Success or Failure</returns>
        public XElement SubmitDocument()
        {
            ProcessShippingSchedule objProcess = new ProcessShippingSchedule();
            var meridianResult = objProcess.ProcessDocument(OperationContext.Current);

            if (!meridianResult.Status.Equals(MeridianGlobalConstants.MESSAGE_ACKNOWLEDGEMENT_FAILURE, StringComparison.OrdinalIgnoreCase))
            {
                meridianResult.Status = SendFileToFTP(meridianResult).GetAwaiter().GetResult() ? MeridianGlobalConstants.MESSAGE_ACKNOWLEDGEMENT_SUCCESS : MeridianGlobalConstants.MESSAGE_ACKNOWLEDGEMENT_FAILURE;
            }
            return(XElement.Parse(MeridianSystemLibrary.GetMeridian_Status(meridianResult.Status, meridianResult.UniqueID, meridianResult.IsSchedule)));
        }
Exemplo n.º 3
0
        /// <summary>
        /// This function will call the ProcessDocument Method internally and will make async result compelted
        /// </summary>
        /// <param name="state">current MeridianAsyncResult </param>
        /// <returns></returns>
        private void CompleteProcess(object state)
        {
            var meridianAsyncResult = state as MeridianAsyncResult;

            if (CommonProcess.IsShippingScheduleRequest(meridianAsyncResult.CurrentOperationContext))
            {
                ProcessShippingSchedule objProcessShippingSchedule = new ProcessShippingSchedule();
                meridianAsyncResult.Result = objProcessShippingSchedule.ProcessDocument(meridianAsyncResult.CurrentOperationContext);
            }
            else
            {
                ProcessRequisition objProcessRequisition = new ProcessRequisition();
                meridianAsyncResult.Result = objProcessRequisition.ProcessRequisitionDocument(meridianAsyncResult.CurrentOperationContext);
            }
            meridianAsyncResult.Completed();
        }