Exemple #1
0
        /*
         * 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       = "";
            }
        }
Exemple #2
0
        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");
        }