Exemplo n.º 1
0
        private void 浏览BToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.listView.SelectedItems == null || this.listView.SelectedItems.Count == 0)
            {
                return;
            }

            ListViewItem item  = this.listView.SelectedItems[0];
            FenXiaoModel model = item.Tag as FenXiaoModel;

            string url = "http://item.taobao.com/item.htm?id=" + model.ID;

            Process.Start(url);
        }
Exemplo n.º 2
0
        private void BtnChangeTitle_Click(object sender, EventArgs e)
        {
            if (listView.SelectedItems == null || listView.SelectedItems.Count == 0)
            {
                return;
            }

            ListViewItem item  = listView.SelectedItems[0];
            FenXiaoModel model = item.Tag as FenXiaoModel;

            TongKuanFrm form = new TongKuanFrm();

            form.Title     = model.Title;
            form.Vender    = model.Partener;
            form.ProductID = model.ID;
            form.NewTitle  = model.NewTitle;
            if (form.ShowDialog() == DialogResult.OK)
            {
                model.NewTitle = form.NewTitle;

                // 新标题
                item.SubItems[1].Text = model.NewTitle;
            }
        }
Exemplo n.º 3
0
        public void SetOnSell()
        {
            List <FenXiaoModel> list = this.allProductList;

            if (list == null || list.Count == 0)
            {
                BtnOnSell.Enabled = true;
                return;
            }

            if (onSellClickIndex < list.Count)
            {
                for (; onSellClickIndex < list.Count;)
                {
                    FenXiaoModel model = list[onSellClickIndex];
                    ListViewItem item  = listView.Items[onSellClickIndex];
                    if (!item.Checked)
                    {
                        onSellClickIndex++;
                        continue;
                    }
                    if (model.TitleStatus == "已提交")
                    {
                        onSellClickIndex++;
                        continue;
                    }

                    if (!string.IsNullOrEmpty(model.TitleStatus) &&
                        model.TitleStatus != "已提交" &&
                        string.IsNullOrEmpty(model.NewTitle))
                    {
                        string title = TongKuan.TongKuanManager.GetNewTitle(model.Title, model.Partener);
                        if (string.IsNullOrEmpty(title))
                        {
                            // 商家原始名称
                            model.NewTitle = model.Title;
                        }
                        else
                        {
                            // 同款销量高的名称
                            model.NewTitle = title;
                        }
                    }
                    if (numericUpdatePrice.Value != 0)
                    {
                        model.ChangePrice = numericUpdatePrice.Value;
                    }

                    onSellClickIndex++;

                    if (editProductFrm == null || editProductFrm.IsDisposed)
                    {
                        editProductFrm = DockContext.Current.Show(typeof(EditProductFrm), this) as EditProductFrm;
                    }
                    else
                    {
                        if (!editProductFrm.Visible)
                        {
                            editProductFrm.Show();
                        }
                    }
                    editProductFrm.Run(model);

                    item.SubItems[7].Text = "已提交";
                    model.TitleStatus     = "已提交";
                    return;
                }
            }

            BtnOnSell.Enabled = true;

            if (editProductFrm != null && !editProductFrm.IsDisposed)
            {
                DockContext.Current.Close(typeof(EditProductFrm));
                this.editProductFrm = null;
            }
        }
Exemplo n.º 4
0
        private bool Filter(FenXiaoModel model)
        {
            if (checkBoxInventory.Checked && model.Inventory != "有货")
            {
                addFenXiaoProductTimer.Start();
                return(true);
            }
            if (!string.IsNullOrEmpty(model.F))
            {
                addFenXiaoProductTimer.Start();
                return(true);
            }
            decimal priceFrom;

            if (decimal.TryParse(model.PriceFrom, out priceFrom))
            {
                decimal filterPrice = numericPriceFrom.Value;
                if (filterPrice < 0)
                {
                    filterPrice = 0;
                }

                // 价格过滤
                if (priceFrom <= filterPrice)
                {
                    addFenXiaoProductTimer.Start();
                    return(true);
                }
            }

            if (numericSellCount.Value > 0)
            {
                // 成交笔数
                int count;
                if (int.TryParse(model.SellCount, out count))
                {
                    if (count < numericSellCount.Value)
                    {
                        addFenXiaoProductTimer.Start();
                        return(true);
                    }
                }
            }

            DateTime sellDate = dateTimeUpdateDate.Value;

            if (sellDate > DateTime.Parse("2000-01-01"))
            {
                DateTime onSellDate;
                if (DateTime.TryParse(model.UpdateDate, out onSellDate))
                {
                    if (onSellDate < sellDate)
                    {
                        addFenXiaoProductTimer.Start();
                        return(true);
                    }
                }
            }

            return(false);
        }
