private void DoCreateSubByRole() { IList <string> idList = RequestData.GetList <string>("IdList"); SysGroup tent = SysGroup.Find(id); if (idList != null && idList.Count > 0) { SysRole[] duties = SysRole.FindAllByPrimaryKeys(idList.ToArray()); foreach (SysRole tduty in duties) { if (!SysGroup.Exists("Name=? and Type=21 and ParentID = ?", tduty.Name, tent.ID)) { SysGroup tgrp = new SysGroup() { Name = tduty.Name, Code = tduty.Code, Type = 3, //角色 Status = 1, SortIndex = 9999, CreateDate = DateTime.Now }; tgrp.CreateAsChild(tent); } } } }