Example #1
0
        /// <summary>
        /// 更新数据库中所有商品信息
        /// </summary>
        private void UpdateAllWare()
        {
            OtCom.XLogInfo("开始自动获取所有商品价格及库存情况!");
            //获取数据库中所有商品
            List <ProductInfo> wares = DBHelper.GetInstance().WareGetAll();

            UpdateThread(wares);
        }
Example #2
0
        void _typeManagerTree_DragOver(object sender, DragEventArgs e)
        {
            if (e.AllowedEffect == DragDropEffects.Move)
            {
                if (e.Data.GetDataPresent(typeof(System.Collections.Generic.List <Object>)))
                {
                    List <Object> obj = e.Data.GetData(typeof(System.Collections.Generic.List <Object>)) as List <Object>;
                    if (obj != null)
                    {
                        try
                        {
                            ProductInfo curWare = obj[0] as ProductInfo;
                            //string[] dList = e.Data.GetFormats();

                            if (curWare != null)
                            {
                                //获取当前操作节点
                                var hi         = _typeManagerTree.CalcHitInfo(_typeManagerTree.PointToClient(new Point(e.X, e.Y)));
                                var targetNode = hi.Node;

                                if (targetNode.Tag != null)
                                {
                                    DBHelper.GetInstance().WareTypeUpdate(curWare.ProductID, targetNode.Tag.ToString());
                                    DBHelper.GetInstance().WareReloadOne(curWare.ProductID);
                                    OtCom.XLogInfo(targetNode.Tag.ToString());
                                }
                                else
                                {
                                    object nowKey = _typeManagerTree.GetNodeKey(targetNode);
                                    if (nowKey.ToString() == "ALL" || nowKey.ToString() == "JINDONG" || nowKey.ToString() == "UnType" ||
                                        nowKey.ToString() == "down" || nowKey.ToString() == "up" || nowKey.ToString() == "balance" ||
                                        nowKey.ToString() == "focus")
                                    {
                                        MessageBox.Show("系统基础分类不能增加商品!", "系统提示");
                                        return;
                                    }
                                    else if (nowKey.ToString() == "trash")
                                    {
                                        DBHelper.GetInstance().WareDelOne(curWare.ProductID);
                                        OtCom.XLogInfo("trash");
                                    }
                                }
                                RefreshGrid(btnSearch.Tag.ToString());
                            }
                        }
                        catch (Exception ex)
                        {
                            OtCom.XLogErr(ex.Message);
                        }
                    }
                }
            }
        }