예제 #1
0
        /// <summary>
        /// Send Data To All Active Forms
        /// </summary>
        /// <param name="data"></param>
        /// <param name="options"></param>
        private static void SendInternalData(object data, PerformOptions options)
        {
            foreach (var pairStringForm in ActiveForms)
            {
                if (options == PerformOptions.AsyncProcess)
                {
                    Task t = new Task(() => pairStringForm.Value.ReceiveData(data));
                }

                if (options == PerformOptions.SyncProcess)
                {
                    pairStringForm.Value.ReceiveData(data);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:FuelSDK.PerformReturn"/> class.
        /// </summary>
        /// <param name="objs">Objects.</param>
        /// <param name="performAction">Perform action.</param>
        public PerformReturn(APIObject objs, string performAction)
        {
            if (objs == null)
            {
                throw new ArgumentNullException("objs");
            }

            var response = ExecuteAPI((client, o) =>
            {
                var options         = new PerformOptions();
                var performRequest  = new PerformRequest(options, performAction, o);
                var performResponse = client.SoapClient.PerformAsync(performRequest).Result;

                return(new ExecuteAPIResponse <PerformResult>(performResponse.Results, performResponse.RequestID, performResponse.OverallStatus)
                {
                    OverallStatusMessage = performResponse.OverallStatusMessage
                });
            }, objs);

            if (response != null)
            {
                if (response.GetType() == typeof(PerformResult[]) && response.Length > 0)
                {
                    Results = response.Cast <PerformResult>().Select(cr => new ResultDetail
                    {
                        StatusCode    = cr.StatusCode,
                        StatusMessage = cr.StatusMessage,
                        Object        = (cr.Object != null ? (objs.GetType().ToString().Contains("ET_") ? TranslateObject2(cr.Object) : TranslateObject(cr.Object)) : null),
                        Task          = cr.Task,
                        OrdinalID     = cr.OrdinalID,
                        ErrorCode     = cr.ErrorCode,
                    }).ToArray();
                }
                else
                {
                    Results = new ResultDetail[0];
                }
            }
        }
예제 #3
0
 public void SendData(object data, PerformOptions options)
 {
     BaseFormParent.SendInternalData(data, options);
 }