public void GeteBayOfficialTime()
        {
            GeteBayOfficialTimeCall api = new GeteBayOfficialTimeCall(this.apiContext);

            System.DateTime time = api.GeteBayOfficialTime();
            Assert.IsTrue(time > DateTime.Now.AddMonths(-1));
        }
        /// <summary>
        /// The process of the command
        /// </summary>
        /// <param name="commerceContext">
        /// The commerce context
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public async Task <DateTime> GetEbayTime(CommerceContext commerceContext)
        {
            using (var activity = CommandActivity.Start(commerceContext, this))
            {
                //Instantiate the call wrapper class
                GeteBayOfficialTimeCall apiCall = new GeteBayOfficialTimeCall(await GetEbayContext(commerceContext).ConfigureAwait(false));

                //Send the call to eBay and get the results
                try
                {
                    var ebayConfig = await this._commerceCommander.GetEntity <EbayConfigEntity>(commerceContext, "Entity-EbayConfigEntity-Global", true).ConfigureAwait(false);

                    if (ebayConfig.HasComponent <EbayBusinessUserComponent>())
                    {
                        var ebayConfigComponent = ebayConfig.GetComponent <EbayBusinessUserComponent>();
                        if (!string.IsNullOrEmpty(ebayConfigComponent.EbayToken))
                        {
                            DateTime officialTime = apiCall.GeteBayOfficialTime();
                            return(officialTime);
                        }
                    }
                }
                catch (Exception ex)
                {
                    commerceContext.Logger.LogError($"Ebay.GetEbayTime.Exception: Message={ex.Message}");
                    await commerceContext.AddMessage("Error", "Ebay.GetEbayTime.Exception", new Object[] { ex }, ex.Message).ConfigureAwait(false);
                }

                //Handle the result returned
                //Console.WriteLine("eBay official Time: " + officialTime);

                return(new DateTime());
            }
        }
Пример #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("+++++++++++++++++++++++++++++++++++++++");
            Console.WriteLine("+ Welcome to eBay SDK for .Net Sample +");
            Console.WriteLine("+ - HelloWorld                        +");
            Console.WriteLine("+++++++++++++++++++++++++++++++++++++++");

            //[Step 1] Initialize eBay ApiContext object
            ApiContext apiContext = GetApiContext();


            //[Step 2] Create Call object and execute the Call
            GeteBayOfficialTimeCall apiCall = new GeteBayOfficialTimeCall(apiContext);

            Console.WriteLine("Begin to call eBay API, please wait ...");
            DateTime officialTime = apiCall.GeteBayOfficialTime();

            Console.WriteLine("End to call eBay API, show call result:");

            //[Step 3] Handle the result returned
            Console.WriteLine("eBay official Time: " + officialTime);
            Console.WriteLine();
            Console.WriteLine("Press any key to close the program.");
            Console.ReadKey();
        }
Пример #4
0
        private void BtnGeteBayOfficialTime_Click(object sender, System.EventArgs e)
        {
            try
            {
                GeteBayOfficialTimeCall apicall = new GeteBayOfficialTimeCall(Context);

                DatePickOfficialTime.Value = apicall.GeteBayOfficialTime();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #5
0
 public static void RampUp()
 {
     try
     {
         ApiContext ctx = GetContext();
         GeteBayOfficialTimeCall call = new GeteBayOfficialTimeCall(ctx);
         call.Site = SiteCodeType.US;
         call.Execute();
     }
     catch (Exception e)
     {
         ShowException("GeteBayOfficialTimeCall()", e);
     }
 }
Пример #6
0
        private bool initialize()
        {
            GeteBayOfficialTimeCall apiCall = new GeteBayOfficialTimeCall(context);

            try
            {
                string eBayTime = apiCall.GeteBayOfficialTime().ToString();
                Console.WriteLine(eBayTime);
                return(true);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message + "\r\nPlease check Configuration", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
Пример #7
0
        public static DateTime GetEBayDate(ApiContext apiContext, out TimeSpan TimeDiff)
        {
            LogManager.RecordMessage("Starting a GeteBayOfficialTime call");
            Blink();

            Stopwatch s = Stopwatch.StartNew();
            GeteBayOfficialTimeCall timeCall = new GeteBayOfficialTimeCall(apiContext);
            DateTime eBayDate = timeCall.GeteBayOfficialTime();

            TimeDiff = DateTime.Now - eBayDate;
            eBayClass.Metrics.GenerateReport(eBayClass.LogManager.ApiLoggerList[0]);
            s.Stop();
            Blink();

            eBayClass.LogManager.RecordMessage("Done; ms: " + s.ElapsedMilliseconds.ToString());
            Blink();
            return(eBayDate);
        }
Пример #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            Console.WriteLine("+++++++++++++++++++++++++++++++++++++++");
            Console.WriteLine("+ Welcome to eBay SDK for .Net Sample +");
            Console.WriteLine("+ - HelloWorld                        +");
            Console.WriteLine("+++++++++++++++++++++++++++++++++++++++");

            //[Step 1] Initialize eBay ApiContext object



            //[Step 2] Create Call object and execute the Call
            GeteBayOfficialTimeCall apiCall = new GeteBayOfficialTimeCall(apiContext);

            Console.WriteLine("Begin to call eBay API, please wait ...");
            DateTime officialTime = apiCall.GeteBayOfficialTime();

            this.textBox1.Text = officialTime.ToString();
        }