Beispiel #1
0
        static void Main(string[] args)
        {
            var csvReader = new CsvReader();

            var path = @"TestFiles/TestJD.csv";

            var content = File.ReadAllText(path);
            var line    = csvReader.Read(content);

            var actions = line.Where(p => p.Data != null).Select(p => new ActionItem(p)).ToList();
            var site    = JDGroupite();
            var routeBuilderTransformer = new RoutesTransformer(site, actions);
            var upload = routeBuilderTransformer.CreateModel();
            var api    = CreateLogin(site);

            try
            {
                var element = new UploadElement(site.Id, upload);
                api.ExecuteRequest(new Upload(api.Context, upload));
            }
            catch
            {
                throw;
            }
        }
Beispiel #2
0
    }//---end submit()




    /// <summary>
    /// upload a single token( file) from an attachment-list( check-list).
    /// </summary>
    /// <param name="theFileToBeUploaded"></param>
    protected void allegaSingoloFile()
    {
        UploadElement uploadElement = new UploadElement();// TODO store
        // Get the filename_only from client_fullpath.
        string fileName_only = System.IO.Path.GetFileName(this.uploadFile.PostedFile.FileName);
        uploadElement.client_path = this.uploadFile.PostedFile.FileName;
        //
        ConfigurationLayer.ConfigurationService cs = new
            ConfigurationLayer.ConfigurationService("FileTransferTempPath/fullpath");
        string serverPath = cs.GetStringValue("path");
        //-Gestione dismessa perchè scrive in directory di sistema-- NB. it's different for every user, included ASPNETusr ---------
        //-Gestione dismessa perchè scrive in directory di sistema-string serverPath = Environment.GetEnvironmentVariable("tmp", EnvironmentVariableTarget.User);
        //-Gestione dismessa perchè va corretta a mano per ogni macchina string serverPath = @"C:\root\LogSinkFs\cv";// TODO adapt to the server file sysetm.
        // add ending part.
        serverPath += "\\upload";
        //
        // Ensure the folder exists
        if (!System.IO.Directory.Exists(serverPath))
        {
            System.IO.Directory.CreateDirectory(serverPath);
        }// else already present on the web server file system.
        // Save the file to the folder, on the web-server.
        string fullPath_onWebServer = System.IO.Path.Combine(serverPath, fileName_only);
        uploadElement.web_server_path = fullPath_onWebServer;// TODO dbg.
        if (null == this.Session["arlUploadPaths"])
        {
            throw new System.Exception("TODO call btnAllega() first!");
        }// else ok.
        ((System.Collections.ArrayList)(this.Session["arlUploadPaths"])).Add(uploadElement);
        // ready
        this.uploadFile.PostedFile.SaveAs(fullPath_onWebServer);//--NB.---crucial system call: from client do web-srv.
    }// end uploadButton_Click()