Exemple #1
0
        private void WSdel(HttpContext context, int idEASet)
        {
            IEntAssignmentSet         engine = new IEntAssignmentSet(HELPERS.NewOdbcConn());
            returnGetEntAssignmentSet props  = engine.GetEntAssignmentSet(idEASet);

            if (props.Status != "WORKSPACE")
            {
                throw new Exception("Only open workspaces may be deleted.  Archived or active entitlement sets may not be deleted.");
            }
            if (props.UserID != this.session.idUser)
            {
                throw new Exception("Only the owner has permission to delete a workspace.");
            }

            engine.SetEntAssignmentSet
                (idEASet, "deleted", DateTime.Now,
                props.Commentary, props.SubProcessID, props.UserID, props.DATETIMEbirth);

            if (idEASet == this.session.idWorkspace)
            {
                // Make sure this user is not still "logged in" to the now-dead workspace
                this.session.idWorkspace          = -1;
                this.session.idUserWorkspaceOwner = -1;
            }
            context.Response.Write("OK\n");
        }
        public void OnBeforeCallback(object sender, EventArgs oArgs)
        {
            boolMustAbort   = false;
            MAPsubprToEASet =
                new Dictionary <int, HELPERS.infoEASet>();
            MAPbroleToSubproc =
                new Dictionary <int, int>();
            MAPbroleIdToName =
                new Dictionary <int, string>();

            QUEUEidsBusrolesToADD    = new Queue <int>();
            QUEUEidsBusrolesToREMOVE = new Queue <int>();
            engineBusRole            = new IBusRole(HELPERS.NewOdbcConn());
            engineEASet = new IEntAssignmentSet(HELPERS.NewOdbcConn());
            messages    = "";
        }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);


            //return;  // Does the following code cause the JScript errrors?

            PANELcond_InviteCreateWS.Visible     = false;
            PANELcond_Locked.Visible             = false;
            PANELcond_NewSubpr.Visible           = false;
            PANELcond_IsOwnerOfCurrentWS.Visible = false;


            session.ObtainWorkspaceContext();

            if (session.idWorkspace >= 0)
            {
                // A WORKSPACE ALREADY EXISTS FOR THIS SUBPROCESS.
                if (session.isWorkspaceOwner)
                {
                    PANELcond_IsOwnerOfCurrentWS.Visible = true;
                }
                else
                {
                    PANELcond_Locked.Visible = true;
                }
            }
            else
            {
                // Invite them to create a new workspace by cloning the
                // most recent locked EASet.

                IEntAssignmentSet engineWS = new IEntAssignmentSet(HELPERS.NewOdbcConn());

                returnListEntAssignmentSetBySubProcess[] listEAS =
                    engineWS.ListEntAssignmentSetBySubProcess
                        (null, "", new string[] {}, "c_u_DATETIMElock DESC", session.idSubprocess);
                if (listEAS.Length == 0)
                {
                    PANELcond_NewSubpr.Visible = true;
                }
                else
                {
                    PANELcond_InviteCreateWS.Visible = true;
                }
            }
        }
Exemple #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            PANELcond_InviteCreateWS.Visible     = false;
            PANELcond_Locked.Visible             = false;
            PANELcond_NewSubpr.Visible           = false;
            PANELcond_IsOwnerOfCurrentWS.Visible = false;

            System.Data.Odbc.OdbcConnection conn = HELPERS.NewOdbcConn();
            // Is there a currently active ed workspace for this subprocess?\
            IEditingWorkspace engineWS = new IEditingWorkspace(conn);

            returnListEditingWorkspaceBySubProcess[] listWS =
                engineWS.ListEditingWorkspaceBySubProcess(null, session.idSubprocess);
            if (listWS.Length > 1)
            {
                throw new Exception("Internal error: more than one workspace for subprocess "
                                    + session.idSubprocess);
            }
            if (listWS.Length == 1)
            {
                // A workspace already exists for this subprocess.
                // If the WS owner matches this user, invite them to visit the WS.
                if (session.idUser == listWS[0].UserID)
                {
                    this.idActiveWS = listWS[0].ID;
                    PANELcond_IsOwnerOfCurrentWS.Visible = true;
                }
            }
            if (listWS.Length == 0)
            {
                IEntAssignmentSet engineEAS = new IEntAssignmentSet(conn);
                returnListEntAssignmentSetBySubProcess[] listEAS =
                    engineEAS.ListEntAssignmentSetBySubProcess
                        (null, "", new string[] {}, "c_u_DATETIMElock DESC", session.idSubprocess);
                if (listEAS.Length == 0)
                {
                    PANELcond_NewSubpr.Visible = true;
                }
                else
                {
                    PANELcond_InviteCreateWS.Visible = true;
                }
            }
        }
