コード例 #1
0
        private bool AuthCheck()
        {
            if (AlreadyLoggedIn())
            {
                return(true);
            }


            int    IDuser      = int.Parse(this.CHOOSEusername.SelectedValue);
            string STRpassword = this.TXTpassword.Text.Trim();

            IUser         userfactory = new IUser(HELPERS.NewOdbcConn());
            returnGetUser userinfo    = userfactory.GetUser(IDuser);

            if
            (userinfo.EID.ToLower() ==
             STRpassword.ToLower())
            {
                //
                // LOGIN GOOD !
                //
                sessnew          = new AFWACsession(this.Request);
                sessnew.username = userinfo.Name;
                sessnew.idUser   = IDuser;

                // this extra session var UUIDSUBPROCESS is needed so data sources can use
                // it as parameters for scoping results.
                Session["AFWACSESSION"] = sessnew;
                Session["AFWACUSERID"]  = IDuser;

                Response.Redirect("SessionLOGIN.aspx");

                return(true);
            }
            else
            {
                this.PanelLoginFailMsg.Visible = true;
                return(false);
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);


            try
            {
                idSubPr = int.Parse(Request.Params["idsubr"]);
            }
            catch (Exception e2)
            {
                idSubPr = session.idSubprocess;
            }



            // Create lots of blank rows if not yet any rows for this subprocess.
            IMETADATA_SubprToActivityList engine = new IMETADATA_SubprToActivityList(HELPERS.NewOdbcConn());

            returnListMETADATA_SubprToActivityListBySubProcess[]
            retlist = engine.ListMETADATA_SubprToActivityListBySubProcess(null, idSubPr);
            if (retlist.Length == 0)
            {
                // AutoCreate lots of rows!
                for (int i = 0; i < 40; i++)
                {
                    int idBaby = engine.NewMETADATA_SubprToActivityList
                                     ("ACT", idSubPr);
                    engine.SetMETADATA_SubprToActivityList
                        (idBaby, (i + 1) * 1000, "ACT", false, "", "", "", idSubPr);
                }
            }


            DataView dv =
                (DataView)
                SqlDataSource1.Select(DataSourceSelectArguments.Empty);

            GridMain.DataSource = dv;
        }
コード例 #3
0
        protected void BTNloginReadOnly_Click(object sender, EventArgs e)
        {
            string eid        = this.TXTbusownereid.Text.Trim();
            IUser  engineuser = new IUser(HELPERS.NewOdbcConn());

            returnListUser[] ret =
                engineuser.ListUser(null, "\"EID\" like ?", new string[] { eid }, "");
            if (ret.Length != 1)
            {
                this.PanelReadOnlyLoginFailMsg.Visible = true;
                return;
            }
            if (ret.Length == 1)
            {
                Session["RAFLOGINbusOwnerEID"]       = eid;
                Session["RAFLOGINbusOwnerUserID"]    = ret[0].ID;
                Session["RAFLOGINbusOwnerNameFirst"] = ret[0].NameFirst;
                Response.Redirect("viewer/home.aspx");
                return;
            }
            throw new Exception("Database internal error code SESLG_230");
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            try
            {
                IDentitlement = int.Parse(this.Request.Params["entid"]);
            }
            catch (Exception)
            {
                // Whilst debugging
                IDentitlement = 64622;
            }

            IEntitlement engine = new IEntitlement(HELPERS.NewOdbcConn());

            THEent = engine.GetEntitlement(IDentitlement);

            // There is currently no concept of this page being "read only".
            // It creates workspaces as needed; it is not performed in
            // any particular workspace.
            this.PANELcond_readonly.Visible = false;
        }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            PANELcond_AbortUpload.Visible = false;
            PANELcond_AllowUpload.Visible = false;

            System.Data.Odbc.OdbcConnection conn = HELPERS.NewOdbcConn();



            try
            {
                session.ObtainWorkspaceContext_SAP();
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("more than one workspace"))
                {
                    Response.Redirect("Page_SAP_History.aspx");
                    return;
                }
            }



            if ((session.idWorkspace_SAP >= 0) && session.isWorkspaceOwner_SAP)
            {
                PANELcond_AllowUpload.Visible = true;
                PANELcond_AbortUpload.Visible = false;
            }
            else
            {
                PANELcond_AbortUpload.Visible = true;
                PANELcond_AllowUpload.Visible = false;
            }
        }
