private void SendEmailToCEO(string xlsxFile) { string test = Properties.Settings.Default.CEOTo; SendEmailClass sendEmail = new SendEmailClass(); sendEmail.Subject = $"Gehaltsübersicht ({monthlySalaryDate:MMMM yyyy})"; //sendEmail.ToAddress = Properties.Settings.Default.CEOTo; sendEmail.ToAddress = "*****@*****.**"; sendEmail.Attachments.Add(xlsxFile); sendEmail.Body = $"Hallo Johann, {Environment.NewLine}{Environment.NewLine} anbei die Auswertung wie besprochen." + $"{System.Environment.NewLine} {System.Environment.NewLine} Mit freundlichen Grüßen {System.Environment.NewLine} {System.Environment.NewLine} QuantCo Deutschland GmbH"; bool success = sendEmail.SendEmailToServer(); if (!success) { NotificationRequest.Raise(new Notification() { Title = "QuantCo Deutschland GmbH", Content = $"Das Email an {sendEmail.ToAddress} konnte nicht gesendet werden" }); } }
/// <summary> /// Send E-Mails to Colleagues regarding open vacation days /// </summary> private void OnVacationLiability() { DateTime reportDate = timeFunctions.MonthEnd(timeFunctions.MonthEnd(MonthlySalaryDate)); CreateEmployeeSalaryOverview salaryOverview = new CreateEmployeeSalaryOverview(null, new DateTime(reportDate.Year, 1, 1), reportDate); List <EmployeesMonthlyPayments> monthlyPayments = salaryOverview.GetMonthlyPayments(reportDate.Month); foreach (EmployeesMonthlyPayments payment in monthlyPayments) { EmployeesForTravelExpenses employee = dbAccess.FindEmployeeById(payment.EmployeeForTravelExpensesId); if (employee == null) { continue; } EmployeePaymentDetail salarydetail = dbAccess.GetLatestSalary(payment.EmployeeForTravelExpensesId); // do not send emails to people whos contract expire if (salarydetail.LastPayment != null && salarydetail.LastPayment == reportDate) { continue; } // Send Email SendEmailClass sendEmail = new SendEmailClass(); sendEmail.Subject = "Urlaub / Vacation "; sendEmail.ToAddress = employee.EmailAddress; StringBuilder germanText = new StringBuilder(); germanText.Append($"Liebe(r) {employee.FirstName},{Environment.NewLine}{Environment.NewLine}"); germanText.Append("Wie einmal im Jahr üblich, bitte ich dich mir mitzuteilen, wieviele Urlaubstage zum Jahresende noch offen sein werden. Falls du deinen kompletten Urlaub genommen hast, kannst du diese E-Mail ignorieren." + Environment.NewLine + Environment.NewLine); germanText.Append($"Solltest du im Laufe des Jahres {reportDate.Year} bei QuantCo angefangen haben, errechnen sich die Urlaubstage nach der Formel 28 / 12 * Anzahl Monate bei QuantCo (Ergebnis bitte aufrunden)."); germanText.Append(Environment.NewLine + Environment.NewLine + "Vielen Dank für deine Unterstützung." + Environment.NewLine + Environment.NewLine); StringBuilder englishText = new StringBuilder(); englishText.Append($"Dear {employee.FirstName},{Environment.NewLine}{Environment.NewLine}"); englishText.Append("As usual once a year, I would like to ask you to tell me how many vacation days are left for this calendar year. Should you have taken all your vacation you can ignore this email." + Environment.NewLine + Environment.NewLine); englishText.Append($"In case you have joined QuantCo in {reportDate.Year} you can calculate the number of vacation days using the formula: 28 / 12 * number of months with QuantCo (result can be rounded up)."); englishText.Append(Environment.NewLine + Environment.NewLine + "Thank you for your support." + Environment.NewLine + Environment.NewLine); sendEmail.Body = $"{germanText.ToString()}{englishText.ToString()}" + $"{System.Environment.NewLine} {System.Environment.NewLine} Mit freundlichen Grüßen / Best regards {System.Environment.NewLine} {System.Environment.NewLine} Franz"; bool success = true; if (employee.FirstName.Contains("Sabrina") || employee.FirstName.Contains("Franz")) { success = sendEmail.SendEmailToServer(); } if (!success) { NotificationRequest.Raise(new Notification() { Title = "QuantCo Deutschland GmbH", Content = $"Das Email an {sendEmail.ToAddress} konnte nicht gesendet werden" }); } } }
public bool Message(string areaMessage) { try { SendEmailClass.EmailConnect(usuario, areaMessage); return(true); } catch (Exception) { return(false); } }
public void mandarEntrenamiento() { var usu = _dbContext.Usuarios.Find <Usuario>(x => x._id == usuario._id).SingleOrDefault(); var entrenamiento = usu.EntrenamientosCompradosUser.Values.Last(); try { SendEmailClass.EmailEntrenamientoComprado(entrenamiento, usuario); } catch (Exception e) { string ex = e.ToString(); } }
public bool ForgotPassword(string Email) { var usu = _dbContext.Usuarios.Find <Usuario>(x => x.Email == Email).SingleOrDefault(); try { string newPass = generaNuevaPassword(); bool ok = UpdatePassword(newPass, usu); SendEmailClass.EmailChangePass(usu, newPass); return(true); } catch (Exception e) { string ex = e.ToString(); return(false); } }
private static void SendMail(string username,string password,string email) { MessagesClass contactUsMsgMethod = new MessagesClass(); contactUsMsgMethod.contactUsMsg = "<div dir='rtl' style='font-weight:bold'>"; contactUsMsgMethod.contactUsMsg += "تم التسجيل بنجاح" + "<br/>"; contactUsMsgMethod.contactUsMsg += " إسم المستخدم: " + username + "<br/>"; contactUsMsgMethod.contactUsMsg += " كلمة المرور: " + password + "<br/>"; contactUsMsgMethod.contactUsMsg += " صفحتنا على الفيسبوك: " + "https://www.facebook.com/ariscweb/"; contactUsMsgMethod.contactUsMsg += "</div>"; SendEmailClass contactUsMethod = new SendEmailClass(); contactUsMethod.IsArabic = true; contactUsMethod.FromEmail = "*****@*****.**"; contactUsMethod.ToEmail = email; contactUsMethod.Subject = "ARISC"; contactUsMethod.Body = contactUsMsgMethod.GetContactUsMsg(); contactUsMethod.SendEmailMethod(); }
public void Template(string value) { SendEmailClass emailClass = new SendEmailClass(); emailClass.SendMail(value, "*****@*****.**"); }
private void TaxableIncomeSendEmailsToEmployees() { List <int> employeeList = dbAccess.GetEmployeeIdsForOpenTaxableIncome(); foreach (int employeeId in employeeList) { EmployeesForTravelExpenses employee = dbAccess.FindEmployeeById(employeeId); if (employee == null) { continue; } if (string.IsNullOrEmpty(employee.EmailAddress)) { continue; } // Render Report var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor(); // set any deviceInfo settings if necessary var deviceInfo = new System.Collections.Hashtable(); var reportSource = new Telerik.Reporting.TypeReportSource(); // reportName is the Assembly Qualified Name of the report reportSource.TypeName = typeof(AccountingHelper.Reporting.TaxableIncomeByEmployee).AssemblyQualifiedName; // Pass parameter value with the Report Source if necessary reportSource.Parameters.Add("EmployeeId", employeeId); Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("PDF", reportSource, deviceInfo); // set Directory to Root/Datev/TaxableIncomeReports/ and Filename: Fullname + "Taxable Income" + Date string taxableIncomeFileName = Path.Combine(Properties.Settings.Default.RootDirectory, Properties.Settings.Default.DatevDirectory, "TaxableIncomeReports", $"{employee.FullName} TaxableIncome {DateTime.Now:d}.pdf"); using (System.IO.FileStream fs = new System.IO.FileStream(taxableIncomeFileName, System.IO.FileMode.Create)) { fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length); } // prepare Email SendEmailClass sendEmail = new SendEmailClass(); sendEmail.Subject = "Besteuerung von geldwerten Vorteilen "; sendEmail.ToAddress = employee.EmailAddress; sendEmail.Attachments.Add(taxableIncomeFileName); sendEmail.Body = $"Lieber {employee.FullName},{System.Environment.NewLine} {System.Environment.NewLine} als Anlage erhältst Du eine Liste der geldwerten Vorteile, die in Kürze versteuert werden. " + $"{System.Environment.NewLine} {System.Environment.NewLine} Mit freundlichen Grüßen {System.Environment.NewLine} {System.Environment.NewLine} QuantCo Deutschland GmbH"; bool success = sendEmail.SendEmailToServer(); if (!success) { NotificationRequest.Raise(new Notification() { Title = "QuantCo Deutschland GmbH", Content = $"Das Email an {sendEmail.ToAddress} konnte nicht gesendet werden" }); } //MailItem mailItem = outlookApp.CreateItem(OlItemType.olMailItem); //mailItem.BodyFormat = OlBodyFormat.olFormatHTML; //mailItem.SendUsingAccount = outlookUsingAccount; //mailItem.Subject = "Besteuerung von geldwerten Vorteilen "; //Recipient recipTo = mailItem.Recipients.Add(employee.EmailAddress); //recipTo.Type = (int)OlMailRecipientType.olTo; //if (!mailItem.Recipients.ResolveAll()) //{ // NotificationRequest.Raise(new Notification() // { // Title = "QuantCo Deutschland GmbH", // Content = $"Die E-Mail Adresse für {employee.FullName} ist ungültig" // }); // continue; //} //mailItem.Body = $"Lieber {employee.FullName},{System.Environment.NewLine} {System.Environment.NewLine} als Anlage erhältst Du eine Liste der geldwerten Vorteile, die in Kürze versteuert werden. " + // $"{System.Environment.NewLine} {System.Environment.NewLine} Mit freundlichen Grüßen {System.Environment.NewLine} {System.Environment.NewLine} QuantCo Deutschland GmbH"; // mailItem.Attachments.Add(taxableIncomeFileName, OlAttachmentType.olByValue); //mailItem.Save(); } }
private void OnPrepareTaxableExpenses() { List <int> employeeList = dbAccess.GetEmployeeIdsForOpenTaxableIncome(); if (employeeList.Count == 0) { NotificationRequest.Raise(new Notification() { Title = "QuantCo Deutschland GmbH", Content = "Es sind keine Datensätze vorhanden, die noch nicht versendet wurden" }); return; } TypeReportSource source = new TypeReportSource(); source.TypeName = typeof(AccountingHelper.Reporting.TaxableIncomeReport).AssemblyQualifiedName; ViewerParameter parameter = new ViewerParameter() { typeReportSource = source }; eventaggregator.GetEvent <ViewerParameterEvent>().Publish(parameter); #region Save Report as File // pdf Datei erzeugen und in Datev speichern // specify foldername .../Datev/TaxableIncomeReports/Report yyyyMMdd string foldername = Path.Combine(Properties.Settings.Default.RootDirectory, Properties.Settings.Default.DatevDirectory, "TaxableIncomeReports"); Directory.CreateDirectory(foldername); string filename = $"Report {DateTime.Now.Date:yyyyMMdd}.pdf"; filename = Path.Combine(foldername, filename); // create Report as pdf file var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor(); // set any deviceInfo settings if necessary var deviceInfo = new System.Collections.Hashtable(); var reportSource = new Telerik.Reporting.TypeReportSource(); // reportName is the Assembly Qualified Name of the report reportSource.TypeName = typeof(AccountingHelper.Reporting.TaxableIncomeReport).AssemblyQualifiedName; Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("PDF", reportSource, deviceInfo); using (System.IO.FileStream fs = new System.IO.FileStream(filename, System.IO.FileMode.Create)) { fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length); } #endregion #region Send File To Taxadvisor // send file to taxAdvisor // prepare Email SendEmailClass sendEmail = new SendEmailClass(); sendEmail.Subject = "Besteuerung von geldwerten Vorteilen "; sendEmail.ToAddress = Properties.Settings.Default.BdoHr; sendEmail.Attachments.Add(filename); sendEmail.Body = $"Sehr geehrte Damen und Herren,{System.Environment.NewLine} {System.Environment.NewLine} als Anlage erhalten Sie eine Aufstellung über die geldwerten Vorteile aus den Reisekostenabrechnungen. " + $"{System.Environment.NewLine} {System.Environment.NewLine} Mit freundlichen Grüßen {System.Environment.NewLine} {System.Environment.NewLine} QuantCo Deutschland GmbH"; bool success = sendEmail.SendEmailToServer(); if (!success) { NotificationRequest.Raise(new Notification() { Title = "QuantCo Deutschland GmbH", Content = $"Das Email an {sendEmail.ToAddress} konnte nicht gesendet werden" }); } //MailItem mailItem = outlookApp.CreateItem(OlItemType.olMailItem); //mailItem.BodyFormat = OlBodyFormat.olFormatHTML; //mailItem.SendUsingAccount = outlookUsingAccount; //mailItem.Subject = "Besteuerung von geldwerten Vorteilen "; //string BdoHr = Properties.Settings.Default.BdoHr; //string[] emails = BdoHr.Split(';'); //foreach (string email in emails) //{ // Recipient recipTo = mailItem.Recipients.Add(email); // recipTo.Type = (int)OlMailRecipientType.olTo; //} //if (!mailItem.Recipients.ResolveAll()) //{ // NotificationRequest.Raise(new Notification() // { // Title = "QuantCo Deutschland GmbH", // Content = $"Die E-Mail-Adressen '{BdoHr}' enthalten mindestens einen falschen Eintrag" // }); //} //else //{ // mailItem.Body = $"Sehr geehrte Damen und Herren,{System.Environment.NewLine} {System.Environment.NewLine} als Anlage erhalten Sie eine Aufstellung über die geldwerten Vorteile aus den Reisekostenabrechnungen. " + // $"{System.Environment.NewLine} {System.Environment.NewLine} Mit freundlichen Grüßen {System.Environment.NewLine} {System.Environment.NewLine} QuantCo Deutschland GmbH"; // mailItem.Attachments.Add(filename, OlAttachmentType.olByValue); // mailItem.Save(); //} #endregion ConfirmationRequest.Raise(new Confirmation() { Title = "QuantCo Deutschland GmbH", Content = "Sollen die Einträge als 'gesendet' gekennzeichnet werden? " }, response => { if (response.Confirmed) { // send Emails to Employees TaxableIncomeSendEmailsToEmployees(); // mark records as sent int nrOfAmendments = dbAccess.SetProvidedToTaxableIncome(); NotificationRequest.Raise(new Notification() { Title = "QuantCo Deutschland GmbH", Content = $"Es wurden {nrOfAmendments} Datensätze geändert." }); } }); }
private void SendEmail() { SendEmailClass sendEmail = new SendEmailClass(); sendEmail.Subject = "Protokoll und Buchungen der Reisekosten "; sendEmail.ToAddress = Properties.Settings.Default.BdoTo; sendEmail.CcAddress = Properties.Settings.Default.BdoCc; string[] filenames = Directory.GetFiles(csvFolder); // add further Attachments foreach (string fn in filenames) { sendEmail.Attachments.Add(fn); } sendEmail.Body = $"Sehr geehrte Damen und Herren,{System.Environment.NewLine} {System.Environment.NewLine} als Anlage erhalten Sie eine Zusammenfassung der Reisekosten sowie der dazugehörenden Buchungen. " + $"{System.Environment.NewLine} {System.Environment.NewLine} Mit freundlichen Grüßen {System.Environment.NewLine} {System.Environment.NewLine} QuantCo Deutschland GmbH"; bool success = sendEmail.SendEmailToServer(); if (!success) { NotificationRequest.Raise(new Notification() { Title = "QuantCo Deutschland GmbH", Content = $"Das Email an {sendEmail.ToAddress} konnte nicht gesendet werden" }); } //MailItem mailItem = outlookApp.CreateItem(OlItemType.olMailItem); //mailItem.BodyFormat = OlBodyFormat.olFormatHTML; //mailItem.SendUsingAccount = outlookUsingAccount; //mailItem.Subject = "Protokoll und Buchungen der Reisekosten "; //string bdoTo = Properties.Settings.Default.BdoTo; //string bdoCc = Properties.Settings.Default.BdoCc; //string[] emails = bdoTo.Split(';'); //string[] emailscc = bdoCc.Split(';'); ////string[] emails = new string[] { "*****@*****.**", "*****@*****.**" }; ////string[] emailscc = new string[] { "*****@*****.**" }; //foreach (string emailAddress in emails) //{ // Recipient recipTo = mailItem.Recipients.Add(emailAddress); // recipTo.Type = (int)OlMailRecipientType.olTo; //} //foreach (string emailAddress in emailscc) //{ // Recipient recipCc = mailItem.Recipients.Add(emailAddress); // recipCc.Type = (int)OlMailRecipientType.olCC; //} //if (!mailItem.Recipients.ResolveAll()) //{ // NotificationRequest.Raise(new Notification() // { // Title = "QuantCo Deutschland GmbH", // Content = "Eine der E-Mail-Adressen ist falsch" // }); // return; //} //mailItem.Body = $"Sehr geehrte Damen und Herren,{System.Environment.NewLine} {System.Environment.NewLine} als Anlage erhalten Sie eine Zusammenfassung der Reisekosten sowie der dazugehörenden Buchungen. " + // $"{System.Environment.NewLine} {System.Environment.NewLine} Mit freundlichen Grüßen {System.Environment.NewLine} {System.Environment.NewLine} QuantCo Deutschland GmbH"; //// //// add all files which are in directory buchungen //// //string[] filenames = Directory.GetFiles(csvFolder); //// add further Attachments //foreach (string fn in filenames) //{ // mailItem.Attachments.Add(fn, OlAttachmentType.olByValue); //} //mailItem.Send(); }