Exemple #5
0
        public int FindIdOfActiveEntitlementSet()
        {
            // 1(a). Find the ID of the ACTIVE entitlement set for this subprocess.
            IEntAssignmentSet engineEASet =
                new IEntAssignmentSet(HELPERS.NewOdbcConn());

            returnListEntAssignmentSet[] ret =
                engineEASet.ListEntAssignmentSet(null, "\"Status\" = ? AND \"SubProcess\"=?", new string[] { "ACTIVE", theSubProcess.ID.ToString() }, "");
            if (ret.Length > 1)
            {
                throw new Exception("Database error: more than one ACTIVE entitlement set for this subprocess");
            }
            if (ret.Length < 1)
            {
                return(-1);
            }
            return(ret[0].ID);
        }
Exemple #6
0
        /* Passing rolename as null is OK: generates just metadata about the entset context */
        private RoleMetadata GenerateRoleMetadata(string rolename, int wsID)
        {
            OdbcConnection tempconn = HELPERS.NewOdbcConn();

            RoleMetadata newbee = new RoleMetadata();

            IEntAssignmentSet engineEASet = new IEntAssignmentSet(tempconn);

            returnGetEntAssignmentSet eas = engineEASet.GetEntAssignmentSet(wsID);

            newbee.WSid         = wsID;
            newbee.WSstatus     = eas.Status;
            newbee.WSownerident =
                UserIdentificationString(eas.UserID, tempconn);
            newbee.WSdateOfImport =
                (eas.Status == "WORKSPACE") ? eas.DATETIMEbirth.ToString() :
                eas.DATETIMElock.ToString();


            newbee.ROLEownersident = new Queue <RoleMetadataOwner>();

            if (rolename != null)
            {
                int roleID;


                IBusRole            engineBR = new IBusRole(tempconn);
                returnListBusRole[] retFindBRole
                    = engineBR.ListBusRole(null, "\"Name\" = ?", new string[] { rolename }, "");

                if (retFindBRole.Length < 1)
                {
                    // If we get here, it's probably the case that rolename ends in "//DEL",
                    // i.e. representing a deleted role.
                    // throw new Exception("Rolename " + rolename + " not found");
                    roleID = -1;
                    // By setting roleID to this, we ensure that the list of role owners
                    // (computed by the logic immediately below)
                    // will just create an empty list.
                }
                else
                {
                    roleID = retFindBRole[0].ID;
                }

                newbee.rolename = rolename;

                IBusRoleOwner engineBRole = new IBusRoleOwner(tempconn);
                returnListBusRoleOwnerByBusRole[] roleowners
                    = engineBRole.ListBusRoleOwnerByBusRole(null, roleID);

                if (roleowners.Length < 1)
                {
                    RoleMetadataOwner baby = new RoleMetadataOwner();
                    baby.EID       = "";
                    baby.geography = "";
                    baby.rank      = "";
                    baby.name      = "";
                    newbee.ROLEownersident.Enqueue(baby);
                }
                else
                {
                    foreach (returnListBusRoleOwnerByBusRole roleowner in roleowners)
                    {
                        RoleMetadataOwner baby = new RoleMetadataOwner();
                        baby.EID       = roleowner.EID;
                        baby.geography = roleowner.Geography;
                        baby.rank      = roleowner.RankFriendly;
                        baby.name      = UserFriendlyName(roleowner.EID, tempconn);
                        newbee.ROLEownersident.Enqueue(baby);
                    }
                }
            }

            return(newbee);
        }
