コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            try
            {
                IDrole = int.Parse(this.Request.Params["RoleID"]);
                this.session.idRole = IDrole;
            }
            catch (Exception ex)
            {
                IDrole = this.session.idRole;
            }

            IBusRole IFACEbrole = new IBusRole(HELPERS.NewOdbcConn());

            brole = IFACEbrole.GetBusRole(IDrole);

            // We are now doing some sticky stuff so you can dive
            // into an old non-workspace EASet, and bounce up/down
            // without worrying about getting reset back to looking
            // at the workspace.
            //Session["INTcurWS"] = session.idWorkspace;


            Session["INTcurBUSROLE"] = session.idRole;
        }
コード例 #2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            OdbcConnection conn = HELPERS.NewOdbcConn();

            int IDsubpr = int.Parse(context.Request.Params["IDsubprocess"]);

            string linkedbusroles =
                " " + context.Request.Params["linkedbusroles"] + " ";

            IBusRole Ibr = new IBusRole(conn);

            context.Response.Write("<select ID='SELECTlinkedBRoles' multiple='multiple' class='geomfill2d'>");


            returnListBusRoleBySubProcess[] result =
                Ibr.ListBusRoleBySubProcess(null, "",
                                            new string[] {}, "c_u_Abbrev ASC", IDsubpr);

            foreach (returnListBusRoleBySubProcess brole in result)
            {
                context.Response.Write("<option ");
                if (linkedbusroles.Contains(" " + brole.Abbrev + " "))
                {
                    context.Response.Write("selected='1'");
                }
                context.Response.Write(">" + brole.Abbrev + "</option>");
            }
            context.Response.Write("</select>");
        }
コード例 #3
0
        // Updates a business role object and if necessary creates new user objects for role ownership
        private void JQDLGbusroleProperties(System.Collections.Specialized.NameValueCollection pars, HttpResponse httpResponse)
        {
            IBusRole engineBR = new IBusRole(CONNdedicated);
            IBusRole engine   = engineBR;

            int idbusrole;

            if (pars["JQDLGbp_id"].Length == 0)
            {
                // WE ARE CREATING A NEW BUS ROLE, NOT JUST UPDATING EXISTING

                int babyid = -1;

                try
                {
                    babyid =
                        engine.NewBusRole(
                            pars["JQDLGbp_name"],
                            pars["JQDLGbp_descr"], session.idSubprocess);
                }
                catch (Exception eee)
                {
                    throw new Exception("Addition of new role failed: check for name already in use.");
                }
                idbusrole = babyid;
                // Default role type: Functional
                engineBR.SetBusRole(idbusrole, "F");
            }
            else
            {
                returnListBusRole[] chk =
                    engineBR.ListBusRole(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 business role.");
                }

                idbusrole = int.Parse(pars["JQDLGbp_id"]);
            }



            engineBR.SetBusRole(
                idbusrole,
                pars["JQDLGbp_name"],
                pars["JQDLGbp_descr"],
                pars["JQDLGbp_primown_eid"],
                pars["JQDLGbp_secown_eid"],
                pars["JQDLGbp_designdetails"]);
            engineBR.SetBusRole(idbusrole, pars["JQDLGbp_roletype"]);

            httpResponse.Write("OK");
        }
コード例 #4
0
        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    = "";
        }
