コード例 #1
0
 public Transaction(Context.IThreadContext threadContext, API.APIClient apiClient, ThreadId threadId, string collectionName)
 {
     this.ThreadContext = threadContext;
     Client             = apiClient;
     ThreadId           = threadId;
     CollectionName     = collectionName;
 }
コード例 #2
0
        public async Task LoadFromWeb()
        {
            var account = AccountHelper.LoadAccounts().FirstOrDefault();

            if (account == null)
            {
                return;
            }
            var client = new API.APIClient(account.User, account.Pwd);
            var method = new LogisticsServiceList();
            var lst    = await client.Execute(method);

            lst.ForEach(l => {
                var item = this.Datas.FirstOrDefault(d => d.Code.Equals(l.Code, StringComparison.OrdinalIgnoreCase));
                if (item == null)
                {
                    item = new LogisticServices()
                    {
                        Code = l.Code
                    };
                    this.Datas.Add(item);
                }

                item.CheckRegex      = l.CheckRule;
                item.Company         = l.Company;
                item.MaxProcessDays  = l.MaxProcessDays;
                item.MiniProcessDays = l.MinProcessDays;
                item.NameEn          = l.Name;
            });
        }
コード例 #3
0
        private void CreateClient()
        {
            //使用http协议
            AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
            var channel = GrpcChannel.ForAddress("http://127.0.0.1:8080");

            _client = new API.APIClient(channel);
        }
コード例 #4
0
        //[Import]
        //public IOrder OrderBiz { get; set; }

        public InternalOrderSync(string user, string pwd)
        {
            //
            GlobalData.MefContainer.ComposeParts(this);

            this.Api = new API.APIClient(user, pwd);
            this.OrderListReturned += OrderSync_OrderListReturned;
        }
コード例 #5
0
        private void btnExecute_Click(object sender, EventArgs e)
        {
            var api    = new API.APIClient(this.txtUser.Text, this.txtPwd.Text);
            var type   = this.cmbMethods.SelectedValue as Type;
            var method = this.propGrid.SelectedObject as AsNum.Xmj.API.MethodBase;

            //this.txtResult.Text = api.GetResult(method);
            this.jsonViewer1.Json = api.GetResult(method).Result;
        }
コード例 #6
0
        private async Task UpdateLevel()
        {
            var method = new API.Methods.BuyerLevel()
            {
                BuyerID = this.Order.BuyerID
            };
            var api    = AccountHelper.GetAccount(this.Order.Account);
            var client = new API.APIClient(api.User, api.Pwd);
            var level  = await client.Execute(method);

            var biz = GlobalData.GetInstance <IBuyer>();

            biz.UpdateLevel(this.Order.BuyerID, level);
            this.Level = level;

            this.NotifyOfPropertyChange(() => this.Level);
        }
コード例 #7
0
        public async Task <string> Query(string query)
        {
            VQLCollectorArgs vqlCollectorArgs = new VQLCollectorArgs
            {
                MaxWait = 1,
                MaxRow  = 100,
                Query   = { new VQLRequest {
                                Name = _configuration.Name, VQL = query
                            } }
            };

            var apiClient     = new API.APIClient(_channel);
            var streamResult  = apiClient.Query(vqlCollectorArgs);
            var resultElement = await streamResult.ResponseStream.ToListAsync();

            //_channel.ShutdownAsync().Wait();

            return(resultElement[resultElement.Count - 1].Response);
        }
コード例 #8
0
        /// <summary>
        /// 同步订单留言
        /// </summary>
        /// <param name="orderNO"></param>
        /// <param name="account"></param>
        /// <returns></returns>
        public async static Task <List <MessageDetail> > SyncByOrderNO(string orderNO, string account)
        {
            var ast = new AccountSetting();
            var ac  = ast.Value.FirstOrDefault(a => a.User == account);

            if (ac != null)
            {
                var api    = new API.APIClient(ac.User, ac.Pwd);
                var method = new MessageDetailList()
                {
                    ChannelID = orderNO,
                    Type      = MessageTypes.Order
                };
                var result = await api.Execute(method);

                return(result.ToList());
            }
            else
            {
                return(null);
            }
        }
コード例 #9
0
 public ReadTransaction(Context.IThreadContext threadContext, API.APIClient apiClient, ThreadId threadId, string collectionName) : base(threadContext, apiClient, threadId, collectionName)
 {
 }
コード例 #10
0
        //public int GetVolume()
        //{
        //    throw new NotImplementedException();
        //}

        //public void SetVolume(int v)
        //{
        //    throw new NotImplementedException();
        //}

        public void Dispose()
        {
            _currentProcess?.Kill();
            _currentProcess = null;
            _client         = null;
        }
コード例 #11
0
 /// <summary>
 /// Initializes a new instance with the specified configuration.
 /// </summary>
 /// <param name="threadContext"></param>
 /// <param name="mapper"></param>
 /// <param name="apiClient"></param>
 public ThreadClient(IThreadContext threadContext, IMapper mapper, API.APIClient apiClient)
 {
     this._threadContext = threadContext;
     this._mapper        = mapper;
     this._apiClient     = apiClient;
 }