Exemplo n.º 1
0
    public static void delete_database(int databaseid)
    {
        MyProjectDataContext dbcontext = new MyProjectDataContext();
        DatabaseManagement   dbManage  = new DatabaseManagement();
        string websitename             = dbManage.GetWebsiteNameByDbId(databaseid);

        if (dbManage.DeleteDatabaseById(databaseid))
        {
            System.Web.UI.Page ob      = new System.Web.UI.Page();
            string             db_path = "~/web-design/" + ob.Session[Constants.Session.USERNAME].ToString() + "/" + websitename + "/" + "App_Data/";
            bool exists = System.IO.Directory.Exists(ob.Server.MapPath(db_path));

            if (exists)
            {
                //System.IO.Directory.CreateDirectory(Server.MapPath(db_path));
                System.IO.Directory.Delete(ob.Server.MapPath(db_path), true);
            }
        }
        else
        {
        }
        // var q=
    }