protected void AcceptRenameApp_Click(object sender, EventArgs e) { Util util = new Util(); Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID]; if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return; try { ClearMessages(); if (SavedCanvasHtml.Text.Length > 0) SavePage(); AppName.Text = Request.Form.Get("AppName"); string app = AppName.Text.Trim(); if (!CheckAppName(app)) return; util.RenameApplication(State, CurrentApp.SelectedValue, app); CurrentApp.Items[CurrentApp.SelectedIndex].Value = app; CurrentApp.Items[CurrentApp.SelectedIndex].Text = app; State["SelectedApp"] = app; SetAllAppNames(); XmlUtil x_util = new XmlUtil(); x_util.RenameApp(State); UpdateAppLists(); AppName.Text = ""; } catch (Exception ex) { util.LogError(State, ex); Message.Text = "Internal Error: " + ex.Message + ": " + ex.StackTrace; } }
public void RenameApplication(Hashtable State, string prev_app_name, string new_app_name) { DB db = new DB(); StringBuilder b_sql = new StringBuilder("UPDATE applications SET "); b_sql.Append("application_name='" + new_app_name + "' "); b_sql.Append("WHERE customer_id='" + State["CustomerID"] + "' AND "); b_sql.Append("application_name='" + prev_app_name + "'"); db.ViziAppsExecuteNonQuery(State, b_sql.ToString()); //change the name in the XML XmlUtil x_util = new XmlUtil(); x_util.RenameApp(State, new_app_name); db.CloseViziAppsDatabase(State); }