/*  This method calls
         *  CS_SERVICEREQUEST_PUB_Service : GET_SRINFO_BYCONTACT
         *  Called by SRlistVirtualTable GetRows() to display Service Requests for a contact
         */
        public ServiceRequest[] LookupSRbyContactPartyID(decimal contact_id, int _logIncidentId = 0, int _logContactId = 0)
        {
            string request = "";
            string response = "";
            string logMessage, logNote;

            if (String.IsNullOrWhiteSpace(SRLookupURL) || String.IsNullOrWhiteSpace(SRServiceUsername) || String.IsNullOrWhiteSpace(SRServicePassword))
            {
                throw new Exception("Provider's InitForSR not run.");
            }

            SR.CS_SERVICEREQUEST_PUB_Service client = EBSProxyFactory.GetSRServiceInstance(SRLookupURL, SRServiceUsername, SRServicePassword, SRServiceTimeout);

            SR.InputParameters1 ip = new SR.InputParameters1();
            ip.P_API_VERSION = 1;
            ip.P_API_VERSIONSpecified = true;
            ip.P_CONTACT = contact_id;
            ip.P_CONTACTSpecified = true;
            ip.P_COMMIT = "T";
            ip.P_INIT_MSG_LIST = "T";
            SR.OutputParameters1 op = null;
            Stopwatch stopwatch = new Stopwatch();
            try
            {
                request = serializer.Serialize(ip);
                logMessage = "Request of getting SRs by contactId (GET_SRINFO_BYCONTACT). ";
                logNote = "Request Payload: " + request;
                log.DebugLog(_logIncidentId, _logContactId, logMessage, logNote);
                // call the web service, catch the exception right away
                stopwatch.Start();
                op = client.GET_SRINFO_BYCONTACT(ip);
                stopwatch.Stop();
                response = serializer.Serialize(op);
            }
            catch (Exception ex)
            {
                handleEBSException(ex, "GET_SRINFO_BYCONTACT", _logIncidentId, _logContactId);
                // will throw the new exception (either timeout or error communicating ...)
                // b/c caller SRlistVirtualTable GetRows expect reportRows, so need to throw it to show the msg box
                throw; 
            }

            if (op.X_RETURN_STATUS == "S")
            {
                logMessage = "Response of getting SRs by contactId (GET_SRINFO_BYCONTACT). ";
                logNote = "Response Payload: " + response;
                log.DebugLog(_logIncidentId, _logContactId, logMessage, logNote, (int)stopwatch.ElapsedMilliseconds);
            }
            else
            {
                logMessage = "Response of getting SRs by contactId (GET_SRINFO_BYCONTACT) (Failure). " + op.X_MSG_DATA;
                logNote = "Response Payload: " + response;
                log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote);
            }

            ServiceRequest[] retvals = new ServiceRequest[op.X_SR_DET_TBL.Length];
            int i = 0;
            foreach (SR.APPSCS_SERVICEREQUESX230189X17X6 sr in op.X_SR_DET_TBL)
            {
                // sr.EXTATTRIBUTE15 is Rnow IncidentID
                if (sr.EXTATTRIBUTE15 == null || sr.EXTATTRIBUTE15 == "")
                {
                    ServiceRequest req = new ServiceRequest();
                    req.RequestID = sr.INCIDENT_ID;
                    req.RequestNumber = sr.INCIDENT_NUMBER;
                    req.StatusID = sr.INCIDENT_STATUS_ID;
                    req.Status = sr.INCIDENT_STATUS;
                    req.SeverityID = sr.INCIDENT_SEVERITY_ID;
                    req.Severity = sr.INCIDENT_SEVERITY;
                    req.RequestTypeID = sr.INCIDENT_TYPE_ID;
                    req.RequestType = sr.INCIDENT_TYPE;
                    req.Summary = sr.SUMMARY;
                    req.RequestDate = (DateTime)sr.CREATION_DATE;
                    retvals[i] = req;
                    i++;
                }
            }
            return retvals;
        }
 /// <remarks/>
 public void GET_SRINFO_BYCONTACTAsync(InputParameters1 InputParameters) {
     this.GET_SRINFO_BYCONTACTAsync(InputParameters, null);
 }
 /// <remarks/>
 public void GET_SRINFO_BYCONTACTAsync(InputParameters1 InputParameters, object userState) {
     if ((this.GET_SRINFO_BYCONTACTOperationCompleted == null)) {
         this.GET_SRINFO_BYCONTACTOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGET_SRINFO_BYCONTACTOperationCompleted);
     }
     this.InvokeAsync("GET_SRINFO_BYCONTACT", new object[] {
                 InputParameters}, this.GET_SRINFO_BYCONTACTOperationCompleted, userState);
 }
 /// <remarks/>
 public System.IAsyncResult BeginGET_SRINFO_BYCONTACT(InputParameters1 InputParameters, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("GET_SRINFO_BYCONTACT", new object[] {
                 InputParameters}, callback, asyncState);
 }