Announcements
public async Task<string> LoginAsTaxPayer(string _dataAreaId){ MYParameter mYParameter = new MYParameter(); mYParameter = MYParameter.findByComp(_dataAreaId,true); if (mYParameter.Found) { using (var client = new HttpClient()) { client.BaseAddress = new Uri(https:/// + mYParameter.BaseURL + //connect/token/); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(/application/x-www-form-urlencoded/)); var form = new Dictionary<string, string> { {/client_id/, mYParameter.ClientID}, {/client_secret/, mYParameter.ClientSecret}, {/grant_type/, /client_credentials/}, {/scope/,// } }; var response = await client.PostAsync(client.BaseAddress, new FormUrlEncodedContent(form)); if (response.IsSuccessStatusCode) { string respBody=response.Content.ReadAsStringAsync().Result; Token mytoken = JsonConvert.DeserializeObject<Token>(respBody); mYParameter.AccessToken = mytoken.AccessToken; mYParameter.Update(); return response.StatusCode.ToString(); } else { string respBody = response.Content.ReadAsStringAsync().Result; ErrResponse errResp = JsonConvert.DeserializeObject<ErrResponse>(respBody); return errResp.Error_Descr; } } } else { return /No Parameter found/; } }
public string LoginAsTaxPayerSync(string _dataAreaId) { MYParameter myParameter = new MYParameter(); myParameter = MYParameter.findByComp(_dataAreaId); myParameter.ForUpdate(true) if (ads_EInvcParameter.Found) { using (var client = new HttpClient()) { var request = new HttpRequestMessage(HttpMethod.Post, "https://" + myParameter.BaseURL + "/connect/token"); var form = new Dictionary<string, string> { {"client_id", myParameter.ClientID}, {"client_secret", myParameter.ClientSecret}, {"grant_type", "client_credentials"}, {"scope","InvoicingAPI" } }; var content = new FormUrlEncodedContent(form); request.Content = content; var response = client.SendAsync(request).Result; response.EnsureSuccessStatusCode(); if (response.IsSuccessStatusCode) { string respBody = response.Content.ReadAsStringAsync().Result; Token mytoken = JsonConvert.DeserializeObject<Token>(respBody); myParameter.AccessToken = mytoken.AccessToken; myParameter.AccessTokenExpiration = mytoken.ExpiresIn; myParameter.TokenExpirationDt = DateTime.UtcNow.AddSeconds(mytoken.ExpiresIn); myParameter.Update(); return response.StatusCode.ToString(); } else { string respBody = response.Content.ReadAsStringAsync().Result; ErrResponse errResp = JsonConvert.DeserializeObject<ErrResponse>(respBody); return errResp.Error_Descr; } } } else { return ("No Parameter found"); } }
YourClass yourClass; YourTable yourTable; ; .. ttsBegin; yourTable.field = yourClass.field; yourTable.Update(); ttsCommit;
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
André Arnaud de Cal... 396 Super User 2026 Season 1
Subra 323
Martin Dráb 243 Most Valuable Professional