Untitled

Anonymous
Plain Text
09/26/2025 11:34 AM
1.2 KB
18
Indexable
Never
using System;
using System.IO;

public class SteuergeräteverwaltungPage
{
    // funcția generală deja existentă
    public static void UploadFile(string filePath)
    {
        // codul tău care face efectiv upload
    }

    // funcția nouă, doar pentru cazul Testhaus
    public static void UploadTesthausFile()
    {
        string folderPath = @"\\Data";
        string sourceFile = Path.Combine(folderPath, "TesthausTestdata.pdf");

        // creează un nume unic cu timestamp
        string uniqueFileName = $"Testhaus_{DateTime.Now:yyyyMMdd_HHmmss}_Testdata.pdf";
        string destFile = Path.Combine(folderPath, uniqueFileName);

        try
        {
            // copiază fișierul de bază sub un nume nou
            File.Copy(sourceFile, destFile);

            // folosește metoda generală pentru upload
            UploadFile(destFile);

            // log în report cu numele fișierului încărcat
            report.Info($"✅ Uploaded file: {Path.GetFileName(destFile)}");

            // șterge copia temporară după upload
            File.Delete(destFile);
        }
        catch (Exception ex)
        {
            report.Fail($"❌ Upload failed: {ex.Message}");
            throw;
        }
    }
}
Editor is loading...
Leave a Comment