Пример #1
0
 private void  除ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (treeViewMaterial.SelectedNode != null)
     {
         if (DialogResult.Yes != MessageBox.Show("确定要删除所选节点吗?该操作将不可恢复,请注意.", "请确认",
                                                 MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2))
         {
             return;
         }
         MaterialTypeManager mtm = new MaterialTypeManager();
         try
         {
             if (mtm.DeleteFake(treeViewMaterial.SelectedNode.Tag.ToString()))
             {
                 MessageBox.Show("删除成功!");
                 DataTable dt     = mtm.GetList("").Tables[0];
                 DataView  dvTree = new DataView(dt);
                 treeViewMaterial.Nodes.Clear();
                 AddTree("", null, dvTree);
             }
             else
             {
                 MessageBox.Show("删除失败,请重试.");
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("删除节点出错,请检查服务器连接.异常:" + ex.Message);
         }
     }
 }
Пример #2
0
 private void 编辑ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (treeViewMaterial.SelectedNode != null)
     {
         MaterialTypeInsNodes insN = new MaterialTypeInsNodes();
         MaterialType         mt   = new MaterialType();
         mt.MT_Clear    = 1;
         mt.MT_Code     = treeViewMaterial.SelectedNode.Tag.ToString();
         mt.MT_Enable   = 1;
         mt.MT_Name     = treeViewMaterial.SelectedNode.Text;
         mt.MT_ParentID = treeViewMaterial.SelectedNode.Parent.Tag.ToString();
         insN.ShowDialog(this);
         if (Isflag)
         {
             MaterialTypeManager mtm    = new MaterialTypeManager();
             DataTable           dt     = mtm.GetList("").Tables[0];
             DataView            dvTree = new DataView(dt);
             treeViewMaterial.Nodes.Clear();
             AddTree("", null, dvTree);
             isflag = false;
             Focus();
         }
     }
     else
     {
         MessageBox.Show("请选择需要增加的上级城市");
     }
 }
Пример #3
0
        /// <summary>
        /// 返回所有存在的节点
        /// </summary>
        /// <returns></returns>
        private DataView selectDataView()
        {
            DataView            dvTree;
            MaterialTypeManager mtm = new MaterialTypeManager();
            DataTable           dt  = mtm.GetList("").Tables[0];

            dvTree = new DataView(dt);
            return(dvTree);
        }
Пример #4
0
        private void MaterialForm_Load(object sender, EventArgs e)
        {
            StartPosition = FormStartPosition.CenterParent;
            MaterialTypeManager mtm    = new MaterialTypeManager();
            DataTable           dt     = mtm.GetList("").Tables[0];
            DataView            dvTree = new DataView(dt);

            AddTree("", null, dvTree);
            loadData();
        }
Пример #5
0
        private void MaterialCreateForm_Load(object sender, EventArgs e)
        {
            MaterialTypeManager mtm    = new MaterialTypeManager();
            DataTable           dt     = mtm.GetList("").Tables[0];
            DataView            dvTree = new DataView(dt);

            AddTree("", null, dvTree);
            bindCombo();
            comboTreeType.AdvTree.NodeDoubleClick += AdvTree_NodeDoubleClick;
            initUI();
        }
Пример #6
0
        private void GoodsListForm_Load(object sender, EventArgs e)
        {
            dataGridViewGoodsList.AutoGenerateColumns = false;

            MaterialManager mm = new MaterialManager();

            MaterialTypeManager mtm = new MaterialTypeManager();

            DataTable matType = mtm.GetList("").Tables[0];

            dataTableAllMaterial = mm.GetList("").Tables[0];

            dataGridViewGoodsList.DataSource = dataTableAllMaterial;

            //CategoryDAO category = new CategoryDAO();

            //GoodsListDAO goodsList = new GoodsListDAO();

            //try
            //{
            //    DataTable categoryDataTable = category.selectAll();
            //    //获取商品类型列表填充到treeView
            //    dataTableAllGoods = goodsList.selectAll();
            //    foreach (DataRow dr in categoryDataTable.Rows)
            //    {
            //        treeViewModel.Nodes[0].Nodes.Add(dr[(int)categoryEnum.name]
            //            .ToString());//添加节点
            //        treeViewModel.Nodes[0].LastNode.Tag = dr[(int)categoryEnum.id]
            //            .ToString();//为该节点的tag赋值成ID
            //    }
            //    treeViewModel.Nodes[0].Expand();
            //    dataGridViewGoodsList.DataSource = dataTableAllGoods;
            //}
            //catch(Exception ex)
            //{
            //    MessageBox.Show("数据初始化异常:" + ex.Message);
            //}
        }
Пример #7
0
 private void 新增下级节点ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (treeViewMaterial.SelectedNode != null)
     {
         MaterialTypeManager mtm    = new MaterialTypeManager();
         DataTable           dt     = mtm.GetList("").Tables[0];
         DataView            dvTree = new DataView(dt);
         InsNodes            insN   = new InsNodes();
         insN.city_code = treeViewMaterial.SelectedNode.Tag.ToString();
         insN.ShowDialog(this);
         if (Isflag)
         {
             treeViewMaterial.Nodes.Clear();
             AddTree("", null, dvTree);
             isflag = false;
             this.Focus();
         }
     }
     else
     {
         MessageBox.Show("请选择需要增加的上级城市");
     }
 }