Example #1
0
        /*
         * 功能:获取某用户所属部门信息
         * 参数:id 用户Id
         * 返回值:Depart_Archi
         */
        public Depart_Archi Get_Person_Depart(int id)
        {
            Depart_Archi r = new Depart_Archi();

            r = Persons.GetPerson_Depart(id);
            return(r);
        }
Example #2
0
        /*
         * 功能:获取某装置管理员所属的车间
         * 参数:id 用户Id
         * 返回值:Depart_Archi
         */
        public Depart_Archi Get_Person_DepartOfParent(int id)
        {
            Depart_Archi r = new Depart_Archi();

            r = Persons.GetPerson_Depart(id);
            Depart_Archis DA = new Depart_Archis();

            r = DA.getDepart_Parent(r.Depart_Id);


            return(r);
        }
Example #3
0
        //功能:获取系统基础数据所有的部门层次树形结构节点集合
        //参数:空
        //返回值:List<TreeListNode> 在前台程序中可以利用Treeview显示树形结构
        public List <TreeListNode> BuildDepartList()
        {
            Depart_Archi root  = GetRootTree();
            TreeListNode rnode = new TreeListNode();

            rnode.text       = root.Depart_Name;
            rnode.selectable = false;

            List <TreeListNode> list = new List <TreeListNode>();

            BuildDepartList_inter(rnode, list);
            return(list);
        }
Example #4
0
 public Depart_Archi GetRootTree()
 {
     try
     {
         Depart_Archi res = DA.getDepart_root("root");
         if (res == null)
         {
             throw new Exception("DB has not only one root item");
         }
         return(res);
     }
     catch (Exception e)
     {
         return(null);
     }
 }
Example #5
0
 public bool ModifyDepart_Archi(int Depart_id, Depart_Archi New_Depart_info)
 {
     using (var db = base.NewDB())
     {
         try
         {
             var P = db.Department.Where(a => a.Depart_Id == Depart_id).First();
             if (P == null)
             {
                 return(false);
             }
             else
             {
                 P.Depart_Name = New_Depart_info.Depart_Name;
                 db.SaveChanges();
                 return(true);
             }
         }
         catch { return(false); }
     }
 }
Example #6
0
        public bool AddDepart_Archi(int parentId, Depart_Archi New_Depart_info)
        {
            using (var db = base.NewDB())
            {
                try
                {
                    Depart_Archi parent = db.Department.Where(a => a.Depart_Id == parentId).First();
                    if (parent == null)
                    {
                        return(false);
                    }

                    parent.Depart_child.Add(New_Depart_info);
                    db.SaveChanges();
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
        }