/// <remarks/>
 public void GET_CONTACT_DETAILAsync(InputParameters InputParameters, object userState) {
     if ((this.GET_CONTACT_DETAILOperationCompleted == null)) {
         this.GET_CONTACT_DETAILOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGET_CONTACT_DETAILOperationCompleted);
     }
     this.InvokeAsync("GET_CONTACT_DETAIL", new object[] {
                 InputParameters}, this.GET_CONTACT_DETAILOperationCompleted, userState);
 }
Beispiel #2
0
 /// <remarks/>
 public void GET_CONTACT_DETAILAsync(InputParameters InputParameters)
 {
     this.GET_CONTACT_DETAILAsync(InputParameters, null);
 }
Beispiel #3
0
 /// <remarks/>
 public System.IAsyncResult BeginGET_CONTACT_DETAIL(InputParameters InputParameters, System.AsyncCallback callback, object asyncState)
 {
     return(this.BeginInvoke("GET_CONTACT_DETAIL", new object[] {
         InputParameters
     }, callback, asyncState));
 }
 /// <remarks/>
 public void GET_CONTACT_DETAILAsync(InputParameters InputParameters) {
     this.GET_CONTACT_DETAILAsync(InputParameters, null);
 }
 /// <remarks/>
 public System.IAsyncResult BeginGET_CONTACT_DETAIL(InputParameters InputParameters, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("GET_CONTACT_DETAIL", new object[] {
                 InputParameters}, callback, asyncState);
 }
        /* This method calls
         * HZ_INTEGRATION_PUB_Service : GET_CONTACT_DETAIL()
         * Its output is a table, foreach loop is used 
         * (even though only one row is returned by setting record limit = 1)
         * APPSHZ_INTEGRATION_PX3348183X1X7 is generated and need to be updated 
         * if proxy is regenerated
         *  call dictAddProperty() to add the individual property name, type, and value
         *  for dynamic columns feature
         */
        public Dictionary<string, string> LookupContactDetail(decimal party_id, int _logIncidentId = 0, int _logContactId = 0)
        {
            string request = "";
            string response = "";
            string logMessage, logNote;

            if (String.IsNullOrWhiteSpace(ContactListLookupURL) || String.IsNullOrWhiteSpace(ContactServiceUsername) || String.IsNullOrWhiteSpace(ContactServicePassword))
            {
                throw new Exception("Provider's InitForContact not run.");
            }

            CONTACT.HZ_INTEGRATION_PUB_Service client = EBSProxyFactory.GetContactInstance(ContactListLookupURL, ContactServiceUsername, ContactServicePassword, ContactServiceTimeout);

            CONTACT.InputParameters ip = new CONTACT.InputParameters();
            ip.P_PARTY_ID = party_id;
            ip.P_PARTY_IDSpecified = true;
            ip.P_RECORD_LIMIT = 1; // only return one contact
            ip.P_RECORD_LIMITSpecified = true;
            CONTACT.OutputParameters op = null;
            Stopwatch stopwatch = new Stopwatch();
            try
            {
                request = serializer.Serialize(ip);

                logMessage = "Request of getting EBS contact details (GET_CONTACT_DETAIL). ";
                logNote = "Request Payload: " + request;
                log.DebugLog(_logIncidentId, _logContactId, logMessage, logNote);
                // call the web service, catch the exception right away
                stopwatch.Start();
                op = client.GET_CONTACT_DETAIL(ip);
                stopwatch.Stop();
                response = serializer.Serialize(op);
            }
            catch (Exception ex)
            {
                handleEBSException(ex, "GET_CONTACT_DETAIL", 0, (int)party_id);
                // will throw the new exception (either timeout or error communicating ...)
                // b/c caller ContactDetailVirtualTable GetRows expect reportRows, so need to throw it to show the msg box
                throw;
            }
            if (op.X_RETURN_STATUS == "S")
            {
                logMessage = "Response of getting EBS contact details (GET_CONTACT_DETAIL). ";
                logNote = "Response Payload: " + response;
                log.DebugLog(_logIncidentId, _logContactId, logMessage, logNote, (int) stopwatch.ElapsedMilliseconds);
            }
            else
            {
                logMessage = "Response of getting EBS contact details (GET_CONTACT_DETAIL) (Failure). ";
                logNote = "Response Payload: " + response;
                log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote);
            }
            Dictionary<string, string> dictDetail = new Dictionary<string, string>();
            ContactModel[] retvals = new ContactModel[op.X_CONTACT_REC_TBL.Length];

            foreach (CONTACT.APPSHZ_INTEGRATION_PX3348183X1X7 contact in op.X_CONTACT_REC_TBL)
            {
                foreach (PropertyInfo propertyInfo in contact.GetType().GetProperties())
                {
                    Object propVal = contact.GetType().GetProperty(propertyInfo.Name).GetValue(contact, null);
                    dictAddProperty(propertyInfo, propVal, ref dictDetail);                                      
                }
            }
            return dictDetail;
        }
        public ContactModel[] LookupContactList(string firstname, string lastname, string phone, string email, int _logIncidentId = 0, int _logContactId = 0)
        {
            ContactModel[] retvals = null;
            string request = "";
            string response = "";
            string logMessage, logNote;

            if (String.IsNullOrWhiteSpace(ContactListLookupURL) || String.IsNullOrWhiteSpace(ContactServiceUsername) || String.IsNullOrWhiteSpace(ContactServicePassword))
            {
                throw new Exception("Provider's InitForContact not run.");
            }

            CONTACT.HZ_INTEGRATION_PUB_Service client = EBSProxyFactory.GetContactInstance(ContactListLookupURL, ContactServiceUsername, ContactServicePassword, ContactServiceTimeout);

            CONTACT.SOAHeader hdr = new CONTACT.SOAHeader();
            hdr.Responsibility = "SYSTEM_ADMINISTRATOR";
            hdr.RespApplication = "SYSADMIN";
            hdr.SecurityGroup = "STANDARD";
            hdr.NLSLanguage = "AMERICAN";
            hdr.Org_Id = "204";

            client.SOAHeaderValue = hdr;

            CONTACT.InputParameters ip_contact_list = new CONTACT.InputParameters();

            /* not supported in new official api
            ip.P_FIRST_NAME = firstname;
            ip.P_LAST_NAME = lastname;
             */

            if (email != null)
                ip_contact_list.P_EMAIL = email;

            ip_contact_list.P_RECORD_LIMIT = 200;
            ip_contact_list.P_RECORD_LIMITSpecified = true;

            if (!String.IsNullOrEmpty(phone) && phone.Length >= 7)
            {
                if (phone[phone.Length - 5] == '-' || phone[phone.Length - 5] == ' ')
                {
                    ip_contact_list.P_PHONE = phone.Substring(phone.Length - 8);
                }
                else
                {
                    ip_contact_list.P_PHONE = phone.Substring(phone.Length - 7);
                }
            }

            Stopwatch stopwatch = new Stopwatch();
            try
            {
                request = serializer.Serialize(ip_contact_list);
                stopwatch.Start();
                CONTACT.OutputParameters op_contact_list = client.GET_CONTACT_DETAIL(ip_contact_list);
                stopwatch.Stop();
                response = serializer.Serialize(op_contact_list);

                if (op_contact_list.X_RETURN_STATUS == "S")
                {
                    List<ContactModel> contacts = new List<ContactModel>();

                    foreach (CONTACT.APPSHZ_INTEGRATION_PX3348183X1X7 op in op_contact_list.X_CONTACT_REC_TBL)
                    {
                        ContactModel contact = new ContactModel();
                        contact.ContactPartyID = op.RELATIONSHIP_PARTY_ID;
                        contact.FirstName = op.PERSON_FIRST_NAME;
                        contact.LastName = op.PERSON_LAST_NAME;
                        contact.Email = op.PRIMARY_EMAIL;
                        contact.ContactOrgID = op.ORG_PARTY_ID;
                        contact.PhoneNumber = op.PRIMARY_PHONE;
                        contacts.Add(contact);
                    }
                    retvals = contacts.ToArray();

                    logMessage = "Request of search Contact (Success). Email = " + email + "; Phone = " + phone;
                    logNote = "Request Payload: " + request;
                    log.DebugLog(_logIncidentId, _logContactId, logMessage, logNote);

                    logMessage = "Response of search Contact (Success). Email = " + email + "; Phone = " + phone;
                    logNote = "Response Payload: " + response;
                    log.DebugLog(_logIncidentId, _logContactId, logMessage, logNote, (int)stopwatch.ElapsedMilliseconds);
                }
                else
                {
                    List<ContactModel> contacts = new List<ContactModel>();
                    ContactModel contact = new ContactModel();
                    contact.ErrorMessage = "There has been an error communicating with EBS. Please check log for detail.";
                    contacts.Add(contact);
                    retvals = contacts.ToArray();

                    logMessage = "Request of search Contact (Failure). Email = " + email + "; Phone = " + phone;
                    logNote = "Request Payload: " + request;
                    log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote);

                    logMessage = "Response of search Contact (Failure). Email = " + email + "; Phone = " + phone;
                    logNote = "Response Payload: " + response;
                    log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote);
                }
            }

            catch (Exception ex)
            {
                List<ContactModel> contacts = new List<ContactModel>();
                ContactModel contact = new ContactModel();
                contact.ErrorMessage = "There has been an error communicating with EBS. Please check log for detail.";
                contacts.Add(contact);
                retvals = contacts.ToArray();

                logMessage = "Request of search Contact (Failure). Email = " + email + "; Phone = " + phone + ". Error: " + ex.Message;
                logNote = "Request Payload: " + request;
                log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote);

                logMessage = "Response of search Contact (Failure). Email = " + email + "; Phone = " + phone + ". Error: " + ex.Message;
                logNote = "Response Payload: " + response;
                log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote);

                handleEBSException(ex, "Search Contact", _logIncidentId, _logContactId);
            }

            return retvals;
        }