private void LoadSubProcesses(int idProc, TreeViewNode nodeProc) { ISubProcess engineProcess = new ISubProcess(HELPERS.NewOdbcConn()); returnListSubProcessByProcess[] allprocs = engineProcess.ListSubProcessByProcess (null, "\"Status\" = ?", new string[] { "Active" }, "c_u_Name asc", idProc); foreach (returnListSubProcessByProcess cur in allprocs) { ComponentArt.Web.UI.TreeViewNode rootNode = new ComponentArt.Web.UI.TreeViewNode(); rootNode.Text = cur.Name; rootNode.Expanded = false; rootNode.ImageUrl = "folder.gif"; rootNode.ShowCheckBox = true; rootNode.ID = "SP/" + cur.ID; rootNode.ContentCallbackUrl = "XMLtree_RolesInSubprocess.ashx?subproc=" + cur.ID; nodeProc.Nodes.Add(rootNode); } }
public string RENDER() { int idproc = this.idPR; if (idproc < 0) { return(""); } IProcess engineProcess = new IProcess(HELPERS.NewOdbcConn()); ISubProcess engineSubProcess = new ISubProcess(HELPERS.NewOdbcConn()); IBusRole engineBR = new IBusRole(HELPERS.NewOdbcConn()); IEntAssignmentSet engineWS = new IEntAssignmentSet(HELPERS.NewOdbcConn()); returnGetProcess detailProcess = engineProcess.GetProcess(idproc); StringBuilder BUFFER = new StringBuilder(); /* * BUFFER.Append( * "<tr><th colspan='2'>Process: " + detailProcess.Name + "</th></tr>"); */ returnListSubProcessByProcess[] subprocesses = engineSubProcess.ListSubProcessByProcess (null, "\"Status\" = ?", new string[] { "Active" }, "\"NAME\"", idproc); foreach (returnListSubProcessByProcess cursubpr in subprocesses) { int idActiveEAset = -1; returnListEntAssignmentSetBySubProcess[] listWS; listWS = engineWS.ListEntAssignmentSetBySubProcess (null, "\"Status\" = ?", new string[] { "ACTIVE" }, "", cursubpr.ID); if (listWS.Length > 1) { throw new Exception("Internal error: more than one ACTIVE Ent Assignment Set for subprocess " + cursubpr.ID); } if (listWS.Length == 1) { idActiveEAset = listWS[0].ID; } string sql = @" SELECT BR.c_id, BR.c_u_Name, BR.c_u_Description, BR.c_u_RoleType as RoleTypeAbbrev, (select Displayable from DICT_BusRoleType where Abbrev=c_u_RoleType) as RoleTypeDisplayable, ( SELECT COUNT(DISTINCT ENT.c_u_Application) FROM t_RBSR_AUFW_u_EntAssignment EA LEFT OUTER JOIN t_RBSR_AUFW_u_Entitlement ENT ON EA.c_r_Entitlement = ENT.c_id WHERE EA.c_r_BusRole = BR.c_id AND EA.c_r_EntAssignmentSet = " + idActiveEAset + @" AND EA.c_u_Status NOT IN ('X') ) as KOUNTAPPS, USR.c_u_NameSurname, USR.c_u_NameFirst FROM t_RBSR_AUFW_u_BusRole BR LEFT OUTER JOIN t_RBSR_AUFW_u_BusRoleOwner BRPRIMOWN ON BRPRIMOWN.c_r_BusRole=BR.c_id AND BRPRIMOWN.c_u_Rank = 'OWNprim' LEFT OUTER JOIN t_RBSR_AUFW_u_User USR ON BRPRIMOWN.c_u_EID = USR.c_u_EID WHERE c_r_SubProcess=" + cursubpr.ID + " order by c_u_Name"; BUFFER.Append("<tr><td><table class='subprocess'><caption>Subprocess: " + cursubpr.Name + @"</caption> <thead> <tr> <th scope='col' width='25%'>Role Name</th> <th scope='col' width='25%'>Role Description</th> <th scope='col' width='20%'>Role Type</th> <th scope='col' width='30%'>Primary Owner</th> </tr> </thead><tbody>"); OdbcDataReader DR = HELPERS.RunSqlSelect(sql); while (DR.Read()) { int idBRole = DR.GetInt32(0); string name = DR.GetString(1); string descr = DR.GetString(2); string roletype = DR.GetString(4); int appcount = DR.GetInt32(5); string surname = ""; string firstname = ""; try { surname = HELPERS.SafeObjToString(DR.GetString(6)); firstname = HELPERS.SafeObjToString(DR.GetString(7)); } catch (Exception) { } BUFFER.Append("<tr><td><a href='DETAILbusrole.aspx?" + "idBR=" + idBRole + "&idSUBPR=" + cursubpr.ID + "&idPR=" + idproc + "'>" + name + "</a></td><td>" + descr + "</td><td>" + roletype + "</td><td>" + ((surname != "") ? (surname.ToString() + ", " + firstname.ToString()) : "") + "</td></tr>"); } BUFFER.Append("</table></td></tr>\n"); } returnGetSubProcess detailSubProcess; return(BUFFER.ToString()); }