public string GetFileClass(string docId, string userId) { string result = string.Empty; this.DocumentId = docId; userId = string.IsNullOrEmpty(userId) ? kmUserid : userId; WebClient client2 = new WebClient(); client2.Encoding = Encoding.UTF8; string targetAdvSearchUrl = KMService.GetServiceUrl(ServiceType.GetDocumentFileById, docId: docId, userId: userId, tenant: tenant); try { client2.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); result = client2.DownloadString(targetAdvSearchUrl); //ExtendedSearchResult extendedSearchResult = ExtendedSearchResult.FromJson(result); KMFile kmfileSearchResult = KMFile.FromJson(result); foreach (var row in kmfileSearchResult.Data) { row.DocumentId = docId; } kmFiles = kmfileSearchResult.Data; return(result); } catch (Exception ex) { string err = "GetDocumentFileById " + ex.ToString(); return(err); } finally { // } }
public static string ToJson(this KMFile self) => JsonConvert.SerializeObject(self, KMAP.Models.KFConverter.Settings);