Exemple #7
0
        private OdbcDataReader ExtractSAPdataForDisplay(out string msg)
        {
            // 1(a). Find the ID of the ACTIVE entitlement set for this subprocess.
            IEntAssignmentSet engineEASet =
                new IEntAssignmentSet(HELPERS.NewOdbcConn());

            returnListEntAssignmentSet[] ret =
                engineEASet.ListEntAssignmentSet(null, "\"Status\" = ? AND \"SubProcess\"=?", new string[] { "ACTIVE", theSubProcess.ID.ToString() }, "");
            if (ret.Length > 1)
            {
                throw new Exception("Database error: more than one ACTIVE entitlement set for this subprocess");
            }
            if (ret.Length < 1)
            {
                msg = "There are no SAP entitlements to display for this subprocess.";
                return(null);
            }
            int theActiveEASetID = ret[0].ID;


            // 1(b). Find the ID of the ACTIVE TCode entitlement set for this subprocess.
            ITcodeAssignmentSet engineTCSet =
                new ITcodeAssignmentSet(HELPERS.NewOdbcConn());

            returnListTcodeAssignmentSetBySubProcess[] TCret =
                engineTCSet.ListTcodeAssignmentSetBySubProcess
                    (null, "\"Status\" = ? AND \"SubProcess\"=?", new string[] { "ACTIVE", theSubProcess.ID.ToString() }, "", theSubProcess.ID);
            if (TCret.Length > 1)
            {
                throw new Exception("Database error: more than one ACTIVE TCode entitlement set for this subprocess");
            }
            if (TCret.Length < 1)
            {
                msg = "There are no published TCode entitlement sets for this subprocess, so there are no results to report here.";
                return(null);
            }
            int theActiveTCodeSetID = TCret[0].ID;


            // 2. Grab all of the SAP-application entitlements in that active set
            string thesql =
                @"
SELECT
TCENT.c_u_TCode, SAPROLE.c_u_System, SAPROLE.c_u_Platform, SAPROLE.c_u_Name as SAPROLENAME,
TDICT.c_u_Description as TCDESCR, 
TCA.c_u_EditStatus, EA.c_r_EntAssignmentSet, TCA.c_r_TcodeAssignmentSet,
TCENT.c_u_ActivityFolder, 
(SELECT SAL.Name FROM DICT_SAPentitlementAccessLevel SAL WHERE SAL.Abbrev=TCENT.c_u_AccessLevel) as AccLevel
,
TCA.c_id as TCAID,
TCENT.c_id as TCENTID,
SAPROLE.c_id as SAPROLEID

FROM t_RBSR_AUFW_u_EntAssignment EA

LEFT OUTER JOIN t_RBSR_AUFW_u_Entitlement ENT 
   ON ENT.c_id=EA.c_r_Entitlement 

LEFT OUTER JOIN t_RBSR_AUFW_u_SAProle SAPROLE 
   ON SAPROLE.c_u_Name = ENT.c_u_EntitlementValue

LEFT OUTER JOIN t_RBSR_AUFW_u_TcodeAssignment TCA 
   ON TCA.c_r_SAProle = SAPROLE.c_id

LEFT OUTER JOIN t_RBSR_AUFW_u_TcodeAssignmentSet TCASET 
   ON TCA.c_r_TcodeAssignmentSet = TCASET.c_id

LEFT OUTER JOIN t_RBSR_AUFW_u_TcodeEntitlement TCENT
   ON TCA.c_r_TcodeEntitlement = TCENT.c_id

LEFT OUTER JOIN t_RBSR_AUFW_u_TcodeDictionary TDICT  ON TDICT.c_u_TcodeID = TCENT.c_u_TCode

WHERE 
EA.c_u_Status in ('N','A') 
AND
ENT.c_u_Application='SAP'
AND
ENT.c_u_EntitlementValue = SAPROLE.c_u_Name
AND
ENT.c_u_Platform = SAPROLE.c_u_Platform
AND 
((TCA.c_u_EditStatus & 4) = 0)
AND
EA.c_r_BusRole = " + this.theBR.ID + @"
AND
EA.c_r_EntAssignmentSet = "
                +
                theActiveEASetID
                + @"
AND 
TCASET.c_u_Status = 'ACTIVE' "
                + " ORDER BY SAPROLENAME, c_u_System, c_u_TCode;";

            OdbcDataReader DR;

            DR = HELPERS.RunSqlSelect(thesql);

            msg = "";
            return(DR);
        }
        public void ProcessRequest(HttpContext context)
        {
            string strIdSubpr = context.Request.Params["subproc"];
            int    idSubpr    = int.Parse(strIdSubpr);

            string mode = "regular";

            try
            {
                mode = context.Request.Params["mode"];
            }
            catch (Exception eee) { }



            // try valiantly to ensure no cacheing of this response
            context.Response.ExpiresAbsolute = DateTime.Now.AddDays(-100);
            context.Response.AddHeader("pragma", "no-cache");
            context.Response.AddHeader("cache-control", "private");
            context.Response.CacheControl = "no-cache";



            ComponentArt.Web.UI.TreeView tview = new ComponentArt.Web.UI.TreeView();


            IBusRole          engine   = new IBusRole(HELPERS.NewOdbcConn());
            IEntAssignmentSet engineWS = new IEntAssignmentSet(HELPERS.NewOdbcConn());


            AFWACsession fakesession = new AFWACsession(context.Request);

            fakesession.idSubprocess = idSubpr;
            fakesession.idUser       = -1;
            fakesession.ObtainWorkspaceContext();


            ComponentArt.Web.UI.TreeViewNode rootNode;


            if (mode == "ListEASetRetired")
            {
                returnListEntAssignmentSetBySubProcess[] listWS =
                    engineWS.ListEntAssignmentSetBySubProcess
                        (null, "\"Status\" IN ('archived')", new string[] {}, "c_u_DATETIMElock DESC", idSubpr);

                for (int i = 0; i < listWS.Length; i++)
                {
                    rootNode      = new ComponentArt.Web.UI.TreeViewNode();
                    rootNode.Text =
                        listWS[i].UserLoginName + " " + listWS[i].DATETIMElock + " - " + listWS[i].Commentary;
                    rootNode.Expanded     = false;
                    rootNode.ImageUrl     = "cal_nextMonth.gif";
                    rootNode.ShowCheckBox = true;
                    rootNode.ID           = "EntSet/ARCHIVE/" + listWS[i].SubProcessID;
                    rootNode.Value        = listWS[i].ID.ToString();
                    rootNode.RowCssClass  = "TreeRow_EASet";
                    rootNode.Checked      = false;
                    tview.Nodes.Add(rootNode);
                }
            }

            else
            {
                bool alreadyCheckedChoiceEASet = false;

                // The very first node always represents the active set of entitlements
                if ((fakesession.idActiveEAset >= 0) && (mode != "rolesonly"))
                {
                    rootNode              = new ComponentArt.Web.UI.TreeViewNode();
                    rootNode.Text         = "ACTIVE Entitlements";
                    rootNode.Expanded     = false;
                    rootNode.ImageUrl     = "cal_nextMonth.gif";
                    rootNode.ShowCheckBox = true;
                    rootNode.ID           = "EntSet/ACT/" + idSubpr;
                    rootNode.Value        = fakesession.idActiveEAset.ToString();
                    rootNode.RowCssClass  = "TreeRow_EASet";
                    rootNode.Checked      = true;
                    tview.Nodes.Add(rootNode);
                    alreadyCheckedChoiceEASet = true;
                }


                // The very next node will exist only if a workspace exists
                if ((fakesession.idWorkspace >= 0) && (mode != "rolesonly"))
                {
                    rootNode              = new ComponentArt.Web.UI.TreeViewNode();
                    rootNode.Text         = "WORKSPACE owned by " + fakesession.nameUserWorkspaceOwner;
                    rootNode.Expanded     = false;
                    rootNode.ImageUrl     = "cal_nextMonth.gif";
                    rootNode.ShowCheckBox = true;
                    rootNode.ID           = "EntSet/WS/" + idSubpr;
                    rootNode.Value        = fakesession.idWorkspace.ToString();
                    rootNode.Checked      = !alreadyCheckedChoiceEASet;
                    rootNode.RowCssClass  = "TreeRow_EASet";
                    tview.Nodes.Add(rootNode);
                    alreadyCheckedChoiceEASet = true;
                }


                if ((!alreadyCheckedChoiceEASet) && (mode != "rolesonly"))
                {
                    rootNode             = new ComponentArt.Web.UI.TreeViewNode();
                    rootNode.Text        = "WARNING: no entitlements yet - export will be empty";
                    rootNode.Expanded    = false;
                    rootNode.ImageUrl    = "close.gif";
                    rootNode.ID          = "EntSet/NONE/" + idSubpr;
                    rootNode.Value       = fakesession.idWorkspace.ToString();
                    rootNode.Checked     = !alreadyCheckedChoiceEASet;
                    rootNode.RowCssClass = "TreeRow_EASet";
                    tview.Nodes.Add(rootNode);
                    alreadyCheckedChoiceEASet = true;
                }


                if ((mode != "rolesonly"))
                {
                    rootNode                    = new ComponentArt.Web.UI.TreeViewNode();
                    rootNode.Text               = "Retired/archived entitlement sets:";
                    rootNode.Expanded           = false;
                    rootNode.ImageUrl           = "folder.gif";
                    rootNode.ID                 = "EntSet/FOLDERarchive/" + idSubpr;
                    rootNode.ContentCallbackUrl = "XMLtree_RolesInSubprocess.ashx?mode=ListEASetRetired&subproc=" + idSubpr;
                    tview.Nodes.Add(rootNode);
                }


                returnListBusRoleBySubProcess[] allroles = engine.ListBusRoleBySubProcess
                                                               (null, "", new string[] { }, "c_u_Name asc", (idSubpr));


                // Added 6 July 2009:  if number of roles exceeds a certain amount, only show an "ALL".
                if (allroles.Length > 50)
                {
                    rootNode              = new ComponentArt.Web.UI.TreeViewNode();
                    rootNode.Text         = "ALL ROLES (too many to show)";
                    rootNode.Expanded     = false;
                    rootNode.ImageUrl     = "icon_flag.gif";
                    rootNode.ShowCheckBox = true;
                    rootNode.RowCssClass  = "TreeRow_Role";
                    rootNode.ID           = "BR/" + idSubpr + "/*ALL*";
                    rootNode.Checked      = true;
                    tview.Nodes.Add(rootNode);
                }
                else
                {
                    foreach (returnListBusRoleBySubProcess cur in allroles)
                    {
                        rootNode              = new ComponentArt.Web.UI.TreeViewNode();
                        rootNode.Text         = cur.Name;
                        rootNode.Expanded     = false;
                        rootNode.ImageUrl     = "icon_flag.gif";
                        rootNode.ShowCheckBox = true;
                        rootNode.RowCssClass  = "TreeRow_Role";
                        rootNode.ID           = "BR/" + idSubpr + "/" + cur.ID;
                        rootNode.Checked      = false;

                        tview.Nodes.Add(rootNode);
                    }
                }
            }

            context.Response.ContentType = "text/xml";
            context.Response.Write(tview.GetXml());
        }
