Exemple #1
0
        private ServiceStack.IJsonServiceClient getClient()
        {
            ServiceStack.JsonServiceClient client = new ServiceStack.JsonServiceClient(SERVICEAPI_URL);
            client.UserName = _loginDetails.Name;
            client.Password = _loginDetails.Password;
            client.AlwaysSendBasicAuthHeader = true;

            return(client);
        }
Exemple #2
0
        public async Task <PricingQuoteResponse> Get(PricingQuote quote)
        {
            var composedResult = new PricingQuoteResponse();
            var watch          = Stopwatch.StartNew();

            // call pricing services concurrently
            Task <AppraisalQuoteResponse> appraisalResult;
            var appraisalQuote = new AppraisalQuote()
            {
                ProductType = quote.AppraisalProductType, EffectiveDate = quote.EffectiveDate, StateCode = quote.PropertyState, FromCache = quote.FromCache
            };

            using (var client = new ServiceStack.JsonServiceClient("http://pricing-appraisal:5001"))
                appraisalResult = client.GetAsync <AppraisalQuoteResponse>(appraisalQuote);

            Task <FeeScheduleQuoteResponse> feeScheduleResult;
            var feeSchedQuote = new FeeScheduleQuote()
            {
                ProductType = quote.ClosingProductType, EffectiveDate = quote.EffectiveDate, StateCode = quote.PropertyState, FromCache = quote.FromCache
            };

            using (var client = new ServiceStack.JsonServiceClient("http://pricing-feeschedule:5002"))
                feeScheduleResult = client.GetAsync <FeeScheduleQuoteResponse>(feeSchedQuote);

            //Task<UnderwriterQuoteResponse> underwriterResult;
            //var underwriterQuote = new UnderwriterQuote() { ProductType = quote.TitleProductType, EffectiveDate = quote.EffectiveDate, StateCode = quote.PropertyState, FromCache = quote.FromCache };
            //using (var client = new ServiceStack.JsonServiceClient("http://localhost:1339"))
            //    underwriterResult = client.GetAsync<UnderwriterQuoteResponse>(underwriterQuote);

            //Task<RecordingQuoteResponse> recordingResult;
            //var recordingQuote = new RecordingQuote() { ProductType = quote.RecordingDocumentType, EffectiveDate = quote.EffectiveDate, StateCode = quote.PropertyState, FromCache = quote.FromCache };
            //using (var client = new ServiceStack.JsonServiceClient("http://localhost:1340"))
            //    recordingResult = client.GetAsync<RecordingQuoteResponse>(recordingQuote);

            // compose results and return once they've all come back
            //await Task.WhenAll(appraisalResult, feeScheduleResult, underwriterResult, recordingResult);

            composedResult.AppraisalNotes   = (await appraisalResult).Notes;
            composedResult.AppraisalFee     = (await appraisalResult).Fee;
            composedResult.FeeScheduleNotes = (await feeScheduleResult).Notes;
            composedResult.FeeScheduleFee   = (await feeScheduleResult).Fee;
            //composedResult.UnderwriterNotes = (await underwriterResult).Notes;
            //composedResult.UnderwriterFee = (await underwriterResult).Fee;
            //composedResult.RecordingNotes = (await recordingResult).Notes;
            //composedResult.RecordingFee = (await recordingResult).Fee;

            watch.Stop();
            Debug.WriteLine(string.Format("GetPricingQuote completed in {0} milliseconds", watch.ElapsedMilliseconds));

            return(composedResult);
        }
        /// <summary>
        /// 通过委托编号从起重数据库中获取二维码信息
        /// </summary>
        /// <param name="entrNums"></param>
        /// <returns></returns>
        public string GetQzQrcodeBar(string entrNums)
        {
            if (entrNums.IsNullOrEmpty())
            {
                return(string.Empty);
            }

            var client = new ServiceStack.JsonServiceClient(GetSceneDataUrl);

            QzQrcodeBar request = new QzQrcodeBar();

            request.entrNum = entrNums;
            var responses = client.Get(request);

            if (responses.IsSucc)
            {
                return(responses.qrinfo);
            }
            else
            {
                return(string.Empty);
            }
        }
        static void Main(string[] args)
        {
            try
            {
                using (var service = new ServiceStack.JsonServiceClient("https://platform.gaelenlighten.com/api"))
                {
                    service.Headers.Add("Tenant", "yourtenant.gaelenlighten.com"); // Add your tenant here
                    var token = "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes("yourusername:yourpassword")); // Add your username and password here
                    service.Headers.Add("Authorization", token);

                    var response = service.Send<GetReportsResponse>(new GetReports
                    {
                        //// Specify filters
                        ReportStatus = ReportStatus.Open,
                        Take = 100,
                        Skip = 0
                    });

                    var reportList = response.Reports;
                    foreach (var report in reportList)
                    {
                        ////Example of iterating through the report list
                    }
                    response.PrintDump();

                    Console.ReadLine();
                }
            }
            catch (WebServiceException ex)
            {
                if (ex.StatusCode == 429)
                {
                    // Too many request. Wait and try again later
                }
                throw new Exception("PlatformAPI: " + ex.ErrorMessage, ex);
            }
        }
Exemple #5
0
        private void ProcessOnUpdateMessage(ServerEventMessage e)
        {
            var msg = new ServerEventUpdate().Populate(e, JsonServiceClient.ParseObject(e.Json));

            OnCommandReceived(msg);
        }