예제 #1
0
        private void UpdateUser(ComponentArt.Web.UI.GridItem item, string command)
        {
            switch (command)
            {
            case "UPDATE":
                string description = item["Description"].ToString();
                int    roleId      = Convert.ToInt32(item["RoleId"]);

                Facade.IRole facRole = new Facade.Security();

                facRole.UpdateRole(roleId, description);

                // BindGrid();

                //int extraId = Convert.ToInt32(item["ExtraId"].ToString());

                //Facade.IJobExtra facJobExtra = new Facade.Job();

                //Entities.Extra updatingExtra = facJobExtra.GetExtraForExtraId(extraId);

                //updatingExtra.ExtraState = (eExtraState)Enum.Parse(typeof(eExtraState), item["ExtraState"].ToString());
                //updatingExtra.ExtraAmount = Decimal.Parse(item["ExtraAmount"].ToString(), NumberStyles.Currency);
                //updatingExtra.ClientContact = item["ClientContact"].ToString();

                //facJobExtra.UpdateExtra(updatingExtra, ((Entities.CustomPrincipal)Page.User).UserName);
                break;
            }
        }
예제 #2
0
        private void UpdateExtras(ComponentArt.Web.UI.GridItem item, string command)
        {
            switch (command)
            {
            case "UPDATE":
                int extraId = Convert.ToInt32(item["ExtraId"].ToString());

                Facade.IJobExtra facJobExtra = new Facade.Job();

                Entities.Extra updatingExtra = facJobExtra.GetExtraForExtraId(extraId);

                updatingExtra.ExtraState = (eExtraState)Enum.Parse(typeof(eExtraState), item["ExtraState"].ToString());

                Facade.IExchangeRates facER = new Facade.ExchangeRates();
                if (updatingExtra.ExchangeRateID != null)
                {
                    updatingExtra.ExtraAmount = facER.GetConvertedRate((int)updatingExtra.ExchangeRateID,
                                                                       Decimal.Parse(item["ForeignAmount"].ToString(), NumberStyles.Currency));
                }
                else
                {
                    updatingExtra.ExtraAmount = Decimal.Parse(item["ForeignAmount"].ToString(), NumberStyles.Currency);
                }

                updatingExtra.ForeignAmount = Decimal.Parse(item["ForeignAmount"].ToString(), NumberStyles.Currency);

                updatingExtra.ClientContact = item["ClientContact"].ToString();

                facJobExtra.UpdateExtra(updatingExtra, ((Entities.CustomPrincipal)Page.User).UserName);
                break;
            }
        }
예제 #3
0
        private void UpdateDb(ComponentArt.Web.UI.GridItem item, string command)
        {
            IMVFormula   engine    = new IMVFormula(HELPERS.NewOdbcConn());
            IApplication engineApp = new IApplication(HELPERS.NewOdbcConn());

            switch (command)
            {
            case "INSERT":
                throw new Exception("Internal error PGMF#85; contact Sklar");
                break;


            case "UPDATE":

                //ADDED 3 JULY 2009: support for changing application name:
                string origname = item["origname"] as string;
                string newname  = item["c_u_Name"] as string;
                string newL4    = item["c_u_BOOLneedsLevel4"] as string;
                newname = newname.Trim();

                if (origname != newname)
                {
                    HELPERS.RenameApplication(HELPERS.NewOdbcConn(), origname, newname);
                }

                engineApp.SetApplication
                    (int.Parse(item["c_id"] as string), newname, newL4);

                if ((item["MVFID"] as string) == "")
                {
                    int newID = engine.NewMVFormula(item["c_u_Name"] as string);
                    engine.SetMVFormula(
                        newID,
                        item["c_u_Name"] as string,
                        null, null, null,
                        item["c_u_Formula"] as string);
                }
                else
                {
                    engine.SetMVFormula(
                        int.Parse(item["MVFID"] as string),

                        item["c_u_Name"] as string,
                        null, null, null,
                        item["c_u_Formula"] as string);
                }
                break;


            case "DELETE":
                throw new NotImplementedException();
                break;
            }
        }
예제 #4
0
/*
 * 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;
            }
        }
예제 #5
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;
            }
        }
예제 #6
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;
            }
        }