public void updatePlugin_Click(Object sender, EventArgs e) { //String pluginName = Request["pluginNameBox"]; String pluginDescription = Request["pluginDescriptionBox"]; String pluginHelpText = Request["helpTextBox"]; String pluginVersion = Request["versionBox"]; try { // Are they the owner? if (_currentPlugin.OwnerID != _currentUser.UserID) { Response.Redirect(string.Format(@"Index.aspx?error={0}", HttpUtility.UrlEncode(@"You cannot edit plugins you do not own."))); } //if (string.IsNullOrWhiteSpace(pluginName) || pluginName.Length >= PluginDAO.NameMaxLength) //{ // ShowError("Plugin name cannot be empty or all spaces, and must be less than 64 characters."); // return; //} if (string.IsNullOrWhiteSpace(pluginDescription) || pluginDescription.Length >= PluginDAO.DescriptionMaxLength) { ShowError("Plugin description cannot be empty or all spaces."); } else if (string.IsNullOrWhiteSpace(pluginHelpText) || pluginHelpText.Length >= PluginDAO.HelpTextMaxLength) { ShowError("Plugin help text cannot be empty or all spaces, and must be less than 160 characters."); } else if (string.IsNullOrWhiteSpace(pluginVersion) || pluginVersion.Length >= PluginDAO.VersionNumberMaxLength) { ShowError("Plugin version number cannot be empty or all spaces, and must be less than 32 characters."); } else { // Everything checks out--set the current plugin information //_currentPlugin.Name = pluginName; _currentPlugin.Description = pluginDescription; _currentPlugin.HelpText = pluginHelpText; _currentPlugin.VersionNum = pluginVersion; IDBController controller = new SqlController(); //controller.UpdatePluginOwner(_currentPlugin, _currentUser); controller.UpdatePlugin(_currentPlugin); } } catch (CouldNotFindException) { // Shouldn't happen } catch (ArgumentNullException) { // Shouldn't happen } catch (SqlException ex) { Logger.LogMessage("ManagePlugin: " + ex.Message, LoggerLevel.SEVERE); ShowError("An unknown error occurred loading plugin data. Please try again soon."); } PopulatePage(); }