コード例 #1
0
ファイル: StockCat.cs プロジェクト: treesan/taobao-alading
        /// <summary>
        /// 新增子类目
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (gridViewStockProp.RowCount > 0)
            {
                XtraMessageBox.Show("该类目下有属性信息,不能添加子类目!", Constants.SYSTEM_PROMPT);
                return;
            }
            TreeListNode node = treeListStockCat.FocusedNode;

            if (node != null)
            {
                TreeListNodeTag tag        = node.Tag as TreeListNodeTag;
                string          fatherCode = tag.Cid;
                if (tag.Cid == "10000")
                {
                    XtraMessageBox.Show("该类目为系统内置默认类目,不能有子类目!", Constants.SYSTEM_PROMPT);
                    return;
                }
                string      fatherName  = node.GetDisplayText(0);
                StockCatAdd stockCatAdd = new StockCatAdd(fatherName, fatherCode);
                stockCatAdd.ShowDialog();
                if (stockCatAdd.DialogResult == DialogResult.OK)
                {
                    flag = true;
                    Init(null);//刷新
                }
            }
            else
            {
                XtraMessageBox.Show("请先选中一个类目进行子节点的添加!", Constants.SYSTEM_PROMPT);
                return;
            }
        }
コード例 #2
0
ファイル: StockCat.cs プロジェクト: treesan/taobao-alading
        /// <summary>
        /// 新增同级类目
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListNode node = treeListStockCat.FocusedNode;

            if (node != null)
            {
                TreeListNode fatherNode = node.ParentNode;
                string       fatherName = string.Empty;
                string       fatherCode = "0";
                if (fatherNode != null)
                {
                    fatherName = fatherNode.GetDisplayText(0);
                    TreeListNodeTag tag = fatherNode.Tag as TreeListNodeTag;
                    fatherCode = tag.Cid;
                }
                StockCatAdd stockCatAdd = new StockCatAdd(fatherName, "0");
                stockCatAdd.ShowDialog();
                if (stockCatAdd.DialogResult == DialogResult.OK)
                {
                    flag = true;
                    Init(null);//刷新
                }
            }
            else
            {
                StockCatAdd stockCatAdd = new StockCatAdd(string.Empty, "0");
                stockCatAdd.ShowDialog();
                if (stockCatAdd.DialogResult == DialogResult.OK)
                {
                    flag = true;
                    Init(null);//刷新
                }
            }
        }