コード例 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            if (Request.Params["add"] != null)
            {
                IApplication engine = new IApplication(HELPERS.NewOdbcConn());
                try
                {
                    engine.NewApplication(Request.Params["add"]);
                }
                catch (Exception eee) { }
                // Failure would only occur if this name already present (e.g. if user doubleclicked)

                Response.Redirect("PAGEmanifestFormulas.aspx");
                return;
            }


            Grid1.UpdateCommand += new ComponentArt.Web.UI.Grid.GridItemEventHandler(this.Grid1_UpdateCommand);
            Grid1.DeleteCommand += new ComponentArt.Web.UI.Grid.GridItemEventHandler(this.Grid1_DeleteCommand);
            Grid1.InsertCommand += new ComponentArt.Web.UI.Grid.GridItemEventHandler(this.Grid1_InsertCommand);
            Grid1.NeedRebind    += new ComponentArt.Web.UI.Grid.NeedRebindEventHandler(this.OnNeedRebind);
        }
コード例 #7
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;
                    }
                }
            }
        }
コード例 #8
0
ファイル: ListSAPRoles.aspx.cs プロジェクト: dfsklar/RAF
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            Grid1.UpdateCommand += new ComponentArt.Web.UI.Grid.GridItemEventHandler(this.Grid1_UpdateCommand);
            Grid1.DeleteCommand += new ComponentArt.Web.UI.Grid.GridItemEventHandler(this.Grid1_DeleteCommand);
            Grid1.InsertCommand += new ComponentArt.Web.UI.Grid.GridItemEventHandler(this.Grid1_InsertCommand);



            try
            {
                session.ObtainWorkspaceContext_SAP();
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("more than one workspace"))
                {
                    Response.Redirect("Page_SAP_History.aspx");
                    return;
                }
            }



            Session["UUIDSAPTASSSET"] = session.idWorkspace_SAP;

            CALLBACKselectCurRole.Callback +=
                new ComponentArt.Web.UI.CallBack.CallbackEventHandler(this.OnCallback_SelectCurRole);

            GRIDroleowners.NeedRebind += new ComponentArt.Web.UI.Grid.NeedRebindEventHandler(this.OnNeedRebind_GRIDroleowners);


            PANELcond_Editable.Visible = false;
            PANELcond_ReadOnly.Visible = false;
            PANELcond_ViewOtherUserWorkspace.Visible = false;
            PANELcond_PublishWorkspace.Visible       = false;
            PANELcond_ViewActiveReadOnly.Visible     = false;
            PANELcond_ViewHistoricalReadOnly.Visible = false;



            int IDeaset = -1;


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


            // 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_SAP"].ToString() != "")
                {
                    IDeaset = int.Parse(Session["INTcurWS_SAP"].ToString());
                }
            }
            else
            {
                IDeaset = int.Parse(this.Request.Params["WSID"].ToString());
            }

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



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

                Session["INTcurWS_SAP"] = IDeaset;


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


                if (targetEASet.Status.ToLower() == "active")
                {
                    PANELcond_ViewActiveReadOnly.Visible = true;
                }
                else
                {
                    PANELcond_ViewHistoricalReadOnly.Visible = true;
                }
            }
            else
            {
                Session["INTcurWS_SAP"] = 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.GetTcodeAssignmentSet(session.idWorkspace_SAP);
                    if (session.isWorkspaceOwner_SAP)
                    {
                        SAP_HELPERS.InitChangeMgmtForWS(session.idWorkspace_SAP);

                        PANELcond_Editable.Visible = true;
                    }
                    else
                    {
                        PANELcond_ViewOtherUserWorkspace.Visible = true;
                    }
                }
                else
                {
                    // There IS no workspace!
                    PANELcond_ReadOnly.Visible = true;
                    Grid1.Visible = false;
                }
            }
        }
