public static List <SDM_Activity_Log> Get_ActivityLog(int SID, int TicketNumber) { SDMWS.USD_WebServiceSoapClient ws_client = WebServiceSoapClient(); int ticketID = Get_TicketId(SID, TicketNumber); SDMWS.ListResult ticketHandleRequest = ws_client.getRelatedList(SID, "cr:" + ticketID, "act_log_all"); int listHandle = ticketHandleRequest.listHandle; string[] myAttr = { "action_desc", "time_stamp", "analyst", "description" }; var rawXml = ws_client.getListValues(SID, listHandle, 0, -1, myAttr); XDocument ReturnedXml = XDocument.Parse(rawXml); List <SDM_Activity_Log> activityLog = new List <SDM_Activity_Log>(); DateTime startTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); foreach (var attributeSet in ReturnedXml.Descendants("Attributes")) { SDM_Activity_Log activity = new SDM_Activity_Log(); foreach (var attribute in attributeSet.Descendants("Attribute")) { if (attribute.Element("AttrName").Value == "action_desc") { activity.ActionDesc = attribute.Element("AttrValue").Value.Trim(); } if (attribute.Element("AttrName").Value == "time_stamp") { activity.TimeStamp = startTime.AddSeconds(Int32.Parse(attribute.Element("AttrValue").Value)).ToLocalTime(); } if (attribute.Element("AttrName").Value == "analyst") { activity.Analyst = Find_Contact_By_Handle(SID, attribute.Element("AttrValue").Value).UserId; } if (attribute.Element("AttrName").Value == "description") { activity.Description = attribute.Element("AttrValue").Value.Trim(); } } activityLog.Add(activity); } return(activityLog); }
public static List <SDM_Contact> Get_VIPContacts(int SID) { SDMWS.USD_WebServiceSoapClient ws_client = WebServiceSoapClient(); var rawXml = ws_client.doSelect(SID, "special_handling", @"description LIKE '%VIP'", -1, new string[] { "persistent_id" }); XDocument ReturnedXml = XDocument.Parse(rawXml); string persistentId = ""; foreach (var attribute in ReturnedXml.Descendants("Attribute")) { if (attribute.Element("AttrName").Value == "persistent_id") { persistentId = attribute.Element("AttrValue").Value; } } SDMWS.ListResult getList = ws_client.getRelatedList(SID, persistentId, "cnthandling_list"); int listHandle = getList.listHandle; rawXml = ws_client.getListValues(SID, listHandle, 1, -1, new string[] { "contact" }); ReturnedXml = XDocument.Parse(rawXml); List <SDM_Contact> vipList = new List <SDM_Contact>(); foreach (var attributeSet in ReturnedXml.Descendants("Attributes")) { SDM_Contact nextVip = new SDM_Contact(); foreach (var attribute in attributeSet.Descendants("Attribute")) { if (attribute.Element("AttrName").Value == "contact") { string contactHandle = attribute.Element("AttrValue").Value.Trim(); nextVip = Find_Contact_By_Handle(SID, contactHandle); } } vipList.Add(nextVip); } return(vipList); }