コード例 #1
0
        /* the event for excel button clicks that update the merchant sku */
        private void excelButton_Click(object sender, EventArgs e)
        {
            if (openFileDialog.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            switch (loadingLabel.Text)
            {
            case "Sears":
            {
                // sears case
                sears = new Sears();
                new Thread(() => sears.Update(openFileDialog.FileName)).Start();

                shopCa     = null;
                amazon     = null;
                giantTiger = null;
            }
            break;

            case "Shop.ca":
            {
                // shop.ca case
                shopCa = new ShopCa();
                new Thread(() => shopCa.Update(openFileDialog.FileName)).Start();

                sears      = null;
                giantTiger = null;
                amazon     = null;
            }
            break;

            case "Amazon":
            {
                // amazon case
                amazon = new Amazon();
                new Thread(() => amazon.Update(openFileDialog.FileName)).Start();

                sears      = null;
                shopCa     = null;
                giantTiger = null;
            }
            break;

            case "Giant Tiger":
            {
                // giant tiger case
                giantTiger = new GiantTiger();
                new Thread(() => giantTiger.Update(openFileDialog.FileName)).Start();

                sears  = null;
                shopCa = null;
                amazon = null;
            }
            break;
            }

            timer.Start();
        }
コード例 #2
0
        /* button event for update that refresh the inventory data in shop.ca */
        private void updateButton_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            #region Processing
            // local fields
            List <ShopCaInventoryValues> list = new List <ShopCaInventoryValues>();
            ShopCa shopCa = new ShopCa();

            foreach (DataRow row in table.Rows)
            {
                // check the discontinue item to udpate database
                bool discontinue = Convert.ToBoolean(row[6]);
                if (discontinue)
                {
                    shopCa.Discontinue(row[0].ToString());
                }

                if (row[1].ToString() == "")
                {
                    continue;
                }
                ShopCaInventoryValues value = new ShopCaInventoryValues(row[0].ToString(), Convert.ToInt32(row[2]), Convert.ToBoolean(row[5]), discontinue,
                                                                        DateTime.Today.AddDays(Convert.ToInt32(availableDaysUpdown.Value)), Convert.ToInt32(row[3]), row[1].ToString());
                list.Add(value);
            }

            // start updating
            try
            {
                shopCa.Update(list.ToArray());
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error occurs during updating:\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            #endregion

            Cursor.Current = Cursors.Default;

            // show complete message
            MessageBox.Show("Inventory update complete to Shop.ca");
        }