コード例 #9
0
ファイル: ListSAPRoles.aspx.cs プロジェクト: dfsklar/RAF
/*
 * Although most editing occurs in the ashx handler in the guidededitor folder,
 * a few edit activities are still being done via events reported directly from
 * the grid widget.  This handles all such requests.
 */
        private void UpdateDb(ComponentArt.Web.UI.GridItem item, string command)
        {
            ISAProle engine = new ISAProle(HELPERS.NewOdbcConn());


            switch (command)
            {
            case "INSERT":
                int newid;
                try
                {
                    newid =
                        engine.NewSAProle(
                            item["c_u_Name"] as string,
                            this.session.idSubprocess,
                            item["c_u_System"] as string,
                            item["c_u_Platform"] as string
                            );
                }
                catch (Exception e)
                {
                    throw new Exception("Failure occurred.  That rolename + platform combination is already in use, whether in this or some other subprocess.  Refresh your browser to continue working.");
                }
                engine.SetSAProle
                (
                    newid,
                    item["c_u_Name"] as string,
                    item["c_u_Description"] as string,
                    this.session.idSubprocess,
                    item["c_u_System"] as string,
                    item["c_u_Platform"] as string,
                    item["c_u_RoleActivity"] as string,
                    item["c_u_RoleType"] as string, ""
                );

                returnGetSAProle newval = engine.GetSAProle(newid);
                SAP_HELPERS.MaintainMatchingBusinessEntitlementForSAPRole(newval, newval);
                break;


            case "UPDATE":
                if ((item["c_id"] as string) == "")
                {
                    UpdateDb(item, "INSERT");
                    return;
                }
                try
                {
                    int IDsaprole             = int.Parse(item["c_id"] as string);
                    returnGetSAProle prevvals = engine.GetSAProle(IDsaprole);
                    engine.SetSAProle
                        (IDsaprole,
                        item["c_u_Name"] as string,
                        item["c_u_Description"] as string,
                        this.session.idSubprocess,
                        item["c_u_System"] as string,
                        item["c_u_Platform"] as string,
                        item["c_u_RoleActivity"] as string,
                        item["c_u_RoleType"] as string, ""
                        );
                    returnGetSAProle newvals = engine.GetSAProle(IDsaprole);
                    SAP_HELPERS.MaintainMatchingBusinessEntitlementForSAPRole
                        (prevvals, newvals);
                }
                catch (Exception e)
                {
                    if (e.ToString().Contains("duplicate key"))
                    {
                        throw new Exception("That SAP role name + platform combination is already registered, either in this subprocess or another subprocess.  Please refresh the webpage to restore the grid contents and try again.");
                    }
                    else
                    {
                        throw e;
                    }
                }
                break;



            case "DELETE":
                int idToKill = int.Parse(item["c_id"] as string);
                returnGetSAProle prevvals2 = engine.GetSAProle(idToKill);

                // First, try to delete the matching business entitlement, and alert if that fails due to in-use.
                SAP_HELPERS.DeleteMatchingBusinessEntitlementForSAPRole(prevvals2);
                // If the above line fails, the rest of this method won't be executed anyway.

                try
                {
                    engine.DeleteSAProle(idToKill);
                }
                catch (Exception exc323)
                {
                    throw new Exception("This SAP role cannot be deleted because it has TCode assignments associated with it (possibly in other workspaces). NOTE: its matching business entitlement HAS been deleted!  Refresh this webpage to restore the tabular data, and then continue working.");
                }
                break;



            default:
                throw new NotImplementedException();
                break;
            }
        }
コード例 #10
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());
        }
