Esempio n. 1
0
        public string DoAdd(string empNo, string orgNo)
        {
            BP.Port.Emp emp = new BP.Port.Emp();
            emp.No = empNo;
            if (emp.RetrieveFromDBSources() == 0)
            {
                return("err@管理员增加失败,ID=" + empNo + "不存在用户表,您增加的管理员必须存在与Port_Emp用户表.");
            }

            BP.Port.Dept dept = new BP.Port.Dept();
            dept.No = orgNo;
            if (dept.RetrieveFromDBSources() == 0)
            {
                return("err@orgNo错误, 不存在 Port_Dept 里面。");
            }

            BP.WF.Port.Inc inc = new BP.WF.Port.Inc();
            inc.No = orgNo;
            if (inc.RetrieveFromDBSources() == 0)
            {
                return("err@orgNo错误, 不存在 Port_Inc 里面。");
            }

            //求根目录流程树.
            BP.WF.Template.FlowSort fsRoot = new WF.Template.FlowSort();
            fsRoot.Retrieve(BP.WF.Template.FlowSortAttr.ParentNo, "0");


            BP.WF.Template.FlowSort fs = new WF.Template.FlowSort();
            fs.No = "Inc" + orgNo;
            if (fs.RetrieveFromDBSources() == 1)
            {
                return("err@该组织已经初始化过流程树目录.");
            }

            fs.Name     = dept.Name + "-流程树";
            fs.ParentNo = fsRoot.No;
            fs.OrgNo    = dept.No;
            fs.Insert();


            //求根目录流程树.
            BP.Sys.FrmTree frmRoot = new BP.Sys.FrmTree();
            frmRoot.Retrieve(BP.WF.Template.FlowSortAttr.ParentNo, "0");

            BP.Sys.FrmTree frmTree = new BP.Sys.FrmTree();
            frmTree.No = "Inc" + orgNo;
            if (frmTree.RetrieveFromDBSources() == 1)
            {
                return("err@该组织已经初始化过表单树目录.");
            }

            frmTree.ParentNo = frmRoot.No;
            frmTree.Name     = dept.Name + "-表单树";
            frmTree.OrgNo    = dept.No;
            frmTree.Insert();


            AdminEmp ae = new AdminEmp();

            ae.No = empNo;
            if (ae.RetrieveFromDBSources() == 1)
            {
                if (ae.IsAdmin == true)
                {
                    return("err@该管理员已经存在,请删除该管理员重新增加delete from wf_emp where no='" + empNo + "'");
                }
                ae.Delete();
            }



            ae.Copy(emp);

            ae.UserType   = 1;
            ae.UseSta     = 1;
            ae.RootOfDept = orgNo;
            ae.RootOfFlow = "Inc" + orgNo;
            ae.RootOfForm = "Inc" + orgNo;
            ae.Insert();

            return("info@管理员增加成功.");
        }
Esempio n. 2
0
        private void InitFlowSortTree()
        {
            //设置流程树权限.
            BP.WF.Template.FlowSort fs = new WF.Template.FlowSort();
            fs.No = "Inc" + this.No;
            if (fs.RetrieveFromDBSources() != 0)
            {
                fs.OrgNo = this.No;
                fs.Update();
                return;
            }

            //获得根目录节点.
            BP.WF.Template.FlowSort root = new Template.FlowSort();
            int i = root.Retrieve(BP.WF.Template.FlowSortAttr.ParentNo, "0");

            //设置流程树权限.
            fs.Name     = this.Name;
            fs.ParentNo = root.No;
            fs.OrgNo    = this.No;
            fs.Idx      = 999;
            fs.Save();


            //创建下一级目录.
            EntityTree en = fs.DoCreateSubNode();

            en.Name = "流程目录1";
            en.Update();

            en      = fs.DoCreateSubNode();
            en.Name = "流程目录2";
            en.Update();

            //表单根目录.
            BP.Sys.FrmTree ftRoot = new Sys.FrmTree();
            ftRoot.Retrieve(BP.WF.Template.FlowSortAttr.ParentNo, "0");


            //设置表单树权限.
            BP.Sys.FrmTree ft = new Sys.FrmTree();
            ft.No = "Inc" + this.No;
            if (ft.RetrieveFromDBSources() == 0)
            {
                ft.Name     = this.Name;
                ft.ParentNo = ftRoot.No;
                ft.OrgNo    = this.No;
                ft.Idx      = 999;
                ft.Insert();

                //创建两个目录.
                ft.DoCreateSubNode();
                ft.DoCreateSubNode();
            }
            else
            {
                ft.Name     = this.Name;
                ft.ParentNo = ftRoot.No;
                ft.OrgNo    = this.No;
                ft.Idx      = 999;
                ft.Update();
            }
        }