示例#1
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>");
        }
        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());
        }