コード例 #5
0
        private void CloneBusRole(int idBusRole, string newBusRoleName, int idWorkspace, HttpResponse response)
        {
            IBusRole       engineBR  = new IBusRole(HELPERS.NewOdbcConn_FORCE());
            IEntAssignment engineEAS = new IEntAssignment(HELPERS.NewOdbcConn_FORCE());

            returnGetBusRole detailsBusRole = engineBR.GetBusRole(idBusRole);

            int idNewBRole;

            try
            {
                idNewBRole = engineBR.NewBusRole(newBusRoleName,
                                                 detailsBusRole.Description, detailsBusRole.SubProcessID);
                // Also copy over the notes and the owner info as well.
                engineBR.SetBusRole
                    (idNewBRole, newBusRoleName, detailsBusRole.Description,
                    detailsBusRole.OwnerPrimaryEID, detailsBusRole.OwnerSecondaryEID, detailsBusRole.DesignDetails);
                engineBR.SetBusRole(idNewBRole, detailsBusRole.RoleType_Abbrev);
            }
            catch (Exception exxx)
            {
                response.Write("ERROR: The given name was found to already be in use.");
                return;
            }

            returnListEntAssignmentByEntAssignmentSet[] ret =
                engineEAS.ListEntAssignmentByEntAssignmentSet(null, " \"BusRole\" = ? AND \"Status\" NOT IN ('X') ",
                                                              new string[] { idBusRole.ToString() }, "", idWorkspace);

            for (int i = 0; i < ret.Length; i++)
            {
                engineEAS.NewEntAssignment
                (
                    idWorkspace, idNewBRole, ret[i].EntitlementID, "N");
            }

            response.Write("The role was successfully cloned.  Number of entitlement assignments: " +
                           ret.Length);
        }
コード例 #6
0
ファイル: DETAILbusrole.aspx.cs プロジェクト: dfsklar/RAF
        public string ROWSadditionalBusinessRoles()
        {
            IAdditionalBusRole engine   = new IAdditionalBusRole(HELPERS.NewOdbcConn());
            IBusRole           engineBR = new IBusRole(HELPERS.NewOdbcConn());

            returnListAdditionalBusRoleByBusRole[] list =
                engine.ListAdditionalBusRoleByBusRole(null, idBR);

            StringBuilder BUFFER = new StringBuilder();

            foreach (returnListAdditionalBusRoleByBusRole cur in list)
            {
                returnGetBusRole detail = engineBR.GetBusRole(cur.idAdditionalBusRole);
                if (!detail.Name.Contains("//DEL_"))
                {
                    BUFFER.Append("<tr>");
                    BUFFER.Append("<td>" + detail.RoleType_Displayable + "</td>");
                    BUFFER.Append("<td><a href='DETAILbusrole.aspx?idBR=" + detail.ID + "'>" + detail.Name + "</a></td>");
                    BUFFER.Append("<td>" + detail.Description + "</td>");
                    BUFFER.Append("</tr>");
                }
            }
            return(BUFFER.ToString());
        }
コード例 #7
0
        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());
        }
コード例 #8
0
        private void CSVgenerate_IDMreconciliation_3column
            (HttpContext context, OdbcDataReader dr, IMVFormula ENGINEmanif, IEntitlement ENGINEwsent,
            bool BOOLgenerateHeader)
        {
            int colnumFormula   = -1;
            int colnumRolename  = -1;
            int colnumRoledescr = -1;

            OdbcConnection tempconn    = HELPERS.NewOdbcConn_FORCE();
            IBusRole       engineBR    = new IBusRole(tempconn);
            IBusRoleOwner  engineBRole = new IBusRoleOwner(tempconn);

            Dictionary <string, bool> DICTboolHaveSeenThisRole = new Dictionary <string, bool>();

            for (int i = 0; i < dr.VisibleFieldCount; i++)
            {
                switch (dr.GetName(i) as string)
                {
                case "Formula":
                    colnumFormula = i;
                    break;

                case "Business_Role_Name":
                    colnumRolename = i;
                    break;

                case "Business_Role_Description":
                    colnumRoledescr = i;
                    break;
                }
            }

            if (BOOLgenerateHeader)
            {
                context.Response.Write("RoleName,Entitlement,ComparisonObject\n");
            }


            // FOR EACH ROW

            while (dr.Read())
            {
                try
                {
                    int IDwsentrow = (int)(dr.GetValue(0));

                    object RESLT;
                    ComputePrivilegeString(context, ENGINEmanif, ENGINEwsent, IDwsentrow, out RESLT);
                    string resultAsStr = RESLT.ToString().Replace(" ", "");

                    // If the first time we are seeing this role, emit its description text.
                    if (!DICTboolHaveSeenThisRole.ContainsKey(dr.GetValue(colnumRolename) as string))
                    {
                        string rolename = dr.GetValue(colnumRolename) as string;
                        context.Response.Write(CSVquoteize(rolename) + ",");
                        context.Response.Write(CSVquoteize(dr.GetValue(colnumRoledescr) as string) + ",");
                        context.Response.Write("RoleDescription");
                        context.Response.Write("\n");
                        DICTboolHaveSeenThisRole[rolename] = true;
                        returnListBusRole[] retFindBRole
                            = engineBR.ListBusRole(null, "\"Name\" = ?", new string[] { rolename }, "");
                        int roleID = retFindBRole[0].ID;
                        returnListBusRoleOwnerByBusRole[] roleowners
                            = engineBRole.ListBusRoleOwnerByBusRole(null, roleID);
                        foreach (returnListBusRoleOwnerByBusRole roleowner in roleowners)
                        {
                            context.Response.Write(CSVquoteize(rolename) + ",");
                            context.Response.Write(roleowner.EID + ",");
                            context.Response.Write(roleowner.RankFriendly.Replace(" ", ""));
                            context.Response.Write("\n");
                        }
                    }

                    context.Response.Write(CSVquoteize(dr.GetValue(colnumRolename) as string) + ",");

                    context.Response.Write(CSVquoteize(resultAsStr.Replace(" ", "")) + ",");
                    context.Response.Write("Entitlement");
                    context.Response.Write("\n");
                }

                catch (Exception e)
                {
                    context.Response.Write(e.ToString() + e.StackTrace.ToString() + "\n");
                }
            }

            return;
        }
