コード例 #1
0
        static void Main(string[] args)
        {
            MdmServiceClient         client = new MdmServiceClient();
            LastTransactionInfoQuery query  = new LastTransactionInfoQuery();

            Console.WriteLine("Press any key to start benchmark");
            Console.ReadKey();
            Console.WriteLine("Benchmark running...");
            Stopwatch st = Stopwatch.StartNew();

            for (int i = 0; i < 10; i++)
            {
                var results = client.QueryLastTransactionInfo(query, 5, 1);
                Console.WriteLine("Service call " + (i + 1) + " Running: " + st.ElapsedMilliseconds.ToString() + "ms");
            }
            Console.WriteLine("Complete");
            Console.ReadKey();
        }
コード例 #2
0
        public static async void Search(CustomSearchControl SearchControl)
        {
            var client = Helper.getServiceClient();
            LastTransactionInfoQuery query = new LastTransactionInfoQuery(); //by default we have an empty query

            if (SearchControl.OptionOne.IsChecked == true)
            {
                query = new LastTransactionInfoQuery()
                {
                    ProductCode = SearchControl.SearchTextBox.Text
                };
            }
            else if (SearchControl.OptionTwo.IsChecked == true)
            {
                query = new LastTransactionInfoQuery()
                {
                    SubSystemCode = SearchControl.SearchTextBox.Text
                };
            }
            else if (SearchControl.OptionThree.IsChecked == true)
            {
                query = new LastTransactionInfoQuery()
                {
                    DocCode = SearchControl.SearchTextBox.Text
                };
            }

            int pagesize     = SearchControl.PageSize;
            int pagePosition = SearchControl.PagePosition;
            var response     = await client.QueryLastTransactionInfoAsync(query, pagesize, pagePosition);

            //No response; exit
            if (response == null)
            {
                MessageBox.Show("Service isn't responding, please try again later", "Message", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            SearchControl.ResultCount = response.TotalResultCount;
            //Fill the datagrid with the results
            SearchControl.ResultsGrid.ItemsSource = new ObservableCollection <ERP_LastTransactionInfo>(response.Result.ToList <ERP_LastTransactionInfo>());;
        }