Exemplo n.º 5
0
        private void addFenXiaoProductTimer_Tick(object sender, EventArgs e)
        {
            addFenXiaoProductTimer.Enabled = false;

            if (!startPublishNewProduct)
            {
                return;
            }

            int maxFenXiaoCount = (int)numericPerPage.Value;

            if (maxFenXiaoCount > 0)
            {
                if (addProductCount >= maxFenXiaoCount)
                {
                    return;
                }
            }

            if (fenxiaoProductListIndex < fenxiaoProductList.Count)
            {
                int findProductIndex = fenxiaoProductListIndex;
                fenxiaoProductListIndex++;

                FenXiaoModel model = fenxiaoProductList[findProductIndex];

                if (Filter(model))
                {
                    return;
                }

                HtmlElement           table = manager.FindID("J_MyItemList");
                HtmlElementCollection trCol = table.GetElementsByTagName("tr");

                HtmlElement tr = trCol[findProductIndex];
                HtmlElement a  = manager.FindClassName("J_download", tr);

                if (a != null)
                {
                    addProductCount++;

                    int y = manager.GetYoffset(a);
                    manager.ToY(y - 100);

                    manager.Browser.Task = "PublishProduct";
                    manager.ClickHelemnt(a);

                    checkDownTimer.Start();
                }
            }
            else
            {
                // 仅当前页
                if (checkBoxCurrentOnly.Checked)
                {
                    return;
                }

                // next Page
                manager.Browser.Task = "Publish";

                HtmlElement next = manager.FindClassName("page-next");
                if (next != null)
                {
                    manager.ClickHelemnt(next);
                }
                else
                {
                    if (publishAllVender)
                    {
                        Vender();
                    }
                }
            }
        }
Exemplo n.º 6
0
        private void clickTimer_Tick(object sender, EventArgs e)
        {
            this.clickTimer.Enabled = false;

            FenXiaoModel model = this.editProductBrowser.Browser.Tag as FenXiaoModel;

            if (model == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(model.TitleStatus))
            {
                HtmlElement element = this.editProductBrowser.Browser.Document.GetElementById("TitleID");
                if (element == null)
                {
                    return;
                }

                element.SetAttribute("value", model.NewTitle);
            }

            if (model.ChangePrice != 0)
            {
                HtmlElement element = this.editProductBrowser.FindID("buynow");
                string      price   = element.GetAttribute("value");

                decimal oPrice;
                if (decimal.TryParse(price, out oPrice))
                {
                    this.editProductBrowser.ClickHelemnt(element);
                    element.SetAttribute("value", (model.ChangePrice + oPrice).ToString());
                }
                HtmlElement container = this.editProductBrowser.FindID("J_SKUMapContainer");
                if (container != null)
                {
                    HtmlElementCollection itemPrice = container.GetElementsByTagName("input");
                    foreach (HtmlElement item in itemPrice)
                    {
                        string className = item.GetAttribute("className");
                        if (className != null && className.Contains("J_MapPrice"))
                        {
                            price = item.GetAttribute("value");
                            if (decimal.TryParse(price, out oPrice))
                            {
                                this.editProductBrowser.ClickHelemnt(item);
                                item.SetAttribute("value", (model.ChangePrice + oPrice).ToString());
                            }
                        }
                    }
                }
            }


            HtmlElement promoted = this.editProductBrowser.FindID("promoted");

            ClickHelemnt(promoted);

            HtmlElement submit = this.editProductBrowser.Browser.Document.GetElementById("event_submit_do_edit");

            ClickHelemnt(submit);

            this.checkDownTimer.Start();
            checkDownTimes = 0;
        }
Exemplo n.º 7
0
 public void Run(FenXiaoModel model)
 {
     editProductBrowser.Browser.Task = "EditProduct";
     editProductBrowser.Browser.Tag  = model;
     editProductBrowser.Navigate(model.Url);
 }