Beispiel #1
0
        protected override Boolean WfDisplayMode()
        {
            vw_glai100 masterModel = null;

            try
            {
                if (FormEditMode == YREditType.NA)
                {
                    WfSetControlsReadOnlyRecursion(this, true);
                    uTree.Enabled = true;
                    uTree.Focus();
                }
                else
                {
                    masterModel = DrMaster.ToItem <vw_glai100>();
                    WfSetControlsReadOnlyRecursion(this, false); //先全開
                    WfSetControlReadonly(uGridMaster, true);     //主表grid不可編輯
                    WfSetGba07ReadOnly(masterModel.gba06);
                    uTree.Enabled = false;

                    if (FormEditMode == YREditType.修改)
                    {
                        WfSetControlReadonly(ute_gba01, true);
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #2
0
        protected override bool WfAppendUpdate()
        {
            UltraTreeNode parentsNode = null;
            vw_glai100    masterModel = null;
            string        gba06_old = "", gba07_old = "";

            try
            {
                masterModel = DrMaster.ToItem <vw_glai100>();
                //這裡處理新增修改後的樹狀結構
                //refresh父節點下的資料
                if (FormEditMode == YREditType.新增)
                {
                    parentsNode = WfGetParentsNode(masterModel);
                    var addNode = parentsNode.Nodes.Add(masterModel.gba01, string.Concat(masterModel.gba01, "-", masterModel.gba02));
                    uTree.Enabled    = true;    //這裡就要先打開,不然會無法設定activenode
                    uTree.ActiveNode = addNode;
                }
                else if (FormEditMode == YREditType.修改)
                {
                    var activeNode = uTree.GetNodeByKey(masterModel.gba01);
                    uTree.Enabled    = true;    //這裡就要先打開,不然會無法設定activenode
                    uTree.ActiveNode = activeNode;
                    //檢查是否需要更新節點
                    gba06_old = GlobalFn.isNullRet(DrMaster["gba06", DataRowVersion.Original], "");
                    gba07_old = GlobalFn.isNullRet(DrMaster["gba07", DataRowVersion.Original], "");
                    if (gba06_old != masterModel.gba06 || gba07_old != masterModel.gba07)
                    {
                        if (masterModel.gba06 == "1")    //統制科目
                        {
                            activeNode.Override.ActiveNodeAppearance.Image = ImgList.Images[GlobalPictuer.MENU_TREE_FOLDER_ACTIVE];
                            activeNode.Override.NodeAppearance.Image       = ImgList.Images[GlobalPictuer.MENU_TREE_FOLDER];
                        }
                        else
                        {
                            activeNode.Override.ActiveNodeAppearance.Image = null;
                            activeNode.Override.NodeAppearance.Image       = null;
                        }
                        if (gba07_old != masterModel.gba07)
                        {
                            var newParentsNode = uTree.GetNodeByKey(masterModel.gba07);
                            activeNode.Reposition(newParentsNode.Nodes);
                            uTree.ActiveNode = activeNode;
                        }
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #3
0
        private UltraTreeNode WfGetParentsNode(vw_glai100 pGlai100Model)
        {
            UltraTreeNode parentsNode = null;
            string        nodeKey     = "";

            try
            {
                nodeKey     = GlobalFn.isNullRet(pGlai100Model.gba07, "root");
                parentsNode = uTree.GetNodeByKey(nodeKey);
                return(parentsNode);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #4
0
 private UltraTreeNode WfAddNode(UltraTreeNode paretnsNode, vw_glai100 glai100Model)
 {
     try
     {
         var addNode = paretnsNode.Nodes.Add(glai100Model.gba01, string.Concat(glai100Model.gba01, "-", glai100Model.gba02));
         if (glai100Model.gba06 == "1")    //統制科目
         {
             addNode.Override.ActiveNodeAppearance.Image = ImgList.Images[GlobalPictuer.MENU_TREE_FOLDER_ACTIVE];
             addNode.Override.NodeAppearance.Image       = ImgList.Images[GlobalPictuer.MENU_TREE_FOLDER];
         }
         return(addNode);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #5
0
        protected override bool WfDeleteAppenUpdate(DataRow pDr)
        {
            vw_glai100 masterModel = null;

            try
            {
                //_isInDeleteing = true;
                masterModel = DrMaster.ToItem <vw_glai100>();
                var parentsNode = WfGetParentsNode(masterModel);
                var deleteNode  = uTree.GetNodeByKey(masterModel.gba01);
                parentsNode.Nodes.Remove(deleteNode);
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #6
0
        protected override bool WfPreDeleteCheck(DataRow pDr)
        {
            vw_glai100 masterMode = null;

            try
            {
                masterMode = DrMaster.ToItem <vw_glai100>();
                var delteNode = uTree.GetNodeByKey(masterMode.gba01);
                if (delteNode.Nodes.Count > 0 || (uTree.ActiveNode != null && uTree.ActiveNode.Key.ToLower() == "root"))
                {
                    WfShowErrorMsg("只能刪除尾階的會計科目!");
                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }