Skip to content

Commit

Permalink
Changes of database connection
Browse files Browse the repository at this point in the history
  • Loading branch information
jbalde committed Mar 6, 2012
1 parent 820e4a5 commit fbdfa19
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 6 deletions.
50 changes: 46 additions & 4 deletions AltairStudios.Core/Mvc/Controllers/AdminController.cs
Expand Up @@ -12,7 +12,7 @@
namespace AltairStudios.Core.Mvc.Controllers {
public class AdminController : Controller {
[Authorize()]
public string Index() {
public ActionResult Index() {
StringBuilder html = new StringBuilder();
string path = MvcApplication.Path;

Expand Down Expand Up @@ -43,11 +43,15 @@ public class AdminController : Controller {
html.Append("</body>");
html.Append("</html>");

return html.ToString();
return Content(html.ToString());
}


public string Login() {
public ActionResult Login() {
/*if(MvcApplication.ConnectionString == "") {
return RedirectToAction("Install");
}*/

StringBuilder html = new StringBuilder();
string path = MvcApplication.Path;

Expand Down Expand Up @@ -80,7 +84,7 @@ public class AdminController : Controller {
html.Append("</body>");
html.Append("</html>");

return html.ToString();
return Content(html.ToString());
}


Expand All @@ -103,5 +107,43 @@ public class AdminController : Controller {
FormsAuthentication.SignOut();
return RedirectToAction("Login");
}



public ActionResult Install() {
StringBuilder html = new StringBuilder();
string path = MvcApplication.Path;

html.Append("<!DOCTYPE html>\n");
html.Append("<html lang='es'>");
html.Append("<head>");
html.Append("<meta charset='utf-8' />");
html.Append("<title>AltairStudios.Core - Admin</title>");
html.Append("<link rel='stylesheet' type='text/css' href='" + path + "/Bin/resources/css/Ext.css' />");
html.Append("<link rel='stylesheet' type='text/css' href='" + path + "/Bin/resources/css/Desktop.css' />");
html.Append("<script src='" + path + "/Bin/resources/javascript/Ext.js'></script>");

html.Append("<script type='text/javascript'>");
html.Append("Ext.Loader.setConfig({enabled:true});");

html.Append("Ext.Loader.setPath({");
html.Append("'AdminDesktop.Login': '" + path + "/Bin/resources/javascript/Login'");
html.Append("});");

html.Append("Ext.require('AdminDesktop.Login.App');");
html.Append("var adminDesktopLogin = null;");
html.Append("Ext.onReady(function () {");
html.Append("adminDesktopLogin = new AdminDesktop.Login.App();");
html.Append("adminDesktopLogin.show();");
html.Append("});");

html.Append("</script>");
html.Append("</head>");
html.Append("<body>");
html.Append("</body>");
html.Append("</html>");

return Content(html.ToString());
}
}
}
4 changes: 4 additions & 0 deletions AltairStudios.Core/Mvc/MvcApplication.cs
Expand Up @@ -51,6 +51,10 @@ public class MvcApplication : System.Web.HttpApplication {
if(System.Web.HttpContext.Current.Request.ApplicationPath != "/") {
MvcApplication.path = System.Web.HttpContext.Current.Request.ApplicationPath;
}

if(ConfigurationManager.ConnectionStrings["SqlServerConnection"] != null) {
MvcApplication.connectionString = ConfigurationManager.ConnectionStrings["SqlServerConnection"].ConnectionString;
}
}
}
}
Binary file modified AltairStudios.Core/bin/AltairStudios.Core.dll
Binary file not shown.
Binary file modified Tests/Bin/AltairStudios.Core.dll
Binary file not shown.
Binary file modified Tests/Bin/Tests.dll
Binary file not shown.
3 changes: 1 addition & 2 deletions Tests/Web.config
Expand Up @@ -88,7 +88,6 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
</system.codedom>
<system.web.extensions />
<connectionStrings>
<remove name="MySqlServerConnection"/>
<add name="MySqlServerConnection" connectionString="Datasource=server;Database=database;uid=user;pwd=password;Pooling=true;Min Pool Size=0;Max Pool Size=100;" providerName="MySql.Data.MySqlClient"/>
<add name="SqlServerConnection" connectionString="Datasource=[server];Database=[database];uid=[user];pwd=[password];Pooling=true;Min Pool Size=0;Max Pool Size=100;" providerName="MySql.Data.MySqlClient"/>
</connectionStrings>
</configuration>

0 comments on commit fbdfa19

Please sign in to comment.