コード例 #9
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);
        }
コード例 #10
0
        ONCLICK_BulkUploadNewBusRoles(object sender, EventArgs e)
        {
            IBusRoleOwner ENGINEbrown = new IBusRoleOwner(HELPERS.NewOdbcConn());
            IBusRole      ENGINEbr    = new IBusRole(HELPERS.NewOdbcConn());


            if (this.FileUpload_AddRoles.HasFile)
            {
                string pathTempFolder = System.IO.Path.GetTempPath();
                string pathTempFile   = System.IO.Path.GetTempFileName();
                FileUpload_AddRoles.SaveAs(pathTempFile);
                DataTable dt = HELPERS.LoadCsv(pathTempFolder,
                                               System.IO.Path.GetFileName(pathTempFile));
                if (dt != null)
                {
                    if (dt.Columns.Count < 2)
                    {
                        throw new Exception("The uploaded CSV file must have at least the name and description columns.  (It can optionally also have the two approver/owner columns.)");
                    }


                    Queue RETmsgs = new Queue();

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

                    int recordseq = 0;
                    int okCount   = 0;
                    while (x.MoveNext())
                    {
                        recordseq++;

                        string rolename        = x.Current[0].ToString().Trim();
                        string description     = x.Current[1].ToString().Trim();
                        string roletype        = x.Current[2].ToString().Trim();
                        string primaryApprover = x.Current[3].ToString().Trim().ToUpper();
                        string primaryOwner    = x.Current[4].ToString().Trim().ToUpper();


                        int IDrole = -1;
                        try
                        {
                            IDrole = HELPERS.FindBusRoleByName(rolename);
                        }
                        catch (Exception)
                        {
                            /* The exception is what we WANT!  If this does not throw an exception, this row must be ignored! */
                        }


                        bool doRoleCreation = true;

                        if (IDrole >= 0)
                        {
                            // This role name is already in use somewhere in the system (not nec this subpr).
                            RETmsgs.Enqueue("REC#" + recordseq.ToString() + ": Role already exists, so the only action will be updating of owner/approver info.  Role name: " + rolename);
                            doRoleCreation = false;
                        }

                        int newID = (doRoleCreation ? -1 : IDrole);
                        if (doRoleCreation)
                        {
                            switch (roletype)
                            {
                            case "A":
                                break;

                            case "F":
                                break;

                            case "E":
                                break;

                            default:
                                RETmsgs.Enqueue("REC#" + recordseq.ToString() + ": line ignored due to unknown role-type code: " + roletype);
                                continue;
                            }

                            try
                            {
                                newID = ENGINEbr.NewBusRole(rolename, description, session.idSubprocess);
                                ENGINEbr.SetBusRole(newID, roletype);
                                okCount++;
                            }
                            catch (Exception ee)
                            {
                                RETmsgs.Enqueue("REC#" + recordseq.ToString() + ": " + ee.Message);
                            }
                        }

                        if (newID >= 0)
                        {
                            // New code added Thanksgiving 2012: supporting approver/owner
                            if (primaryOwner.Length > 2)
                            {
                                string __eid        = primaryOwner;
                                string __rank       = "OWNprim";
                                string __rankPretty = "Primary Owner";
                                try
                                {
                                    HELPERS.FindUser(HELPERS.NewOdbcConn(), __eid, __eid, false);
                                    returnListBusRoleOwnerByBusRole[] theList = ENGINEbrown.ListBusRoleOwnerByBusRole(null, newID);
                                    if (theList.Length < 1)
                                    {
                                        ENGINEbrown.NewBusRoleOwner(__eid, "", __rank, newID);
                                    }
                                    else
                                    {
                                        foreach (returnListBusRoleOwnerByBusRole roleowner in theList)
                                        {
                                            if (roleowner.Rank == __rank)
                                            {
                                                ENGINEbrown.DeleteBusRoleOwner(roleowner.ID);
                                            }
                                        }
                                    }
                                }
                                catch (Exception ee)
                                {
                                    RETmsgs.Enqueue("REC#" + recordseq.ToString() + ": ignoring setting of " + __rankPretty + " due to unknown employee ID: " + __eid);
                                }
                            }


                            if (primaryApprover.Length > 2)
                            {
                                string __eid        = primaryApprover;
                                string __rank       = "appr";
                                string __rankPretty = "Primary Approver";
                                try
                                {
                                    HELPERS.FindUser(HELPERS.NewOdbcConn(), __eid, __eid, false);
                                    returnListBusRoleOwnerByBusRole[] theList = ENGINEbrown.ListBusRoleOwnerByBusRole(null, newID);
                                    if (theList.Length < 1)
                                    {
                                        ENGINEbrown.NewBusRoleOwner(__eid, "", __rank, newID);
                                    }
                                    else
                                    {
                                        foreach (returnListBusRoleOwnerByBusRole roleowner in theList)
                                        {
                                            if (roleowner.Rank == __rank)
                                            {
                                                ENGINEbrown.DeleteBusRoleOwner(roleowner.ID);
                                            }
                                        }
                                    }
                                }
                                catch (Exception ee)
                                {
                                    RETmsgs.Enqueue("REC#" + recordseq.ToString() + ": ignoring setting of " + __rankPretty + " due to unknown employee ID: " + __eid);
                                }
                            }
                        }
                    }

                    // -----------------------------------------------

                    RETmsgs.Enqueue("------------------");
                    RETmsgs.Enqueue("Number of NEW business roles created successfully: " + okCount.ToString());
                    if (RETmsgs.Count > 0)
                    {
                        string strMsgs = "";
                        foreach (object objMsg in RETmsgs.ToArray())
                        {
                            strMsgs += "\n" + objMsg.ToString();
                        }
                        TXTimportEngineMessages.Text  = strMsgs;
                        DIVimportFeeback.Visible      = true;
                        PANELcond_AbortUpload.Visible = false;
                        PANELcond_AllowUpload.Visible = false;
                    }
                }
            }
        }
