public OperationDetails SendEmail(SendMailView sendMailView) { var operationDetails = new OperationDetails(); var token = GetAuthorizationTokenAsync(apiCredentials); if (token != null) { if (!string.IsNullOrEmpty(token.token_type) && !string.IsNullOrEmpty(token.token_type)) { string AuthorizedToken = token.token_type + " " + token.access_token; try { using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(_PowerPackAPiBaseUri); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));//ACCEPT header client.DefaultRequestHeaders.Add("Accept-Encoding", "gzip, deflate"); client.DefaultRequestHeaders.Add("Authorization", AuthorizedToken); HttpResponseMessage userResp = client.PostAsJsonAsync(SendEmailApi, sendMailView).Result; operationDetails.Success = userResp.IsSuccessStatusCode; } } catch (Exception ex) { _loggerClient = LoggerClient.Instance; _loggerClient.LogException(ex); } } } return(operationDetails); }
private void AdminViewGenerator() { //Ładowanie do bazy zrzutu z IDB; _ = new IDBView(_adminTab); //Wysyłanie Maili z Admina; SendMailView SendMail = new SendMailView { Location = new Point(1135, 85) }; _adminTab.Controls.Add(SendMail); //Automatyczne przliczaie STK w akcjach Z tenego roku AutoUpdateSTKView AutoSTK = new AutoUpdateSTKView { Location = new Point(425, 680) }; _adminTab.Controls.Add(AutoSTK); //Dodawania konta lub zmiany jego praw AddPersonView AccessView = new AddPersonView { Location = new Point(425, 15) }; _adminTab.Controls.Add(AccessView); //Sumowanie ilości miesięcznych PNC do odpowiednich grup SumPNC Sum = new SumPNC { Location = new Point(15, 525), }; _adminTab.Controls.Add(Sum); //Sprawdzania i dodawanie Targetów dla poszczególnych działów i łacznie dla całego PC TargetView Target = new TargetView { Location = new Point(830, 175), }; _adminTab.Controls.Add(Target); }