Exemple #9
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 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            session.ObtainWorkspaceContext();


            if (IsPostBack)
            {
                return;
            }



            PANELcond_Editable.Visible = false;
            PANELcond_ReadOnly.Visible = false;
            PANELcond_ViewOtherUserWorkspace.Visible = false;

            PANELcond_ViewActiveReadOnly.Visible     = false;
            PANELcond_ViewHistoricalReadOnly.Visible = false;

            IEntAssignmentSet engineEASET = new IEntAssignmentSet(HELPERS.NewOdbcConn());


            int IDeaset = -1;


            // STICKINESS: If the URL does not specifically demand a particular
            // workspace via query param, then draw it in from the session parameter.
            // Only if no session preference for a particular workspace would you then
            // default to the current open-for-editing workspace.
            if (this.Request.Params["WSID"] == null)
            {
                // URL does not explicitly request a particular EASet
                if (Session["INTcurWS"].ToString() != "")
                {
                    IDeaset = int.Parse(Session["INTcurWS"].ToString());
                }
            }
            else
            {
                IDeaset = int.Parse(this.Request.Params["WSID"].ToString());
            }

            if (IDeaset < 0)
            {
                // LAST RESORT:
                IDeaset = session.idWorkspace;
            }



            if (IDeaset != session.idWorkspace)
            {
                // IMPORTANT: we are going back in time and looking at a frozen state.
                // This is NOT a workspace!

                Session["INTcurWS"] = IDeaset;


                // Get info about this snapshot
                targetEASet = engineEASET.GetEntAssignmentSet(IDeaset);


                if (targetEASet.Status.ToLower() == "active")
                {
                    PANELcond_ViewActiveReadOnly.Visible = true;
                }
                else
                {
                    PANELcond_ViewHistoricalReadOnly.Visible = true;
                }
            }
            else
            {
                Session["INTcurWS"] = IDeaset;

                if (IDeaset >= 0)
                {
                    // THIS IS A WORKSPACE !!
                    // THIS IS A WORKSPACE !!
                    // THIS IS A WORKSPACE !!
                    // It might not belong to "me" but it is definitely a workspace
                    targetEASet = engineEASET.GetEntAssignmentSet(session.idWorkspace);
                    if (session.isWorkspaceOwner)
                    {
                        PANELcond_Editable.Visible = true;
                    }
                    else
                    {
                        PANELcond_ViewOtherUserWorkspace.Visible = true;
                    }
                }
                else
                {
                    // There IS no workspace!
                    PANELcond_ReadOnly.Visible = true;
                    Grid1.Visible = false;
                }
            }
        }
