Ejemplo n.º 1
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;
            }
        }