Esempio n. 1
0
 private void RemoveSystemDB(App app, SqlServerManager sysManager)
 {
     if (sysManager == null)
     {
         logger.Log("ProductMaintenance", null, "RemoveApp", null, 2, string.Format("Could not drop system db from app {0}, the database server was not found the app type is {1}", app.Name, app.AppType.ToString()));
     }
     else
     {
         sysManager.DropDB(app.SystemServer, app.SystemCatalog);
     }
 }
Esempio n. 2
0
 private static void RemoveAppDb(App app, SqlServerManager manager)
 {
     if (manager == null)
     {
         logger.Log("ProductMaintenance", null, "RemoveApp", null, 2, string.Format("Could not drop main db from app {0}, the database server was not found, the app type is {1}", app.Name, app.AppType.ToString()));
     }
     else
     {
         manager.DropDB(app.Server, app.Catalog);
     }
 }
Esempio n. 3
0
        //private static void RemoveWixViews(Map map, SqlServerManager sysManager)
        //{
        //    if (map != null)
        //    {
        //        foreach (View view in map.Database.Views.Values)
        //            if (!view.SystemView)
        //                sysManager.DropTable(view);
        //    }
        //}
        private static void RemoveWixViews(App app, SqlServerManager manager)
        {
            SqlSchema        schema           = new SqlSchema();
            string           connectionString = Connections.GetConnectionString(app.Server, app.Catalog);
            HashSet <string> referencedTables = GetReferencedTables(app.TableName, connectionString);

            manager.DropTable(app.TableName, connectionString);
            foreach (string relatedTable in referencedTables)
            {
                manager.DropTable(relatedTable, connectionString);
            }
        }
Esempio n. 4
0
        private bool RemoveApp(App app)
        {
            //if (connections == null)
            //{
            //   connections= new Connections();
            //   connections.Init();
            //}
            bool success = false;
            //Map map = null;
            string configFileName = string.Empty;
            //try
            //{
            //    map = Maps.Instance.GetMap(app.Name);
            //    configFileName = map.ConfigFileName;
            //}
            //catch
            //{
            string configFileprefix = !string.IsNullOrEmpty(Durados.Windows.Utilities.AzureUploader.Properties.Settings.Default.DuradosAppSysPrefix)? Durados.Windows.Utilities.AzureUploader.Properties.Settings.Default.DuradosAppSysPrefix :"durados_AppSys_";

            configFileName = configFileprefix + app.AppId + ".xml";
            //}
            SqlServerManager manager    = Connections.GetSqlServerManager(app.Server);
            SqlServerManager sysManager = Connections.GetSqlServerManager(app.SystemServer);

            switch (app.AppType)
            {
            case 0:

                break;

            case 2:     //free

            case 3:     //northwind
                RemoveAppDb(app, manager);
                goto case 1;

            case 1:    // console
                RemoveSystemDB(app, sysManager);
                DeleteConfigurationFromCloud(configFileName);
                break;

            case 4:    //wix
                RemoveWixViews(app, manager);
                DeleteLocalConfiguration(configFileName);
                break;

            case 5:
                break;

            default:
                break;
            }


            logger.Log("ProductMaintenance", "RemoveApp", "RemoveApp", null, 3, "configuration files " + configFileName + " was remove from storage");
            UpdateDeletedApp(app.AppId);
            success = true;
            logger.Log("ProductMaintenance", "RemoveApp", "RemoveApp", null, 3, "App name: " + app.Name + " Number: " + app.AppId + " was completly removed");
            return(success);

            // Maps.Instance.RemoveMap(app.Name);
        }