コード例 #11
0
        protected void ONCLICK_BulkRemove(object sender, EventArgs e)
        {
            if (this.FileUpload_BulkRemove.HasFile)
            {
                string pathTempFolder = System.IO.Path.GetTempPath();
                string pathTempFile   = System.IO.Path.GetTempFileName();
                FileUpload_BulkRemove.SaveAs(pathTempFile);
                DataTable dt = HELPERS.LoadCsv(pathTempFolder,
                                               System.IO.Path.GetFileName(pathTempFile));
                if (dt != null)
                {
                    if (dt.Columns.Count != 2)
                    {
                        throw new Exception("The uploaded CSV file has more than two columns.");
                    }


                    Queue RETmsgs = new Queue();

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

                    int recordseq = 0;
                    int okCount   = 0;

                    IBusRole       ENGINEbusrole = new IBusRole(HELPERS.NewOdbcConn());
                    IEntitlement   ENGINE        = new IEntitlement(HELPERS.NewOdbcConn());
                    IEntAssignment IEA           = new IEntAssignment(HELPERS.NewOdbcConn());


                    while (x.MoveNext())
                    {
                        recordseq++;

                        string rolename   = x.Current[0].ToString();
                        string privstring = x.Current[1].ToString();

                        try
                        {
                            HELPERS.RemoveEntitlementFromRole(rolename, privstring, ENGINEbusrole, ENGINE, IEA);
                            okCount++;
                        }
                        catch (Exception ee)
                        {
                            RETmsgs.Enqueue("REC#" + recordseq.ToString() + ": " + ee.Message);
                        }
                    }
                    RETmsgs.Enqueue("------------------");
                    RETmsgs.Enqueue("Number of records processed without message: " + okCount.ToString());
                    if (RETmsgs.Count > 0)
                    {
                        string strMsgs = "";
                        foreach (object objMsg in RETmsgs.ToArray())
                        {
                            strMsgs += "\n" + objMsg.ToString();
                        }
                        TXTimportEngineMessages.Text  = strMsgs;
                        DIVimportFeeback.Visible      = true;
                        PANELcond_AbortUpload.Visible = false;
                        PANELcond_AllowUpload.Visible = false;
                    }
                }
            }
        }
