public virtual OU SaveOU(HttpContext context) { YZRequest request = new YZRequest(context); JObject post = request.GetPostData <JObject>(); OU ou = post["data"].ToObject <OU>(); ACL acl = post["acl"].ToObject <ACL>(); string mode = request.GetString("mode"); OU newou = null; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); if (mode == "edit") { string fullname = request.GetString("fullname"); OUProviderInfo providerInfo = OrgSvr.GetProviderInfo(cn, fullname); if (providerInfo.Editable) { newou = OU.UpdateOU(cn, fullname, ou); } else { newou = OU.FromFullName(cn, fullname); } } else { string parentou = request.GetString("parentou", ""); if (String.IsNullOrEmpty(parentou)) { newou = cn.CreateOrg("BPMOU://", ou); } else { newou = OU.AddChildOU(cn, parentou, ou); } } SecurityManager.SaveACL(cn, SecurityResType.OU, newou.FullName, null, acl); return(newou); } }