示例#1
0
        private void SaveData()
        {
            var dept = new SysDepartment();

            if (DeptID > 0)
            {
                dept.LoadByIdentity(DeptID);
                SetData(dept);
                dept.Update();
            }
            else
            {
                SetData(dept);
                //班级初始化
                dept.IsDeleted = false;

                var rootDept = new SysDepartment(SysConsts.RootDeptID);
                rootDept.Load();
                dept.BaseDeptName = rootDept.Name;
                dept.BaseDeptID   = rootDept.ID;
                dept.ParentID     = rootDept.ID;
                dept.ParentName   = rootDept.Name;

                dept.Add();
            }
        }