Exemplo n.º 1
0
        private void LoadTv()
        {
            if (itemcls_lis != null && itemcls_lis.Count > 0)
            {
                this.itemcls_lis.Clear();
            }
            this.tv.Nodes.Clear();
            int      cb_index = Conv.ToInt(cb.SelectedValue);
            TreeNode tn       = new TreeNode("所有");

            if (cb_index == 1)
            {
                tn = new TreeNode("所有类别");
                IBLL.IItemCls bll = new BLL.ItemClsBLL();
                itemcls_lis = bll.GetAllList();
            }
            else if (cb_index == 2)
            {
                tn = new TreeNode("所有货商");
                IBLL.ISup bll = new BLL.SupBLL();
                int       tmp;
                var       tb = bll.GetDataTable("", "", 1, 1, 20000, out tmp);
                sup_lis = new List <bi_t_supcust_info>();
                foreach (DataRow row in tb.Rows)
                {
                    Model.bi_t_supcust_info it = DB.ReflectionHelper.DataRowToModel <Model.bi_t_supcust_info>(row);
                    sup_lis.Add(it);
                }
            }
            else if (cb_index == 3)
            {
                tn = new TreeNode("所有品牌");
            }
            else if (cb_index == 4)
            {
                tn = new TreeNode("所有属性");
            }
            tn.Tag = "";
            this.tv.Nodes.Add(tn);
            LoadTreeView();

            //
            this.tv.Nodes[0].Expand();
        }
Exemplo n.º 2
0
 public void LoadItemCls()
 {
     try
     {
         Thread th = new Thread(() =>
         {
             Helper.GlobalData.windows.ShowLoad(this);
             try
             {
                 IBLL.IItemCls bll = new BLL.ItemClsBLL();
                 itemcls_lis       = bll.GetAllList();
                 this.Invoke((MethodInvoker) delegate
                 {
                     Cursor.Current = Cursors.WaitCursor;
                     string key     = "";
                     if (this.tvItemCls.SelectedNode != null)
                     {
                         if (tvItemCls.SelectedNode.Tag != null)
                         {
                             var item = (Model.bi_t_item_cls)tvItemCls.SelectedNode.Tag;
                             key      = item.item_clsno;
                         }
                     }
                     //
                     this.tvItemCls.Nodes[0].Nodes.Clear();
                     LoadTreeView();
                     //
                     if (key == "")
                     {
                         this.tvItemCls.SelectedNode = this.tvItemCls.Nodes[0];
                         this.tvItemCls.SelectedNode.Expand();
                     }
                     else
                     {
                         foreach (TreeNode n in GetNodes(this.tvItemCls.Nodes[0]))
                         {
                             var item = (Model.bi_t_item_cls)n.Tag;
                             if (key == item.item_clsno)
                             {
                                 this.tvItemCls.SelectedNode = n;
                                 this.tvItemCls.SelectedNode.Expand();
                                 break;
                             }
                         }
                     }
                     Cursor.Current = Cursors.Default;
                 });
             }
             catch (Exception ex)
             {
                 LogHelper.writeLog("LoadItemCls", "获取商品分类出错!");
                 MsgForm.ShowFrom(ex);
             }
             Helper.GlobalData.windows.CloseLoad(this);
         });
         th.Start();
     }
     catch (Exception ex)
     {
         LogHelper.writeLog("LoadItemCls", "获取商品分类出错!");
         MsgForm.ShowFrom(ex);
     }
 }