/// <summary> /// Get all of the time frames in the system between two given dates /// </summary> /// <returns></returns> public TimeFrameResponse Get(int timeFrameId) { // Add the proper XML to the Call node XmlDocument newRequest = new XmlDocument(); newRequest.LoadXml(RequestBase.InnerXml); // ********************* Parameter *********************************** XmlNode argNode = newRequest.CreateElement("arg"); XmlAttribute nameAttribute = newRequest.CreateAttribute("name"); nameAttribute.Value = "timeframeid"; // ReSharper disable once PossibleNullReferenceException argNode.Attributes.Append(nameAttribute); argNode.AppendChild(newRequest.CreateTextNode(timeFrameId.ToString())); // Get the call node var callNode = newRequest.GetElementsByTagName("call")[0]; // Assumption this is here. It is built in the constructor callNode.AppendChild(argNode); // ************************** Actual Call ***************************** var eValueApiService = new EValueTimeFrameApi.TimeFrame_1_0Service() { Url = _url }; XmlDocument responseXml = new XmlDocument(); responseXml.LoadXml(eValueApiService.get(newRequest.InnerXml)); var result = ExtractSingleResponseFromXml(responseXml, timeFrameId); return(result); }
/// <summary> /// Get all of the time frames in the system between two given dates /// </summary> /// <returns></returns> public TimeFramesResponse GetAllTimeFrames(DateTime beginDate, DateTime endDate) { // Add the proper XML to the Call node XmlDocument newRequest = new XmlDocument(); newRequest.LoadXml(RequestBase.InnerXml); // ********************* Parameter *********************************** XmlNode argNode = newRequest.CreateElement("arg"); XmlAttribute nameAttribute = newRequest.CreateAttribute("name"); nameAttribute.Value = "startdate"; // ReSharper disable once PossibleNullReferenceException argNode.Attributes.Append(nameAttribute); argNode.AppendChild(newRequest.CreateTextNode(beginDate.ToShortDateString())); // Get the call node var callNode = newRequest.GetElementsByTagName("call")[0]; // Assumption this is here. It is built in the constructor callNode.AppendChild(argNode); // ********************* Parameter *********************************** XmlNode argNode2 = newRequest.CreateElement("arg"); XmlAttribute nameAttribute2 = newRequest.CreateAttribute("name"); nameAttribute2.Value = "enddate"; // ReSharper disable once PossibleNullReferenceException argNode2.Attributes.Append(nameAttribute2); argNode2.AppendChild(newRequest.CreateTextNode(endDate.ToShortDateString())); // Get the call node callNode.AppendChild(argNode2); // ********************* Parameter *********************************** XmlNode argNode3 = newRequest.CreateElement("arg"); XmlAttribute nameAttribute3 = newRequest.CreateAttribute("name"); nameAttribute3.Value = "statusid"; // ReSharper disable once PossibleNullReferenceException argNode3.Attributes.Append(nameAttribute3); argNode3.AppendChild(newRequest.CreateTextNode("1")); // Get the call node callNode.AppendChild(argNode3); // ************************** Actual Call ***************************** var eValueApiService = new EValueTimeFrameApi.TimeFrame_1_0Service() { Url = _url }; XmlDocument responseXml = new XmlDocument(); responseXml.LoadXml(eValueApiService.getAll(newRequest.InnerXml)); var result = ExtractResponseFromXml(responseXml); return(result); }