private void rptModules_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e) { string[] commandArguments = e.CommandArgument.ToString().Split(':'); string moduleName = commandArguments[0]; string assemblyName = commandArguments[1]; Assembly assembly = null; if (assemblyName.Length > 0) { assembly = Assembly.Load(assemblyName); } string moduleInstallDirectory = Path.Combine(Server.MapPath("~/Modules/" + moduleName), "Install"); DatabaseInstaller dbInstaller = new DatabaseInstaller(moduleInstallDirectory, assembly); try { switch (e.CommandName.ToLower()) { case "install": dbInstaller.Install(); break; case "upgrade": dbInstaller.Upgrade(); break; case "uninstall": dbInstaller.Uninstall(); break; } // Rebind modules BindModules(); ShowMessage(e.CommandName + ": operation succeeded for " + moduleName + "."); } catch (Exception ex) { ShowError(e.CommandName + ": operation failed for " + moduleName + ".<br/>" + ex.Message); } }
protected void rptModules_ItemCommand(object source, RepeaterCommandEventArgs e) { string[] commandArguments = e.CommandArgument.ToString().Split(':'); string moduleName = commandArguments[0]; string assemblyName = commandArguments[1]; Assembly assembly = null; if (assemblyName.Length > 0) { assembly = Assembly.Load(assemblyName); } string moduleInstallDirectory = Path.Combine(Server.MapPath("~/Modules/" + moduleName), "Install"); DatabaseInstaller dbInstaller = new DatabaseInstaller(moduleInstallDirectory, assembly); try { switch (e.CommandName.ToLower()) { case "install": dbInstaller.Install(); break; case "upgrade": dbInstaller.Upgrade(); break; case "uninstall": dbInstaller.Uninstall(); break; case "delete": string moduleFolder = Server.MapPath("~/Modules/" + moduleName); string dllFile = string.Format("{0}Cuyahoga.Modules.{1}.dll", Server.MapPath("~/bin/"), moduleName); // Maybe add to a service and use a transaction if (Directory.Exists(moduleFolder)) _fileService.DeleteDirectory(moduleFolder); if (File.Exists(dllFile)) _fileService.DeleteFile(dllFile); break; } // Rebind modules BindModules(); ShowMessage(e.CommandName + ": operation succeeded for " + moduleName + "."); } catch (Exception ex) { ShowError(e.CommandName + ": operation failed for " + moduleName + ".<br/>" + ex.Message); } }