Exemple #11
0
        /* Warning: this is still singleton-based */

        /* This just takes whatever is the active EAS for the given subprocess,
         * but probably should receive the EAS ID as input.
         */
        public static void WorkspaceCreate(OdbcConnection conn, int IDsubprocess, string commentary)
        {
            IEditingWorkspace Iws = new IEditingWorkspace(conn);

            // BUG: hardwired user ID!
            int IDnewWS = Iws.NewEditingWorkspace(commentary, DateTime.Now, IDsubprocess, 1);


            // Still singleton!!
            EmptyTable(conn, "t_r_BusRoleWorkspaceEntitlement");
            EmptyTable(conn, "WorkspaceEntitlement");


            IWorkspaceEntitlement Iwserows = new IWorkspaceEntitlement(conn);
            IEntAssignmentSet     Ieas     = new IEntAssignmentSet(conn);
            IEntitlement          Ient     = new IEntitlement(conn);

            /* See above comment: this hardwared active=true logic is not good */
            returnListEntAssignmentSetBySubProcess[] _IDeas =
                Ieas.ListEntAssignmentSetBySubProcess(null, "\"BOOLisActive\" = 1", new string[] { }, "", IDsubprocess);
            int IDeas = _IDeas[0].ID;


            /* Find the list of EAssignments to bring over to the Workspace */
            IEntAssignment Iea = new IEntAssignment(conn);

            returnListEntAssignmentByEntAssignmentSet[] _IDea =
                Iea.ListEntAssignmentByEntAssignmentSet(null, "", new string[] {}, "", IDeas);
            int numToConvert = _IDea.Length;

            Hashtable dictEntVectorClones = new Hashtable();

            foreach (returnListEntAssignmentByEntAssignmentSet i in _IDea)
            {
                int IDentitlementVector = i.EntitlementID;
                int IDbusrole           = i.BusRoleID;
                int IDcloneEntVector    = -88;

                if (dictEntVectorClones.ContainsKey(IDentitlementVector))
                {
                    // The entitlement vector was already cloned in the workspace.
                    IDcloneEntVector =
                        (int)dictEntVectorClones[IDentitlementVector];
                }
                else
                {
                    // MUST CLONE THE VECTOR
                    returnGetEntitlement theE = Ient.GetEntitlement(IDentitlementVector);

                    IDcloneEntVector =
                        Iwserows.NewWorkspaceEntitlement
                            (theE.StandardActivity,
                            theE.RoleType,
                            theE.System,
                            theE.Platform,
                            theE.EntitlementName,
                            theE.EntitlementValue,
                            IDnewWS);

                    dictEntVectorClones.Add(IDentitlementVector, IDcloneEntVector);
                }

                // We have the bus.role ID and we now have the ID of the
                // WorkspaceEntitlement object.
                // We now create the tie that binds them.
                RecordLinkFromBusRoleToWSEntitVector
                    (conn, IDbusrole, IDcloneEntVector, IDnewWS);
            }
        }