コード例 #11
0
        public void OnItemCheckChanged(object sender, GridItemCheckChangedEventArgs oArgs)
        {
            IEntAssignment ENGINEentass = new IEntAssignment(HELPERS.NewOdbcConn());

            int IDentitlement = int.Parse(oArgs.Item["c_id"].ToString());

            string editstatusEAss = "-";
            int    idEntAss       = -1;

            if (oArgs.Item["TEassEditStatus"] != null)
            {
                if (oArgs.Item["TEassEditStatus"].ToString() != "")
                {
                    editstatusEAss = oArgs.Item["TEassEditStatus"].ToString();
                    idEntAss       = int.Parse(oArgs.Item["TEassRowId"].ToString());
                }
            }


            if (oArgs.Checked)
            {
                if (idEntAss >= 0)
                {
                    returnGetEntAssignment curval = ENGINEentass.GetEntAssignment(idEntAss);
                    ENGINEentass.SetEntAssignment(idEntAss, curval.EntAssignmentSetID, curval.BusRoleID, curval.EntitlementID,
                                                  "A");/*ACTIVE*/
                }
                else
                {
                    // Create a EAss
                    int baby = ENGINEentass.NewEntAssignment(session.idWorkspace, IDrole, IDentitlement, "N");
                    MAPentIdToBabyEAssId.Add(IDentitlement, baby);
                }
            }
            else
            {
                if (idEntAss < 0)
                {
                    if (MAPentIdToBabyEAssId.ContainsKey(IDentitlement))
                    {
                        idEntAss       = MAPentIdToBabyEAssId[IDentitlement];
                        editstatusEAss = "N";
                        MAPentIdToBabyEAssId.Remove(IDentitlement);
                    }
                }
                if (editstatusEAss == "N")
                {
                    try
                    {
                        ENGINEentass.DeleteEntAssignment(idEntAss);
                    }
                    catch (Exception eee)
                    {
                        // Exceptions will occur here naturally, if during a session where row R was
                        // initially unchecked, someone checked it, and then unchecked it back to its
                        // original unchecked state, and then hits submit.
                        ENGINEentass.DeleteEntAssignment(
                            MAPentIdToBabyEAssId[IDentitlement]);
                        MAPentIdToBabyEAssId.Remove(IDentitlement);
                    }
                }
                else
                {
                    returnGetEntAssignment curval = ENGINEentass.GetEntAssignment(idEntAss);
                    ENGINEentass.SetEntAssignment(idEntAss, curval.EntAssignmentSetID, curval.BusRoleID, curval.EntitlementID,
                                                  "X");
                }
            }
        }
コード例 #12
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;
        }
コード例 #13
0
        /* This is called when the user submits the page's changes.
         * It is called once for each checkbox change being submitted.
         * If necessary, a workspace is launched for the relevant subprocess.
         * If the subprocess already contains a workspace but it's owned
         * by some other user, the change is not made and the user
         * is alerted, but the process of executing the set of changes is
         * not aborted.
         *
         * mimic this to create the automatic workspace creation:
         * AutoRemoveEntitlementStatus in GuidedEditor/...
         */

        public void OnAfterCallback(object sender, EventArgs oArgs)
        {
            if (this.boolMustAbort)
            {
                Grid1.CallbackParameter = "OPERATION ABORTED:\n" + messages;
                return;
            }


            Dictionary <int, HELPERS.infoEASet> readyToUseWorkspaces = new Dictionary <int, HELPERS.infoEASet>();
            Dictionary <int, HELPERS.infoEASet> lockedWorkspaces     = new Dictionary <int, HELPERS.infoEASet>();

            if (messages.Length > 0)
            {
                messages += "\n-------------------------\n\n";
            }

            HELPERS.AutoGenWorkspacesInBulk
                (session.idUser, ref messages, MAPsubprToEASet, readyToUseWorkspaces, lockedWorkspaces,
                "facilitate bulk role assignment/unassignment for a particular entitlement");

            // If any problem occurred at all, we abort!
            if (lockedWorkspaces.Count > 0)
            {
                Grid1.CallbackParameter = messages;
                return;
            }


            // We now proceed with the actual edits.
            IEntAssignment ENGINEentass = new IEntAssignment(HELPERS.NewOdbcConn());

            while (QUEUEidsBusrolesToREMOVE.Count > 0)
            {
                int idBusrole = QUEUEidsBusrolesToREMOVE.Dequeue();
                int idSubpr   = MAPbroleToSubproc[idBusrole];
                messages += "Detaching from this role: " + MAPbroleIdToName[idBusrole] + "\n";
                HELPERS.infoEASet wstouse = readyToUseWorkspaces[idSubpr];

                returnListEntAssignmentByEntAssignmentSet[] theEAss =
                    ENGINEentass.ListEntAssignmentByEntAssignmentSet
                        (null, "\"BusRole\" = ? AND \"Entitlement\" = ? ", new string[] { idBusrole.ToString(), IDentitlement.ToString() }, "", wstouse.idEntAssSet);

                ENGINEentass.SetEntAssignment
                    (theEAss[0].ID, theEAss[0].EntAssignmentSetID, theEAss[0].BusRoleID,
                    theEAss[0].EntitlementID, "X");
            }
            while (QUEUEidsBusrolesToADD.Count > 0)
            {
                int idBusrole = QUEUEidsBusrolesToADD.Dequeue();
                int idSubpr   = MAPbroleToSubproc[idBusrole];
                messages += "Attaching to this role: " + MAPbroleIdToName[idBusrole] + "\n";
                HELPERS.infoEASet wstouse = readyToUseWorkspaces[idSubpr];

                returnListEntAssignmentByEntAssignmentSet[] theEAss =
                    ENGINEentass.ListEntAssignmentByEntAssignmentSet
                        (null, "\"BusRole\" = ? AND \"Entitlement\" = ? ", new string[] { idBusrole.ToString(), IDentitlement.ToString() }, "", wstouse.idEntAssSet);

                if (theEAss.GetLength(0) > 1)
                {
                    throw new Exception("Workspace " + wstouse.idEntAssSet + " contains multiple entitlement assignment records for business role " + idBusrole);
                }
                else if (theEAss.GetLength(0) == 1)
                {
                    switch (theEAss[0].Status)
                    {
                    case "A":
                        messages += "Nothing to do. Workspace already has this match in place.\n";
                        break;

                    case "N":
                        messages += "Nothing to do. Workspace already has this match in place.\n";
                        break;

                    case "X":
                        ENGINEentass.SetEntAssignment
                            (theEAss[0].ID, theEAss[0].EntAssignmentSetID, theEAss[0].BusRoleID,
                            theEAss[0].EntitlementID, "N");
                        break;
                    }
                }
                else
                {
                    int baby = ENGINEentass.NewEntAssignment
                                   (wstouse.idEntAssSet, idBusrole, IDentitlement, "N");
                }
            }



            if (messages.Length == 0)
            {
                messages = "NO MESSAGES TO REPORT.";
            }
            Grid1.CallbackParameter = messages;
        }
