Exemple #1
0
        /// <summary>
        /// Builds an instance of an AlternateExtension object, filling it with the details of an alternate extension idenitified by the
        /// UserObjectID and the ObjectId of the alternate extension owned by that user.
        /// This AlternateExtension has already been created - you can use this to "re fill" an existing alternate extension with possibly
        /// updated information or if you created an "empty" AlternateExtension object and now want to populate it.
        /// </summary>
        /// <param name="pObjectId">
        /// The GUID identifying the alternate extension to fetch
        /// </param>
        /// <returns>
        /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface.
        /// </returns>
        private WebCallResult GetAlternateExtension(string pObjectId)
        {
            string strUrl = string.Format("{0}users/{1}/alternateextensions/{2}", HomeServer.BaseUrl, UserObjectId, pObjectId);

            //issue the command to the CUPI interface
            WebCallResult res = HomeServer.GetCupiResponse(strUrl, MethodType.GET, "");

            if (res.Success == false)
            {
                return(res);
            }

            try
            {
                JsonConvert.PopulateObject(ConnectionServerRest.StripJsonOfObjectWrapper(res.ResponseText, "AlternateExtension"), this,
                                           RestTransportFunctions.JsonSerializerSettings);
            }
            catch (Exception ex)
            {
                res.ErrorText = "Failure populating class instance form JSON response:" + ex;
                res.Success   = false;
            }

            //all the updates above will flip pending changes into the queue - clear that here.
            this.ClearPendingChanges();

            return(res);
        }
Exemple #2
0
        /// <summary>
        /// Fills the current instance of InterviewHandlerQuestion in with properties fetched from the server.
        /// </summary>
        /// <param name="pInterviewHandlerObjectId">
        /// Unique GUID of the interview handler this question is associatded with
        /// </param>
        /// <param name="pQuestionNumber">
        /// 1-20
        /// </param>
        /// <returns>
        /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface.
        /// </returns>
        private WebCallResult GetInterviewQuestion(string pInterviewHandlerObjectId, int pQuestionNumber)
        {
            if (string.IsNullOrEmpty(pInterviewHandlerObjectId))
            {
                return(new WebCallResult
                {
                    Success = false,
                    ErrorText = "No value for ObjectId or display name passed to GetInterviewHandler."
                });
            }

            string strUrl = string.Format("{0}handlers/interviewhandlers/{1}/interviewquestions/{2}", HomeServer.BaseUrl, pInterviewHandlerObjectId, pQuestionNumber);

            //issue the command to the CUPI interface
            WebCallResult res = HomeServer.GetCupiResponse(strUrl, MethodType.GET, "");

            if (res.Success == false)
            {
                return(res);
            }

            try
            {
                JsonConvert.PopulateObject(ConnectionServerRest.StripJsonOfObjectWrapper(res.ResponseText, "InterviewQuestion"), this,
                                           RestTransportFunctions.JsonSerializerSettings);
            }
            catch (Exception ex)
            {
                res.ErrorText = "Failure populating class instance form JSON response:" + ex;
                res.Success   = false;
            }

            return(res);
        }
Exemple #3
0
        /// <summary>
        /// Builds an instance of an MenuEntry object, filling it with the details of a menu entry idenitified by the
        /// CallHandlerObjectID and the key name of the menu entry.
        /// This MenuEntry has already been created - you can use this to "re fill" an existing menu entry with possibly
        /// updated information or if you created an "empty" MenuEntry object and now want to populate it.
        /// </summary>
        /// <param name="pKey">
        /// name of the menu entry to be fetched - can be 0-9, # or *
        /// </param>
        /// <returns>
        /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface.
        /// </returns>
        public WebCallResult GetMenuEntry(string pKey)
        {
            WebCallResult res;

            if (string.IsNullOrEmpty(pKey))
            {
                res           = new WebCallResult();
                res.ErrorText = "Empty menu entry key parameter passed to GetMenuEntry";
                return(res);
            }

            string strUrl = string.Format("{0}handlers/callhandlers/{1}/menuentries/{2}", HomeServer.BaseUrl, CallHandlerObjectId, pKey);

            //issue the command to the CUPI interface
            res = HomeServer.GetCupiResponse(strUrl, MethodType.GET, "");

            if (res.Success == false)
            {
                return(res);
            }

            try
            {
                JsonConvert.PopulateObject(ConnectionServerRest.StripJsonOfObjectWrapper(res.ResponseText, "MenuEntry"), this,
                                           RestTransportFunctions.JsonSerializerSettings);
            }
            catch (Exception ex)
            {
                res.ErrorText = "Failure populating class instance form JSON response:" + ex;
                res.Success   = false;
            }

            //all the updates above will flip pending changes into the queue - clear that here.
            this.ClearPendingChanges();
            return(res);
        }