コード例 #12
0
        ONCLICK_BulkUploadPersonnel(object sender, EventArgs e)
        {
            Dictionary <string, bool> DOESEXISTbyEid = new Dictionary <string, bool>();
            Dictionary <string, int>  DICTbusrole    = new Dictionary <string, int>();

            IBusRoleOwner ENGINEbrown = new IBusRoleOwner(HELPERS.NewOdbcConn());
            IBusRole      ENGINEbr    = new IBusRole(HELPERS.NewOdbcConn());


            if (this.FileUpload_PersonnelMappings.HasFile)
            {
                string pathTempFolder = System.IO.Path.GetTempPath();
                string pathTempFile   = System.IO.Path.GetTempFileName();
                FileUpload_PersonnelMappings.SaveAs(pathTempFile);
                DataTable dt = HELPERS.LoadCsv(pathTempFolder,
                                               System.IO.Path.GetFileName(pathTempFile));
                if (dt != null)
                {
                    if (dt.Columns.Count < 3)
                    {
                        throw new Exception("The uploaded CSV file does not have at least 3 columns.");
                    }


                    Queue RETmsgs = new Queue();

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

                    int recordseq = 0;
                    int okCount   = 0;
                    while (x.MoveNext())
                    {
                        recordseq++;

                        string rolename = x.Current[0].ToString().Trim();
                        string rank     = x.Current[1].ToString().Trim();
                        string eid      = x.Current[2].ToString().Trim().ToUpper();


                        switch (rank)
                        {
                        case "Primary Owner":
                            rank = "OWNprim";
                            break;

                        case "Delegate Owner":
                            rank = "OWNdele";
                            break;

                        case "Primary Approver":
                            rank = "appr";
                            break;

                        case "Delegate Approver":
                            rank = "delegate";
                            break;

                        default:
                            RETmsgs.Enqueue("REC#" + recordseq.ToString() + ": line ignored due to unknown rank name: " + rank);
                            continue;
                        }


                        if (recordseq == 1)
                        {
                            // Upon seeing at least one row in the CSV, erase the entire personnel mapping table!
                            HELPERS.DestroyAllBusroleToPersonnelMappings();
                        }

                        if (DOESEXISTbyEid.ContainsKey(eid) == false)
                        {
                            HELPERS.FindUser(HELPERS.NewOdbcConn(), eid, eid, true);
                            DOESEXISTbyEid.Add(eid, true);
                        }


                        int IDrole = -1;
                        if (DICTbusrole.ContainsKey(rolename))
                        {
                            IDrole = DICTbusrole[rolename];
                        }
                        else
                        {
                            try
                            {
                                IDrole = HELPERS.FindBusRoleByName(rolename);
                                DICTbusrole.Add(rolename, IDrole);
                            }
                            catch (Exception)
                            {
                            }
                        }


                        if (IDrole < 0)
                        {
                            RETmsgs.Enqueue("REC#" + recordseq.ToString() + ": line ignored due to unknown role: " + rolename);
                            continue;
                        }


                        try
                        {
                            ENGINEbrown.NewBusRoleOwner(eid, "", rank, IDrole);
                            okCount++;
                        }
                        catch (Exception ee)
                        {
                            RETmsgs.Enqueue("REC#" + recordseq.ToString() + ": " + ee.Message);
                        }
                    }

                    RETmsgs.Enqueue("------------------");
                    RETmsgs.Enqueue("Number of records processed successfully: " + okCount.ToString());
                    if (RETmsgs.Count > 0)
                    {
                        string strMsgs = "";
                        foreach (object objMsg in RETmsgs.ToArray())
                        {
                            strMsgs += "\n" + objMsg.ToString();
                        }
                        TXTimportEngineMessages.Text  = strMsgs;
                        DIVimportFeeback.Visible      = true;
                        PANELcond_AbortUpload.Visible = false;
                        PANELcond_AllowUpload.Visible = false;
                    }
                }
            }
        }
