public Dictionary<string, string> LookupContactDetail(decimal contact_id, int _logIncidentId = 0, int _logContactId = 0) { EBSMockSvcClient _client = new EBSMockSvcClient(binding, addr); ContactListOutputParameters op = null; using (new OperationContextScope(_client.InnerChannel)) { Credential userInfo = new Credential(); userInfo.username = ContactServiceUsername; userInfo.password = ContactServicePassword; MessageHeader aMessageHeader = MessageHeader.CreateHeader("Credential", "", userInfo); OperationContext.Current.OutgoingMessageHeaders.Add(aMessageHeader); op = _client.getContactDetailsByPartyID(contact_id.ToString()); } Dictionary<string, string> dictDetail = new Dictionary<string, string>(); foreach (ContactPartyItem contact in op.X_CONTACT_LIST) { 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 ServiceRequest[] LookupSRbyContactPartyID(decimal contact_id, int _logIncidentId = 0, int _logContactId = 0) { EBSMockSvcClient _client = new EBSMockSvcClient(binding, addr); SRListOutputParameters op = null; using (new OperationContextScope(_client.InnerChannel)) { Credential userInfo = new Credential(); userInfo.username = SRServiceUsername; userInfo.password = SRServicePassword; MessageHeader aMessageHeader = MessageHeader.CreateHeader("Credential", "", userInfo); OperationContext.Current.OutgoingMessageHeaders.Add(aMessageHeader); op = _client.GetSRInfoByContact(contact_id.ToString(), 100); } ServiceRequest[] retvals = new ServiceRequest[op.X_SR_LIST.Length]; int i = 0; foreach (ServiceRequestItem mock_sr in op.X_SR_LIST) { /* only want to get SRs where there is no incidents. * incidentID 0 means null in mock service, to be safe * also check for IncidentRef as well */ if (mock_sr.EXTATTRIBUTE14 == null || mock_sr.EXTATTRIBUTE15 == null) { ServiceRequest retval = new ServiceRequest(); retval.RequestDate = mock_sr.CREATION_DATE; retval.RequestID = (decimal?)Convert.ToDecimal(mock_sr.INCIDENT_ID); retval.RequestNumber = mock_sr.INCIDENT_NUMBER; retval.RequestType = mock_sr.INCIDENT_TYPE; retval.RequestTypeID = (decimal?)Convert.ToDecimal(mock_sr.INCIDENT_TYPE_ID); retval.SerialNumber = mock_sr.SERIAL_NUMBER; retval.Severity = mock_sr.INCIDENT_SEVERITY; retval.SeverityID = (decimal?)Convert.ToDecimal(mock_sr.INCIDENT_SEVERITY); retval.Status = mock_sr.INCIDENT_STATUS; retval.StatusID = (decimal?)Convert.ToDecimal(mock_sr.INCIDENT_STATUS_ID); retval.Summary = mock_sr.SUMMARY; retvals[i] = retval; i++; } } return retvals; }
/* call EBSMockSvcClient : GetSRInfoById() * Output : op.X_SR_LIST * call dictAddProperty() to add the individual property name, type, and value * for dynamic columns feature */ public Dictionary<string, string> LookupSRDetail(decimal incident_id, string incident_number, int _logIncidentId = 0, int _logContactId = 0) { EBSMockSvcClient _client = new EBSMockSvcClient(binding, addr); SRListOutputParameters op = null; using (new OperationContextScope(_client.InnerChannel)) { Credential userInfo = new Credential(); userInfo.username = SRServiceUsername; userInfo.password = SRServicePassword; MessageHeader aMessageHeader = MessageHeader.CreateHeader("Credential", "", userInfo); OperationContext.Current.OutgoingMessageHeaders.Add(aMessageHeader); op = _client.GetSRInfoById(incident_id.ToString()); } Dictionary<string, string> dictDetail = new Dictionary<string, string>(); foreach (ServiceRequestItem sr in op.X_SR_LIST) { foreach (PropertyInfo propertyInfo in sr.GetType().GetProperties()) { Object propVal = sr.GetType().GetProperty(propertyInfo.Name).GetValue(sr, null); dictAddProperty(propertyInfo, propVal, ref dictDetail); } } return dictDetail; }