Exemple #12
0
        /*
         * The version 2 coalesces vectors that are identical
         * except for the business role.  Right now it uses a simplistic
         * algorithm that includes the commentary column (not a good thing)
         * and that doesn't look for variations that would be considered
         * not important (whitespaces?).
         */
        public static void ImportDataTableAsNewEntAssignmentSet_v2(
            DataTable dt, int IDuser, int IDsubpr, System.Data.Odbc.OdbcConnection conn)
        {
            IUser             Iuser  = new IUser(conn);
            ISubProcess       Isubpr = new ISubProcess(conn);
            IEntAssignmentSet Ieaset = new IEntAssignmentSet(conn);
            IEntAssignment    Iea    = new IEntAssignment(conn);
            IEntitlement      Ientit = new IEntitlement(conn);
            IBusRole          Ibr    = new IBusRole(conn);

            int IDneweas =
                Ieaset.NewEntAssignmentSet(false, DateTime.Now, "Import from CSV", IDsubpr, IDuser);

            // These Get function are only useful for a read-only view of fields;
            // not for generating subordinate entities.
            returnGetEntAssignmentSet neweas = Ieaset.GetEntAssignmentSet(IDneweas);

            IEnumerator <System.Data.DataRow> x =
                (IEnumerator <System.Data.DataRow>)dt.Rows.GetEnumerator();


            Hashtable signatures = new Hashtable();

            while (x.MoveNext())
            {
                int IDbusrole;

                if (x.Current[0].Equals(System.DBNull.Value))
                {
                    // Ignore any line with no value in the first field.
                    // Often the end of the csv file has just lots of blank rows.
                    continue;
                }

                // Make sure business role object exists; create if not.
                string busrole         = (string)(x.Current["BusRole"]);
                returnListBusRole[] xx = Ibr.ListBusRole(null, "\"Name\" like ?",
                                                         new string[] { busrole }, "");
                if (xx.Length < 1)
                {
                    // MUST ADD NEW ONE
                    IDbusrole =
                        Ibr.NewBusRole(busrole, x.Current["Business Role Description"] as string, IDsubpr);
                }
                else
                {
                    IDbusrole = xx[0].ID;
                }


                /* Create a "signature" for this entitlement vector so we can
                 * register it and also see if it's been seen before.
                 */
                string thisSignature =
                    x.Current["Standard Activity"] as string + "/\\" +
                    x.Current["Type"] as string + "/\\" +
                    x.Current["System"] as string + "/\\" +
                    x.Current["Platform"] as string + "/\\" +
                    x.Current["Entitlement Description"] as string + "/\\" +
                    x.Current["Entitlement Value"] as string + "/\\" +
                    "" + "/\\" +
                    x.Current["Authorization Object"] as string + "/\\" +
                    x.Current["Field-Level Security Name"] as string + "/\\" +
                    x.Current["Field-Level Security Value"] as string + "/\\" +
                    x.Current["4th Level Security Name"] as string + "/\\" +
                    x.Current["4th Level Security Value"] as string;

                if (signatures.ContainsKey(thisSignature))
                {
                    // Already seen before, so just add this bus.role
                    // to the list of busroles tied to this.
                    int IDnewent = (int)signatures[thisSignature];

                    int IDnewentass = Iea.NewEntAssignment
                                          (IDneweas, IDbusrole, IDnewent);
                }
                else
                {
                    int IDnewent = Ientit.NewEntitlement(
                        x.Current["Standard Activity"] as string,
                        x.Current["Type"] as string,
                        x.Current["System"] as string,
                        x.Current["Platform"] as string,
                        x.Current["Entitlement Description"] as string,
                        x.Current["Entitlement Value"] as string);

                    Ientit.SetEntitlement(IDnewent,
                                          x.Current["Standard Activity"] as string,
                                          x.Current["Type"] as string,
                                          x.Current["System"] as string,
                                          x.Current["Platform"] as string,
                                          x.Current["Entitlement Description"] as string,
                                          x.Current["Entitlement Value"] as string,
                                          "",
                                          x.Current["Authorization Object"] as string,
                                          x.Current["Field-Level Security Name"] as string,
                                          x.Current["Field-Level Security Value"] as string,
                                          x.Current["4th Level Security Name"] as string,
                                          x.Current["4th Level Security Value"] as string,
                                          x.Current["Additional Comments"] as string,
                                          x.Current["Manifest Value"] as string);

                    int IDnewentass = Iea.NewEntAssignment
                                          (IDneweas, IDbusrole, IDnewent);

                    signatures.Add(thisSignature, IDnewent);
                }
            }
        }
Exemple #13
0
        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());
        }