public virtual JObject SaveMember(HttpContext context) { YZRequest request = new YZRequest(context); string mode = request.GetString("mode"); string parentou = request.GetString("parentou", ""); JObject data = request.GetPostData <JObject>(); Member member = data["Member"].ToObject <Member>(); User user = data["User"].ToObject <User>(request.Serializer); BPMObjectNameCollection fgOUs = data["Member"]["FGOUs"].ToObject <BPMObjectNameCollection>(); BPMObjectNameCollection fgYWs = data["Member"]["FGYWs"].ToObject <BPMObjectNameCollection>(); SupervisorCollection spvs = data["Supervisors"].ToObject <SupervisorCollection>(); string headshot = (string)data["User"]["headshot"]; string sign = (string)data["User"]["sign"]; Member newMember = 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) { newMember = Member.UpdateMember(cn, parentou, fullname, member, user, fgOUs, fgYWs, spvs); } else { newMember = Member.FromFullName(cn, fullname); } } else { newMember = OU.AddMember(cn, request.GetString("parentou"), null, member, user, fgOUs, fgYWs, spvs); } //设置外出 UserCommonInfo userCommonInfo = data["UserCommonInfo"].ToObject <UserCommonInfo>(); User.SetOutOfOffice(cn, user.Account, userCommonInfo.OutOfOfficeState, userCommonInfo.OutOfOfficeFrom, userCommonInfo.OutOfOfficeTo); //设置主管 TaskRuleCollection taskRules = data["TaskRules"].ToObject <TaskRuleCollection>(); User.SaveTaskRules(cn, user.Account, taskRules); //头像与签名 this.SaveHeadshot(context, headshot, sign, user.Account); return(this.SerializeOUObject(cn, newMember)); } }
public virtual TaskRuleCollection GetLoginUserTaskRules(HttpContext context) { //获得数据 using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); TaskRuleCollection rules = User.GetTaskRules(cn, YZAuthHelper.LoginUserAccount); foreach (TaskRule rule in rules) { ITaskRuleDelegators itaskRuleDelegators = rule as ITaskRuleDelegators; if (itaskRuleDelegators != null) { foreach (Participant participant in itaskRuleDelegators.Delegators) { participant.RuntimeDisplayString = participant.GetDisplayString(cn); } } } return(rules); } }