コード例 #13
0
ファイル: DETAILbusrole.aspx.cs プロジェクト: dfsklar/RAF
        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;
                }
            }
        }
コード例 #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);


            MAPentIdToBabyEAssId = new Dictionary <int, int>();

            try
            {
                IDrole = int.Parse(this.Request.Params["RoleID"]);
            }
            catch (Exception ex)
            {
                // Whilst debugging
                IDrole = 1;
            }

            IBusRole IFACEbrole = new IBusRole(HELPERS.NewOdbcConn());

            brole = IFACEbrole.GetBusRole(IDrole);
            Session["STRcurBusRoleScope"] = IDrole;



            // NO LONGER USED:
            //   Session["STRcurWS"] = this.session.idWorkspace;


            int IDeaset = -1;

            try {
                IDeaset = int.Parse(Session["INTcurWS"].ToString());
            }catch (Exception) {}



            bool isreadonly = true;

            if (IDeaset == this.session.idWorkspace)
            {
                isreadonly = (!this.session.isWorkspaceOwner);
            }

            if (isreadonly)
            {
                // READ-ONLY - not in a workspace
                this.Grid1.AllowEditing         = false;
                this.PANELcond_readonly.Visible = true;
            }
            else
            {
                this.PANELcond_readonly.Visible = false;
            }



            try
            {
                IDappl         = int.Parse(this.Request.Params["AppID"]);
                session.idAppl = IDappl;
            }
            catch (Exception ex)
            {
                // Whilst debugging
                IDappl = session.idAppl;
            }
            IApplication IFACEappl = new IApplication(HELPERS.NewOdbcConn());

            applDetails = IFACEappl.GetApplication(IDappl);
            this.Session["STRcurAppScope"] = applDetails.Name;
        }
