Beispiel #1
0
        public bool Run()
        {
            switch (_msg.RequestList.Count)
            {
            case 0:
                StatusMgr.LogError("No items in batch to process");
                return(false);

            case 1:
                break;

            default:
                if (_iterator != null)
                {
                    StatusMgr.LogError("Iterators are only allowed in single request batches");
                    return(false);
                }
                _msg.Attributes.OnError = SDK.ENRqOnError.roeContinue;
                break;
            }

            try
            {
                bool retVal = false;

                IteratorCall iterCall = null;

                do
                {
                    retVal = RunOneBatch(out iterCall);

                    if (iterCall != null)
                    {
                        if (!iterCall.iterator(iterCall.iteratorId, iterCall.remaining))
                        {
                            return(false); //user cancelled
                        }
                    }
                }while (retVal == true && iterCall != null);

                return(retVal);
            }
            catch (System.Runtime.InteropServices.COMException cex)
            {
                var entry = new StatusEntry()
                {
                    Summary     = "Request Error",
                    TypeOfEntry = StatusEntry.EntryType.Error
                };
                entry.AddLine(cex.Message);

                try
                {
                    //This may not be the source of the error
                    //entry.AddLine(_msg.ToXMLString());

                    //this causes further COM errors
                    //entry.AddLine(_msg.Attributes.ResponseData.ToString());
                    entry.AddLine("Enable SDK logging for further diagnostics");
                }
                catch (Exception)
                {
                }

                StatusMgr.LogEntry(entry);

                return(false);
            }
        }