コード例 #14
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;
                    }
                }
            }
        }
コード例 #15
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;
                }
            }
        }
コード例 #16
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;
            }
        }
コード例 #17
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;
            }
        }
コード例 #18
0
        public void ProcessRequest(HttpContext context)
        {
            OdbcConnection conn = HELPERS.NewOdbcConn();

            int IDwsentrow = int.Parse(context.Request.Params["IDwsent"]);


            context.Response.ContentType = "text/plain";


            IMVFormula   ENGINEmanif = new IMVFormula(conn);
            IEntitlement ENGINEwsent = new IEntitlement(conn);

            OBJwsent =
                ENGINEwsent.GetEntitlement(IDwsentrow);

            string appname = OBJwsent.Application;

            returnListMVFormula[] LISTformulas =
                ENGINEmanif.ListMVFormula(null, "\"KEYapplication\" = ?",
                                          new string[] { appname }, "");

            // Currently, we only allow one formula per manifest.
            // Later we might have richer selection process where other fields
            // get to play a role in which formula is used.
            if (LISTformulas.Length > 1)
            {
                context.Response.Write("Error: more than one manifest formula for this app.");
                return;
            }


            if (LISTformulas.Length < 1)
            {
                context.Response.Write("Error: there is no manifest formula for this app.");
                return;
            }

            returnListMVFormula TheFormula = LISTformulas[0];

            if (TheFormula.Formula == null)
            {
                TheFormula.Formula = "";
            }

            string STRformula = TheFormula.Formula.Trim();

            if (STRformula == "")
            {
                context.Response.Write("Error: the manifest formula for this application has NOT been specified.");
                return;
            }

            // We have the formula; now we can evaluate.
            Evaluator ev = new Evaluator(Eval3.eParserSyntax.cSharp, false);

            ev.AddEnvironmentFunctions(this);
            ev.AddEnvironmentFunctions(new ManifestFormulaEvaluatorFunctions(OBJwsent));

            opCode lCode;

            try
            {
                lCode = ev.Parse(STRformula);
            }
            catch (Exception e)
            {
                context.Response.Write("The formula [[" + STRformula + "]] for this app [[" + appname + "]] has parse errors: " + e.ToString());
                return;
            }

            object RESLT;

            try
            {
                RESLT = lCode.value;
            }
            catch (Exception e)
            {
                context.Response.Write("Interpreting the formula for this app resulted in errors: " + e.ToString());
                return;
            }

            context.Response.Write(RESLT.ToString().Replace(" ", ""));
        }
コード例 #19
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;
                    }
                }
            }
        }
