/// <inheritdoc/> public IOrganization GetOrganizationById(long id) { IOrganization org = (IOrganization)ModelBase.Deserialize(this, GetRequestResponseElement(string.Format("organizations/{0}", id))); return(org); }
/// <inheritdoc/> public IJob[] GetJobs(int page) { string requestPath = string.Format("{0}/jobs?page={1}", Path, page); return((IJob[])((ArrayList)ModelBase.Deserialize(Listen360, Listen360.GetRequestResponseElement(requestPath))).ToArray(typeof(IJob))); }
/// <inheritdoc/> public IOrganization[] GetEntryPoints(int page) { string requestPath = string.Format("organizations?page={0}", page); return((IOrganization[])((ArrayList)ModelBase.Deserialize(this, GetRequestResponseElement(requestPath))).ToArray(typeof(IOrganization))); }
/// <inheritdoc/> public IJob GetJobById(int id) { string requestPath = string.Format("{0}/jobs/{1}", Path, id); return((IJob)ModelBase.Deserialize(Listen360, Listen360.GetRequestResponseElement(requestPath))); }
/// <inheritdoc/> public ITechnician GetTechnicianById(int id) { string requestPath = string.Format("{0}/technicians/{1}", Path, id); return((ITechnician)ModelBase.Deserialize(Listen360, Listen360.GetRequestResponseElement(requestPath))); }
/// <inheritdoc/> public ICustomer GetCustomerById(long id) { string requestPath = string.Format("{0}/customers/{1}", Path, id); return((ICustomer)ModelBase.Deserialize(Listen360, Listen360.GetRequestResponseElement(requestPath))); }
/// <summary> /// Loads an XML fragment obtained from the remote service into the model instance. /// </summary> /// <param name="node">The XML fragment representing the model instance.</param> protected void LoadXml(XmlNode node) { ClearErrors(); if (node == null) { return; } if (node.Name == "errors") { ArrayList errors = new ArrayList(node.ChildNodes.Count); foreach (XmlNode childNode in node.ChildNodes) { if (childNode.NodeType != XmlNodeType.Element) { continue; } errors.Add(childNode.InnerText); } _errors = (string[])errors.ToArray(typeof(string)); return; } _attributes.Clear(); foreach (XmlNode childNode in node.ChildNodes) { if (childNode.NodeType != XmlNodeType.Element) { continue; } if (childNode.Attributes["nil"] != null && childNode.Attributes["nil"].Value == "true") { continue; } string rubyType = (childNode.Attributes["type"] == null) ? null : childNode.Attributes["type"].Value; string stringValue = childNode.InnerText; object nativeValue = null; switch (rubyType) { case "integer": var name = childNode.Name.ToLower(); if (name == "id" || name == "parent-id" || name == "organization-id" || name == "customer-id" || name == "root-id") { long tempLong; nativeValue = Int64.TryParse(stringValue, out tempLong) ? (long?)tempLong : (long?)null; } else { int tempInt; nativeValue = Int32.TryParse(stringValue, out tempInt) ? (int?)tempInt : (int?)null; } break; case "decimal": decimal tempDecimal; nativeValue = Decimal.TryParse(stringValue, out tempDecimal) ? (decimal?)tempDecimal : (decimal?)null; break; case "float": float tempFloat; nativeValue = float.TryParse(stringValue, out tempFloat) ? (float?)tempFloat : (float?)null; break; case "datetime": DateTime tempDateTime; nativeValue = DateTime.TryParse(stringValue, out tempDateTime) ? (DateTime?)tempDateTime : (DateTime?)null; break; case "boolean": bool tempBool; nativeValue = bool.TryParse(stringValue, out tempBool) ? (bool?)tempBool : (bool?)null; break; case "array": ArrayList list = new ArrayList(); ModelBase.Deserialize(Listen360, childNode, list); nativeValue = list; break; case null: nativeValue = stringValue; break; default: ModelBase.Deserialize(Listen360, childNode); break; } _attributes[childNode.Name] = nativeValue; } }
/// <inheritdoc/> public virtual IOrganization[] GetDescendents(int page) { string requestPath = string.Format("organizations/{0}/descendents?page={1}", Id, page); return((IOrganization[])((ArrayList)ModelBase.Deserialize(Listen360, Listen360.GetRequestResponseElement(requestPath))).ToArray(typeof(IOrganization))); }