Example #1
0
        public void startListing()
        {
            int          itemCount = 0;
            string       eBayItems = "0";
            MySQLWrapper s         = null;

            try
            {
                s         = new MySQLWrapper();
                eBayItems = s.getItemCount();
                if (eBayItems == "0")
                {
                    throw new Exception("No items found in database");
                }
                reportTotalItems(eBayItems);
                changeStatus("Initializing...");
                addLogStatus("Initializing...");

                if (!initialize())
                {
                    throw new Exception("ERROR : Unable to connect to eBay Service");
                }
                MySQLWrapper.eBayData ebayData = new MySQLWrapper.eBayData();
                MySQLWrapper.eBayItem item;
                string listedItemId    = "-1";
                string generatedItemId = "-1";
                while (ebayData.hasNext() && eBayLister.Program.mainForm.listingContinue)
                {
                    listedItemId    = "-1";
                    generatedItemId = "-1";
                    itemCount++;
                    reportProgress(itemCount.ToString());


                    item         = ebayData.getItem();
                    listedItemId = s.checkIfListed(item.SKU);
                    if (listedItemId != "-1")
                    {
                        if (item.Quantity == 0)
                        {
                            addLogStatus("Removing item " + item.SKU);
                            removeItem(listedItemId, item.SKU);
                            s.deleteTempItem(item.SKU);
                            s.deleteListedItem(item.SKU);
                            s.addToLogs(item.SKU, "Deleted");
                        }
                        else
                        {
                            addLogStatus("Modifying item " + item.SKU);
                            modifyItem(listedItemId, item.SKU, item.Quantity);
                            s.deleteTempItem(item.SKU);
                            s.addToLogs(item.SKU, "Quantity changed to " + item.Quantity);
                        }
                    }
                    else
                    {
                        addLogStatus("Listing item " + item.SKU);
                        generatedItemId = addItem(item);
                        if (generatedItemId != "-1")
                        {
                            s.deleteTempItem(item.SKU);
                            s.addListedItem(item.SKU, generatedItemId);
                            s.addToLogs(item.SKU, "Listed with Item Id : " + generatedItemId);
                        }
                    }
                }
                if (eBayLister.Program.mainForm.listingContinue)
                {
                    addLogStatus("Done!");
                }
            }
            catch (Exception ex) {
                addLogStatus("ERROR : " + ex.Message);
            }
            finally{
                s.destroy();
                destroy();
            }
        }
Example #2
0
        public void startListing()
        {
            int itemCount = 0;
            string eBayItems = "0";
            MySQLWrapper s = null;
            try
            {
                s = new MySQLWrapper();
                eBayItems = s.getItemCount();
                if (eBayItems == "0")
                    throw new Exception("No items found in database");
                reportTotalItems(eBayItems);
                changeStatus("Initializing...");
                addLogStatus("Initializing...");

                if (!initialize())
                    throw new Exception("ERROR : Unable to connect to eBay Service");
                MySQLWrapper.eBayData ebayData = new MySQLWrapper.eBayData();
                MySQLWrapper.eBayItem item;
                string listedItemId = "-1";
                string generatedItemId = "-1";
                while (ebayData.hasNext() && eBayLister.Program.mainForm.listingContinue)
                {
                    listedItemId = "-1";
                    generatedItemId = "-1";
                    itemCount++;
                    reportProgress(itemCount.ToString());

                    item = ebayData.getItem();
                    listedItemId = s.checkIfListed(item.SKU);
                    if (listedItemId != "-1")
                    {
                        if (item.Quantity == 0)
                        {
                            addLogStatus("Removing item " + item.SKU);
                            removeItem(listedItemId, item.SKU);
                            s.deleteTempItem(item.SKU);
                            s.deleteListedItem(item.SKU);
                            s.addToLogs(item.SKU, "Deleted");
                        }
                        else
                        {
                            addLogStatus("Modifying item " + item.SKU);
                            modifyItem(listedItemId, item.SKU, item.Quantity);
                            s.deleteTempItem(item.SKU);
                            s.addToLogs(item.SKU, "Quantity changed to " + item.Quantity);
                        }
                    }
                    else
                    {
                        addLogStatus("Listing item " + item.SKU);
                        generatedItemId = addItem(item);
                        if (generatedItemId != "-1")
                        {
                            s.deleteTempItem(item.SKU);
                            s.addListedItem(item.SKU, generatedItemId);
                            s.addToLogs(item.SKU, "Listed with Item Id : " + generatedItemId);
                        }
                    }

                }
                if(eBayLister.Program.mainForm.listingContinue)
                    addLogStatus("Done!");
            }
            catch (Exception ex) {
                addLogStatus("ERROR : " + ex.Message);
            }
            finally{
                s.destroy();
                destroy();
            }
        }