コード例 #15
0
        private void UpdateDb(ComponentArt.Web.UI.GridItem item, string command)
        {
            IBusRole       engine   = new IBusRole(HELPERS.NewOdbcConn());
            IEntAssignment engineEA = new IEntAssignment(HELPERS.NewOdbcConn());



            switch (command)
            {
            case "INSERT":
                ValidateAbbrev(item["c_u_Abbrev"] as string, -1);
                item["c_id"] =
                    engine.NewBusRole(
                        item["c_u_Name"] as string,
                        item["c_u_Description"] as string,
                        this.session.idSubprocess);
                engine.SetBusRole
                (
                    (int)(item["c_id"]),
                    item["c_u_Name"] as string,
                    item["c_u_Description"] as string,
                    this.session.idSubprocess,
                    item["c_u_Abbrev"] as string, null, null, null);
                break;

            case "UPDATE":
                ValidateAbbrev(item["c_u_Abbrev"] as string,
                               int.Parse(item["c_id"] as string));
                engine.SetBusRole
                    (int.Parse(item["c_id"] as string),
                    item["c_u_Name"] as string,
                    item["c_u_Description"] as string,
                    this.session.idSubprocess,
                    item["c_u_Abbrev"] as string);
                break;

            case "DELETE":
                int IDbusrole = int.Parse(item["c_id"] as string);

                // 1. Delete any EntAssignments involving this business role...
                // ... in this workspace... ...that have status "X".
                returnListEntAssignmentByBusRole[] ret = engineEA.ListEntAssignmentByBusRole
                                                             (null, "", new string[] {}, "", IDbusrole);
                int refsStillPresent = 0;
                for (int i = 0; i < ret.Length; i++)
                {
                    if (ret[i].Status == "X")
                    {
                        engineEA.DeleteEntAssignment(ret[i].ID);
                    }
                    else
                    {
                        refsStillPresent++;
                    }
                }

                // 2. Check to see if there are any more references to this bus role
                if (refsStillPresent > 0)
                {
                    throw new Exception
                              ("This business role cannot be deleted at this time, because there is/are still " + refsStillPresent + " reference(s) to this business role, in other workspaces or historical snapshots.");
                }

                // 3. Delete the business role itself.
                engine.DeleteBusRole(IDbusrole);
                break;
            }
        }
コード例 #16
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);
                }
            }
        }
コード例 #17
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());
        }
コード例 #18
0
        private void UpdateDb(ComponentArt.Web.UI.GridItem item, string command)
        {
            IBusRole       engine   = new IBusRole(HELPERS.NewOdbcConn());
            IEntAssignment engineEA = new IEntAssignment(HELPERS.NewOdbcConn());



            switch (command)
            {
            case "INSERT":
                ValidateAbbrev(item["c_u_Abbrev"] as string, -1);
                try
                {
                    item["c_id"] =
                        engine.NewBusRole(
                            item["c_u_Name"] as string,
                            item["c_u_Description"] as string,
                            this.session.idSubprocess);
                }
                catch (Exception eee)
                {
                    throw new Exception("Addition of new role failed: check for name already in use.");
                }

                engine.SetBusRole
                (
                    (int)(item["c_id"]),
                    item["c_u_Name"] as string,
                    item["c_u_Description"] as string,
                    this.session.idSubprocess,
                    item["c_u_Abbrev"] as string, null, null, null);
                break;

            case "UPDATE":
                ValidateAbbrev(item["c_u_Abbrev"] as string,
                               int.Parse(item["c_id"] as string));
                engine.SetBusRole
                    (int.Parse(item["c_id"] as string),
                    item["c_u_Name"] as string,
                    item["c_u_Description"] as string,
                    this.session.idSubprocess,
                    item["c_u_Abbrev"] as string);
                break;

            case "DELETE":
                int IDbusrole = int.Parse(item["c_id"] as string);


                // Deleting a role is forbidden only if *this* workspace
                // still has non-"X" entitlement assignments to it.
                //
                // 1. Count the number of non-X entass in this workspace.
                returnListEntAssignmentByBusRole[] ret = engineEA.ListEntAssignmentByBusRole
                                                             (null, " (\"status\" <> ?) AND (\"entassignmentset\" = ?) ", new string[] { "X", this.session.idWorkspace.ToString() }, "", IDbusrole);
                int refsStillPresent = ret.Length;


                // 2. Check to see if there are any more references to this bus role
                if (refsStillPresent > 0)
                {
                    throw new Exception
                              ("This business role cannot be deleted at this time, because there is/are still " + refsStillPresent + " reference(s) to this business role, in other workspaces or historical snapshots.");
                }

                // 3. Delete the business role, but hiding it away in the special
                // "trashcan" subprocess.
                engine.MoveBusRoleToTrashcan(IDbusrole,
                                             int.Parse(ConfigurationManager.AppSettings["IDsubprocessTrashcan"]));

                break;
            }
        }