コード例 #20
0
ファイル: AFWACsession.cs プロジェクト: dfsklar/RAF
        /*
         * Assumes the subprocess info is already in place
         */
        public void ObtainWorkspaceContext_SAP()
        {
            System.Data.Odbc.OdbcConnection conn     = HELPERS.NewOdbcConn();
            ITcodeAssignmentSet             engineWS = new ITcodeAssignmentSet(conn);


            // Is there a currently active ed workspace for this subprocess?
            returnListTcodeAssignmentSetBySubProcess[] listWS =
                engineWS.ListTcodeAssignmentSetBySubProcess
                    (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_SAP          = listWS[0].ID;
                idUserWorkspaceOwner_SAP = listWS[0].UserID;
                isWorkspaceOwner_SAP     = (idUser == listWS[0].UserID);
                if (isWorkspaceOwner_SAP)
                {
                    nameUserWorkspaceOwner_SAP = username;
                }
                else
                {
                    IUser         engineUser = new IUser(conn);
                    returnGetUser wsowner    = engineUser.GetUser(idUserWorkspaceOwner_SAP);
                    nameUserWorkspaceOwner_SAP = wsowner.Name;
                }
            }
            else
            {
                idWorkspace_SAP            = -1;
                idUserWorkspaceOwner_SAP   = -1;
                isWorkspaceOwner_SAP       = false;
                nameUserWorkspaceOwner_SAP = "";
            }



            // Is there a currently active TASS (live) for this subprocess?
            returnListTcodeAssignmentSetBySubProcess[] listSAPWS =
                engineWS.ListTcodeAssignmentSetBySubProcess
                    (null, "\"Status\" = ?", new string[] { "ACTIVE" }, "", idSubprocess);

            if (listSAPWS.Length > 1)
            {
                throw new Exception("Internal error: more than one ACTIVE TcodeAssignmentSet for subprocess "
                                    + idSubprocess);
            }

            if (listSAPWS.Length == 1)
            {
                idActiveTASS_SAP = listSAPWS[0].ID;
            }
            else
            {
                idActiveTASS_SAP = -1;
            }
        }
コード例 #21
0
        protected void REACTlaunchUpload(object sender, EventArgs e)
        {
            if (this.FileUpload2.HasFile)
            {
                string pathTempFolder = System.IO.Path.GetTempPath();
                string pathTempFile   = System.IO.Path.GetTempFileName();

                FileUpload2.SaveAs(pathTempFile);
                DataTable dt = HELPERS.LoadCsv(pathTempFolder,
                                               System.IO.Path.GetFileName(pathTempFile));
                if (dt != null)
                {
                    if (dt.Columns.Count >= 1)
                    {
                        System.Data.Odbc.OdbcConnection conn =
                            HELPERS.NewOdbcConn();

                        int subprVisibleToAll =
                            int.Parse(ConfigurationManager.AppSettings["IDsubprocessVisibleToALL"] as string);


                        Queue RETmsgs = null;

                        switch (this.DropDownList1.SelectedValue)
                        {
                        case "AOCLASS":
                            RETmsgs = SAP_HELPERS.ImportListSAPauthobjClasses(
                                conn,
                                dt,
                                this.session.idSubprocess);
                            break;

                        case "AOBJ":
                            RETmsgs = SAP_HELPERS.ImportListSAPauthobjs(
                                conn,
                                dt,
                                this.session.idSubprocess);
                            break;

                        case "AFLD":
                            RETmsgs = SAP_HELPERS.ImportDictSAPauthobjFields(
                                conn,
                                dt,
                                this.session.idSubprocess);
                            break;

                        case "TC":
                            RETmsgs = SAP_HELPERS.ImportTcodeList(conn, dt, this.session.idSubprocess);
                            break;
                        }

                        if (RETmsgs.Count > 0)
                        {
                            string strMsgs = "";
                            foreach (object objMsg in RETmsgs.ToArray())
                            {
                                strMsgs += "\n" + objMsg.ToString();
                            }
                            TXTimportEngineMessages.Text = strMsgs;
                            DIVimportFeeback.Visible     = true;
                            DIVlaunchpad.Visible         = false;
                            //PANELcond_AllowUpload.Visible = false;
                        }
                        else
                        {
                            Response.Redirect("NoMessages.aspx");
                        }

                        return;
                    }
                }
                throw new Exception("INTERNAL ERR");
            }
        }
コード例 #22
0
ファイル: AFWACsession.cs プロジェクト: dfsklar/RAF
        /*
         * 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       = "";
            }
        }