public void OpenConnection(ConnectParameters source, ConnectParameters target)
 {
     this.connection = source;
     this.target = target;
     fileStorageService.SetConnectionString(connection.ConnectionString);
     ls = new LASLoader(fileStorageService);
     Console.WriteLine("Open LAS connection");
 }
示例#2
0
        public async Task <ActionResult <string> > SaveData(FileParameters fileParams)
        {
            if (fileParams == null)
            {
                return(BadRequest());
            }
            try
            {
                ConnectParameters   connector  = Common.GetConnectParameters(connectionString, container, fileParams.DataConnector);
                CloudStorageAccount account    = CloudStorageAccount.Parse(connectionString);
                CloudFileClient     fileClient = account.CreateCloudFileClient();
                CloudFileShare      share      = fileClient.GetShareReference(fileParams.FileShare);
                if (share.Exists())
                {
                    CloudFileDirectory rootDir = share.GetRootDirectoryReference();
                    CloudFile          file    = rootDir.GetFileReference(fileParams.FileName);
                    if (file.Exists())
                    {
                        string    fileText = file.DownloadTextAsync().Result;
                        LASLoader ls       = new LASLoader(_env);
                        ls.LoadLASFile(connector, fileText);
                        //DbUtilities dbConn = new DbUtilities();
                        //dbConn.OpenConnection(connector);
                        //dbConn.SQLExecute(sql);
                        //dbConn.CloseConnection();
                    }
                    else
                    {
                        return(BadRequest());
                    }
                }
                else
                {
                    return(BadRequest());
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.ToString()));
            }

            return(Ok($"OK"));
        }