string sapviewmode = "I"; //interactive protected void Page_Load(object sender, EventArgs e) { try { idBR = int.Parse(Request.Params["idBR"]); } catch (Exception) { idBR = -432; } // Special viewing mode param added in May of 2010: // sapview=interactive or html // The default is the former sapviewmode = "I"; try { string mode = Request.Params["sapview"]; sapviewmode = mode.ToUpper().Substring(0, 1); } catch (Exception) { } if (PANEL_tcodelistingmode_HtmlTable != null) { switch (sapviewmode) { case "I": PANEL_tcodelistingmode_HtmlTable.Visible = false; break; case "H": PANEL_tcodelistingmode_interactive.Visible = false; break; } } IProcess engineProcess = new IProcess(HELPERS.NewOdbcConn()); ISubProcess engineSubProcess = new ISubProcess(HELPERS.NewOdbcConn()); IBusRole engineBR = new IBusRole(HELPERS.NewOdbcConn()); theBR = engineBR.GetBusRole(idBR); theSubProcess = engineSubProcess.GetSubProcess(theBR.SubProcessID); theProcess = engineProcess.GetProcess(theSubProcess.ProcessID); // Initialize dynamically-generated portions of the page if (PANELsapdesignnote != null) { IFuncApplNotes engine = new IFuncApplNotes(HELPERS.NewOdbcConn()); returnListFuncApplNotes[] returned = engine.ListFuncApplNotes (null, "\"REFapplication\" = ? AND \"BusRole\" = ?" /* SAP application is ID 57 */, new string[] { "57", idBR.ToString() }, ""); if (returned.Length == 0) { PANELsapdesignnote.Visible = false; } else { STATICTXTsapfuncappdesignnote.Text = returned[0].Comment; } } }
// Creates or Updates a business role object. // Alos, if necessary, creates new user objects for role ownership private void JQDLGsaproleProperties (System.Collections.Specialized.NameValueCollection pars, HttpResponse httpResponse) { ISAProle engineBR = new ISAProle(CONNdedicated); ISAProle engine = engineBR; int idsaprole; if (pars["JQDLGbp_id"].Length == 0) { // WE ARE CREATING A NEW ROLE, NOT JUST UPDATING EXISTING int babyid = -1; // Make sure not already existing returnListSAProle[] chk = engineBR.ListSAProle(null, "(\"Name\" = ?) and (\"System\" = ?) and (\"Platform\" = ?)", new string[] { pars["JQDLGbp_name"], pars["JQDLGbp_system"], pars["JQDLGbp_platform"] }, ""); if (chk.Length > 0) { // Already in existence! returnListSAProle details = chk[0]; if (details.SubProcessID == session.idSubprocess) { // And this existing role is even in the same subprocess! throw new Exception("This SAP role already exists and is registered with this very same subprocess."); } else { // Oh, belongs to a different subprocess. IProcess engineProcess = new IProcess(engineBR.DbConnection); ISubProcess engineSubProcess = new ISubProcess(engineBR.DbConnection); returnGetSubProcess theSubProcess = engineSubProcess.GetSubProcess(details.SubProcessID); returnGetProcess theProcess = engineProcess.GetProcess(theSubProcess.ProcessID); throw new Exception ("This SAP role already exists, in a different subprocess: " + theProcess.Name + " / " + theSubProcess.Name); } } try { babyid = engine.NewSAProle( pars["JQDLGbp_name"], session.idSubprocess, pars["JQDLGbp_system"], pars["JQDLGbp_platform"]); } catch (Exception eee) { throw new Exception("Addition of new role failed: check for name already in use."); } idsaprole = babyid; } else { returnListSAProle[] chk = engineBR.ListSAProle(null, "(\"id\" <> ?) AND (\"Name\" = ?)", new string[] { pars["JQDLGbp_id"], pars["JQDLGbp_name"] }, ""); if (chk.Length > 0) { throw new Exception("Name '" + pars["JQDLGbp_name"] + "' is already in use for an existing SAP role."); } idsaprole = int.Parse(pars["JQDLGbp_id"]); } engineBR.SetSAProle( idsaprole, pars["JQDLGbp_name"], pars["JQDLGbp_description"], session.idSubprocess, pars["JQDLGbp_system"], pars["JQDLGbp_platform"], pars["JQDLGbp_roleactivity"], pars["JQDLGbp_roletype"], ""); // ADDED to fix regression, on 09MAR2010: returnGetSAProle saprolePostAction = engine.GetSAProle(idsaprole); SAP_HELPERS.MaintainMatchingBusinessEntitlementForSAPRole(saprolePostAction, saprolePostAction); httpResponse.Write("OK"); }
/* * Assumes the subprocess info is already in place */ public void ObtainWorkspaceContext() { System.Data.Odbc.OdbcConnection conn = HELPERS.NewOdbcConn(); IEntAssignmentSet engineWS = new IEntAssignmentSet(conn); returnListEntAssignmentSetBySubProcess[] listWS; if (this.nameSubprocess == null) { ISubProcess Ispr = new ISubProcess(conn); returnGetSubProcess ret = Ispr.GetSubProcess(idSubprocess); this.nameSubprocess = ret.Name; IProcess Ipr = new IProcess(conn); returnGetProcess ret2 = Ipr.GetProcess(ret.ProcessID); this.nameProcess = ret2.Name; } // Is there an active "live" easet for this subpr? listWS = engineWS.ListEntAssignmentSetBySubProcess (null, "\"Status\" = ?", new string[] { "ACTIVE" }, "", idSubprocess); if (listWS.Length > 1) { throw new Exception("Internal error: more than one ACTIVE Ent Assignment Set for subprocess " + idSubprocess); } if (listWS.Length == 1) { idActiveEAset = listWS[0].ID; } // Is there a currently active ed workspace for this subprocess? listWS = engineWS.ListEntAssignmentSetBySubProcess (null, "\"Status\" = ?", new string[] { "WORKSPACE" }, "", idSubprocess); if (listWS.Length > 1) { throw new Exception("Internal error: more than one workspace for subprocess " + idSubprocess); } if (listWS.Length == 1) { idWorkspace = listWS[0].ID; commentWorkspace = listWS[0].Commentary; idUserWorkspaceOwner = listWS[0].UserID; isWorkspaceOwner = (idUser == listWS[0].UserID); if (isWorkspaceOwner) { nameUserWorkspaceOwner = username; } else { IUser engineUser = new IUser(conn); returnGetUser wsowner = engineUser.GetUser(idUserWorkspaceOwner); nameUserWorkspaceOwner = wsowner.Name; } } else { idWorkspace = -1; idUserWorkspaceOwner = -1; isWorkspaceOwner = false; nameUserWorkspaceOwner = ""; commentWorkspace = ""; } }
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()); }