Example #1
0
        /// <summary>
        /// Connect to SOAP service and retrieve list of auctions
        /// </summary>
        /// <param name="type">Auction collection to retrieve</param>
        /// <returns></returns>
        private List <String> getRawData(String type)
        {
            List <String> rawData = new List <String>();
            long          userid;
            long          servertime;

            //connect to Allegro
            String sessionHandle = sessionHandle = allegroWebApiService.doLogin(data.userLogin, data.userPassword, data.countryCode, data.webapiKey, data.localVersion, out userid, out servertime);

            //data are retrieved in chunks of 100. Loop and retrieve all data
            bool endOfData = false;
            int  start     = 0;

            while (!endOfData)
            {
                //get structure containing all the data
                MyAccountStruct2[] results = allegroWebApiService.doMyAccount2(sessionHandle, type, start, new int[] { }, 100);
                start += 100;

                //Are there any data to retrieve left?
                if (results.Length == 0)
                {
                    endOfData = true;
                }

                //add all returend items' id and title to list
                foreach (MyAccountStruct2 result in results)
                {
                    rawData.Add(result.myaccountarray[MYACCOUNTSTRUCT_ID_INDEX] + "-" + result.myaccountarray[MYACCOUNTSTRUCT_TITLE_INDEX]);
                }
            }

            return(rawData);
        }
Example #2
0
        public string LogIn(string sessionHandler, long version, AllegroWebApiService service)
        {
            long offset     = 0;
            long serverTime = 0;

            try
            {
                sessionHandler = service.doLogin(login, pass, 1, apiKey, version, out offset, out serverTime);
            }
            catch
            {
                //Shower.Items.Add("Logowanie się nie powiodło");
                MessageBoxResult wrongResult = MessageBox.Show("Błąd w session Handlerze", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                if (wrongResult == MessageBoxResult.OK)
                {
                    Application.Current.Shutdown();
                }
            }
            return(sessionHandler);
        }