Ejemplo n.º 1
0
        private void btnUpload_Click(object sender, EventArgs e)
        {
            netsuiteFolderSave netsuiteFolder = new netsuiteFolderSave();

            netsuiteFolder.name = "NetsuiteEnvironmentViewer Temp Folder - " + DateTime.Now.ToString();

            netsuiteFileSave netsuiteFile = new netsuiteFileSave();

            netsuiteFile.name     = safeFileName;
            netsuiteFile.fileType = "CSV";
            netsuiteFile.content  = contentBase64;

            if (netsuiteFile.name != "" && txtCSVImportId.Text != "")
            {
                netsuiteFolder savedNetsuiteFolder = new netsuiteFolder();
                netsuiteFile   savedNetsuiteFile   = new netsuiteFile();

                savedNetsuiteFolder   = netsuiteClient.saveFolder(netsuiteFolder);
                netsuiteFile.folderId = savedNetsuiteFolder.internalId;

                savedNetsuiteFile = netsuiteClient.saveFile(netsuiteFile);

                netsuiteCSVImportJob netsuiteCSVImportJob = new netsuiteCSVImportJob();
                netsuiteCSVImportJob.internalId  = savedNetsuiteFile.internalId;
                netsuiteCSVImportJob.csvImportId = txtCSVImportId.Text;
                netsuiteCSVImportJob.queue       = txtQueue.Text;

                netsuiteClient.importCSVFile(netsuiteCSVImportJob);
                netsuiteClient.deleteFile(savedNetsuiteFile);
                netsuiteClient.deleteFolder(savedNetsuiteFolder);

                MessageBox.Show("Upload Complete!");
            }
            else
            {
                MessageBox.Show("Please choose a file and specify a CSV Import ID before uploading.");
            }
        }
        public string importCSVFile(netsuiteCSVImportJob netsuiteCSVImportJob)
        {
            string payload = JsonConvert.SerializeObject(netsuiteCSVImportJob);

            return(restPOSTCall(querySchemaUrl, payload, netsuiteAuthorization));
        }