Пример #1
0
        public async Task <GetContactsResponse> GetContacts(GetContactsRequest getContactsRequest)
        {
            this.logger.LogInfoMessage(this.GetType(), "Begin GetContacts");

            GetContactsResponse getContactsResponse = new GetContactsResponse();

            try
            {
                BaseResponse response = await this.contact.GetContacts();

                getContactsResponse.ContactDataList = (List <ContactData>)response.ReturnValueCustomObject;
                getContactsResponse.Build(response.ReturnValueInt,
                                          response.ReturnValueString,
                                          response.ReturnValueCustomString);
            }
            catch (Exception ex)
            {
                getContactsResponse.RunTimeException(ex, "Exception while Getting contacts.");
                this.logger.LogErrorMessage(this.GetType(), "Exception in GetContacts", ex);
            }

            this.logger.LogInfoMessage(this.GetType(),
                                       String.Format("End GetContacts:{0}", getContactsResponse.ReturnValueInt));

            return(getContactsResponse);
        }
Пример #2
0
        public async Task <GetContactsResponse> GetContacts(GetContactsRequest getContactsRequest)
        {
            this.logger.LogInfoMessage(this.GetType(), "Begin GetContacts");
            GetContactsResponse getContactsResponse = new GetContactsResponse();

            this.CheckInVariants(getContactsResponse);
            getContactsRequest = new GetContactsRequest();
            // Validate Request
            if (getContactsResponse.ReturnValueInt == 0)
            {
                getContactsRequest.Validate(getContactsResponse, this.logger);
            }

            if (getContactsResponse.ReturnValueInt == 0)
            {
                try
                {
                    Task <GetContactsResponse> task = this.core.GetContacts(getContactsRequest);
                    await task;

                    getContactsResponse.ContactDataList         = task.Result.ContactDataList;
                    getContactsResponse.ReturnValueInt          = task.Result.ReturnValueInt;
                    getContactsResponse.ReturnValueString       = task.Result.ReturnValueString;
                    getContactsResponse.ReturnValueCustomString = task.Result.ReturnValueCustomString;
                }
                catch (Exception e)
                {
                    getContactsResponse.RunTimeException(e, "Exception while Getting contacts.");
                }
            }

            if (getContactsResponse.ReturnValueInt == 0)
            {
                getContactsResponse.Success("Contact Get Successful.");
            }

            this.logger.LogInfoMessage(this.GetType(),
                                       String.Format("End GetContacts:{0}", getContactsResponse.ReturnValueInt));

            return(getContactsResponse);
        }