Exemple #1
0
        /// <inheritdoc/>
        public virtual bool Save()
        {
            string diff = SerializeChanges();

            ClearErrors();

            if (IsNewRecord)
            {
                XmlNode node = Listen360.GetRequestResponseElement(CreatePath, diff, HttpVerb.Post);
                LoadXml(node);
            }
            else
            {
                XmlNode node = Listen360.GetRequestResponseElement(UpdatePath, diff, HttpVerb.Put);
                if (node != null)
                {
                    LoadXml(node);
                }
            }

            if (IsValid)
            {
                ClearChanges();
            }

            return(IsValid);
        }
        /// <inheritdoc/>
        public IJob FindJobByReference(string reference)
        {
            string    requestPath = string.Format("{0}/jobs?reference={1}", Path, System.Uri.EscapeUriString(reference));
            ArrayList matches     = (ArrayList)(ModelBase.Deserialize(Listen360, Listen360.GetRequestResponseElement(requestPath)));
            IJob      match       = (matches.Count == 0) ? null : (IJob)matches[0];

            return(match);
        }
        /// <inheritdoc/>
        public IMembership FindMembershipByEmail(string email)
        {
            string      requestPath = string.Format("{0}/memberships?email={1}", Path, System.Uri.EscapeUriString(email));
            ArrayList   matches     = (ArrayList)(ModelBase.Deserialize(Listen360, Listen360.GetRequestResponseElement(requestPath)));
            IMembership match       = (matches.Count == 0) ? null : (IMembership)matches[0];

            return(match);
        }
        /// <inheritdoc/>
        public virtual IOrganization FindDescendentByReference(string reference)
        {
            string        requestPath = string.Format("organizations/{0}/descendents?reference={1}", Id, System.Uri.EscapeUriString(reference));
            ArrayList     matches     = (ArrayList)(ModelBase.Deserialize(Listen360, Listen360.GetRequestResponseElement(requestPath)));
            IOrganization match       = (matches.Count == 0) ? null : (IOrganization)matches[0];

            return(match);
        }
        /// <inheritdoc/>
        public ICustomAttributeDefinition[] GetCustomAttributeDefinitions()
        {
            string requestPath = string.Format("organizations/{0}/custom_attribute_definitions", Id);

            return((ICustomAttributeDefinition[])((ArrayList)ModelBase.Deserialize(Listen360, Listen360.GetRequestResponseElement(requestPath))).ToArray(typeof(ICustomAttributeDefinition)));
        }
        /// <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 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)));
        }
Exemple #10
0
 /// <inheritdoc/>
 public virtual void Reload()
 {
     ClearChanges();
     LoadXml(Listen360.GetRequestResponseElement(Path));
 }
        /// <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)));
        }
Exemple #12
0
        /// <inheritdoc/>
        public void SendSurveyInvite()
        {
            string requestPath = string.Format("{0}/send_survey_invite", Path);

            Listen360.GetRequestResponseElement(requestPath, null, HttpVerb.Post);
        }