Пример #1
0
 public Document UploadDocument(string token, string name, long size, string description)
 {
     _conn = new Connection(_connectionString);
     _conn.OpenConnection();
     string username = _conn.GetUsernameByToken(token);
     try
     {
         if (!string.IsNullOrEmpty(username))
         {
             Document doc = new Document()
             {
                 Name = name,
                 Size = size,
                 Author = username,
                 Path = _ftpUri + name,
                 Description = description
             };
             return _conn.UploadDocument(doc) ? doc : null;
         }
         else
         {
             return null;
         }
     }
     finally
     {
         _conn.CloseConnection();
     }
 }