示例#1
0
        public virtual object DeleteGroups(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            JArray    jPost   = request.GetPostData <JArray>();
            BPMObjectNameCollection groupNames = jPost.ToObject <BPMObjectNameCollection>();

            JObject rv           = new JObject();
            JArray  deletedItems = new JArray();

            rv["deletedItems"] = deletedItems;

            try
            {
                using (BPMConnection cn = new BPMConnection())
                {
                    cn.WebOpen();

                    foreach (string groupName in groupNames)
                    {
                        GroupManager.DeleteSecurityGroup(cn, groupName);

                        JObject deletedItem = new JObject();
                        deletedItems.Add(deletedItem);
                        deletedItem["GroupName"] = groupName;
                    }

                    rv[YZJsonProperty.success] = true;
                }
            }
            catch (Exception exp)
            {
                rv[YZJsonProperty.success]      = false;
                rv[YZJsonProperty.errorMessage] = exp.Message;
            }

            return(rv);
        }