public void handleConnectRequest(HttpListenerContext context)
 {
     try
     {
         ConnectionDto       connParams          = readResponseAsJson <ConnectionDto>(context.Request);
         MsSqlRequestService msSqlRequestService = new MsSqlRequestService(connParams.server, connParams.database);
         sendAnswerWithCode(context.Response, 200);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         sendStaticResourceWithCode(context.Response, JObject.FromObject(new { errorMessage = ex.Message }).ToString(), "application/json", 406);
         return;
     }
 }
 public void handleDatabaseListRequest(HttpListenerContext context)
 {
     try
     {
         ConnectionDto       connParams          = readResponseAsJson <ConnectionDto>(context.Request);
         MsSqlRequestService msSqlRequestService = new MsSqlRequestService(connParams.server, "master");
         List <string>       databaseList        = msSqlRequestService.requestDatabaseList(string.Format(Resources.connectionStringTemplate, connParams.server, "master"));
         sendStaticResource(context.Response, JArray.FromObject(databaseList).ToString(), "application/javascript");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         sendStaticResourceWithCode(context.Response, JObject.FromObject(new { errorMessage = ex.Message }).ToString(), "application/json", 406);
     }
 }
 public void handleServerObjectList(HttpListenerContext context)
 {
     try
     {
         ConnectionDto       connParams          = readResponseAsJson <ConnectionDto>(context.Request);
         MsSqlRequestService msSqlRequestService = new MsSqlRequestService(connParams.server.ToString(), connParams.database.ToString());
         string result = JArray.FromObject(msSqlRequestService.requestAllServerObjectList()).ToString();
         sendStaticResource(context.Response, result, "application/javascript");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         sendStaticResourceWithCode(context.Response, JObject.FromObject(new { errorMessage = ex.Message }).ToString(), "application/json", 406);
         return;
     }
 }
 public void handleGetObjTextRequest(HttpListenerContext context)
 {
     try
     {
         ConnectionDto       connParams          = readResponseAsJson <ConnectionDto>(context.Request);
         MsSqlRequestService msSqlRequestService = new MsSqlRequestService(connParams.server, connParams.database);
         string result     = "";
         string objectName = context.Request.QueryString[Resources.objectNameParam];
         string schemaName = context.Request.QueryString[Resources.schemaNameParam];
         if (objectName != null)
         {
             result = msSqlRequestService.requestDatabaseObjectInfo(objectName, schemaName);
         }
         sendStaticResource(context.Response, result, "text/html");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         sendStaticResourceWithCode(context.Response, JObject.FromObject(new { errorMessage = ex.Message }).ToString(), "application/json", 406);
         return;
     }
 }