public List <string> EnterpriseList(string guid)
        {
            List <string> result = new List <string>();

            var response = GetBusinessEntityByGuid(guid);

            int cnt = 0;

            if (response != null)
            {
                if (response.businessEntity.activityLocation == null)
                {
                    LastError.SetError("Список площадок пуст");
                }
                else
                {
                    cnt = response.businessEntity.activityLocation.Count();

                    foreach (var item in response.businessEntity.activityLocation)
                    {
                        result.Add(item.enterprise.name);
                    }
                }
            }

            return(result);
        }
Example #2
0
        public submitApplicationResponse AppRequest(string issuerId, XmlElement data)
        {
            //var mod = data.ToString();

            submitApplicationResponse response = null;

            var req = new submitApplicationRequest
            {
                apiKey      = ApiKey,
                application = new Application
                {
                    serviceId          = "mercury-g2b.service:2.0",
                    issuerId           = issuerId,
                    issueDate          = DateTime.Now,
                    issueDateSpecified = true,
                    data = new ApplicationDataWrapper
                    {
                        Any = data
                    }
                }
            };

            try
            {
                response = service.submitApplicationRequest(req);
            }
            catch (FaultException <FaultInfo> ex)
            {
                LastError.SetError(ex);
                Common.ServiceModelExceptionToString(ex);
            }

            return(response);
        }
        private getBusinessEntityByGuidResponse GetBusinessEntityByGuid(string Guid)
        {
            var req = new getBusinessEntityByGuidRequest
            {
                guid = Guid
            };

            var res = new ResultInfo();

            getBusinessEntityByGuidResponse response = null;

            try
            {
                response = service.GetBusinessEntityByGuid(req);
            }
            catch (System.ServiceModel.FaultException <FaultInfo> e)
            {
                LastError.SetError(e);
            }

            return(response);
        }
Example #4
0
        public T Merc_getResponse <T>(string issuerId, string applicationId) where T : class, new()
        {
            T deserialized = null;

            receiveApplicationResultResponse response = AppResponse(issuerId, applicationId);

            if (response.application.status == ApplicationStatus.IN_PROCESS)
            {
                LastError.SetError(response.application.status);
            }
            else
            {
                //int cnt = 0;
                //int max = 10;
                //bool continueRequest = true;

                //var perf1 = DateTime.Now;

                //while ((cnt < max) && (continueRequest))
                //{
                //    cnt++;

                //    response = AppResponse(issuerId, applicationId);
                //    continueRequest = (response?.application?.result == null);
                //    if (continueRequest)
                //    {
                //        Thread.Sleep(500);
                //    }
                //}

                //var perfEnd = DateTime.Now - perf1;

                deserialized = Deserialize <T>(response?.application?.result?.Any);
            }

            return(deserialized);
        }