Example #1
0
        /// <summary>
        /// 获取所有分组 树形结构
        /// </summary>
        /// <param name="groups"></param>
        /// <returns></returns>
        private GroupDTOList GetGroupChild(List <Group> groups)
        {
            GroupDTOList gdtolist = new GroupDTOList();

            if (groups == null)
            {
                return(gdtolist);
            }
            else
            {
                groups.OrderByDescending(g => g.Index);
                groups.ForEach(g =>
                {
                    GroupDTO dto    = new GroupDTO();
                    dto.CreateDate  = g.CreateDate;
                    dto.Creator     = g.Creator;
                    dto.Description = g.Description;
                    dto.EditDate    = g.EditDate;
                    dto.ID          = g.ID.ToString();
                    dto.Name        = g.Name;
                    dto.Index       = g.Index;
                    dto.ParentID    = g.ParentGroup != null ? g.ParentGroup.ID : Guid.Empty;
                    dto.ParentName  = g.ParentGroup != null ? g.ParentGroup.Name : string.Empty;
                    dto.Status      = (Wings.DataObjects.Status)g.Status;

                    if (g.ChildGroup != null && g.ChildGroup.Count > 0)
                    {
                        dto.ChildGroup = GetGroupChild(g.ChildGroup);
                    }
                    gdtolist.Add(dto);
                });
            }
            return(gdtolist);
        }
Example #2
0
        public ActionResult Delete(IDList idlist)
        {
            Result result = new Result();

            result.message = "删除部门失败";


            if (idlist == null || idlist.Count == 0)
            {
                result.message = "您提交的数据为空,请重新选择!";
                return(Json(result));
            }
            GroupDTOList dtolist = new GroupDTOList();

            idlist.Where(f => !string.IsNullOrEmpty(f)).ToList().ForEach(s =>
            {
                Guid temp = Guid.Empty;
                s.Split(',').ToList().ForEach(g =>
                {
                    if (Guid.TryParse(g, out temp))
                    {
                        dtolist.Add(new GroupDTO()
                        {
                            ID = g
                        });;
                    }
                }
                                              );
            });
            using (ServiceProxy <IUserService> proxy = new ServiceProxy <IUserService>())
            {
                try
                {
                    proxy.Channel.DeleteGroup(dtolist);
                    result.success = true;
                    result.message = "删除成功";
                }
                catch (Exception ex)
                {
                    result.message = ex.Message;
                }
            }
            //Log.OperaInstance.SaveMessage(1, string.Format("操作:{0};结果:{1};信息:{2}", "删除分组(禁用)", true, ""));
            return(Json(result));
        }
Example #3
0
        public ActionResult Edit(GroupDTO group)
        {
            Result result = new Result();

            result.message = "修改部门失败";
            using (ServiceProxy <IUserService> proxy = new ServiceProxy <IUserService>())
            {
                group.EditDate = DateTime.Now;
                GroupDTOList dtolist = new GroupDTOList();
                dtolist.Add(group);
                proxy.Channel.EditGroup(dtolist);
                if (!string.IsNullOrEmpty(group.ID))
                {
                    result.success = true;
                    result.message = "修改部门成功";
                }
            }
            //Log.OperaInstance.SaveMessage(1, string.Format("操作:{0};结果:{1};信息:{2}", "分组编辑", true, ""));
            return(Json(result));
        }