public ActionResult GetPreviewUser() { string actId = Request["actId"]; int activityId = 0; if (int.TryParse(actId, out activityId)) { WFActivity activity = new WFActivity(activityId); var previewUser = new { Specified = activity.GetEntityPreviewUser(), Fixed = activity.GetStaticUsers(), Role = activity.GetRolePreviewUser() }; return Json(previewUser); } else { return null; } }
private string[] GetUserString(WFActivity activity) { string ownerString = "<div class='clearfix'>"; string ccString = "<div class='clearfix'>"; Dictionary<string, WFUser> wfUsers = new Dictionary<string, WFUser>(); activity.MergeUser(wfUsers, activity.GetStaticUsers()); activity.MergeUser(wfUsers, activity.GetRoleUsers()); activity.MergeUser(wfUsers, WFHelper.GetDelegateUsers(wfUsers)); List<WFUser> lstPrevUser = activity.GetEntityPreviewUser(); if (lstPrevUser != null) { foreach (WFUser u in lstPrevUser) { if (u.IsApprover || u.IsKeyUser) { ownerString += GetUserString(u, "Specified"); } else { ccString += GetUserString(u, "Specified"); } } } foreach (KeyValuePair<string, WFUser> kvUser in wfUsers) { if (kvUser.Value.IsApprover || kvUser.Value.IsKeyUser) { ownerString += GetUserString(kvUser.Value, "Fixed"); } else { ccString += GetUserString(kvUser.Value, "Fixed"); } } ownerString += "</div>"; ccString += "</div>"; return new string[] { ownerString, ccString }; }