private void B_send_Click(object sender, RoutedEventArgs e) { //add bugeport to database if (database) { //check correctness of input data if (TB_description.Text.Replace(" ", string.Empty) == string.Empty || CB_os.SelectedIndex < 0 || CB_impact.SelectedIndex < 0 || (TB_email.Text.Replace(" ", string.Empty) != "" && !CValidation.ValidateEmail(TB_email.Text))) { CMessageBox message = new CMessageBox("Bitte füllen sie alle Felder die mit einem * gekennzeichnet sind und überprüfen sie die Daten auf ihre Richtigkeit", "Eingabe Korrigieren", CColor.Theme.DarkGrey, CImage.ImageType.edit_black, CMessageBox.CMessageBoxButton.OK); message.ShowDialog(); return; } string impact = string.Empty; if (CB_impact.SelectedIndex >= 0) { impact = (CB_impact.SelectedItem as ComboBoxItem).Content.ToString(); } try { if (!InsertRequest(TB_email.Text, DateTime.Today, "", false, TB_description.Text, CB_os.Text, CB_priority.Text, TB_version.Text, impact, TB_product.Text)) { return; } } catch (Exception ex) { CMessageBox errormessage = new CMessageBox(ex.InnerException.Message.ToString(), "Datenbankfehler", CColor.Theme.Red, CImage.ImageType.error_outline_black, CMessageBox.CMessageBoxButton.OK); errormessage.ShowDialog(); return; } CMessageBox donemessage = new CMessageBox("Vielen Dank.\nIhre Anfrage wird so schnell wie möglich bearbeitet.", "Hinweis", CColor.Theme.DarkGrey, CImage.ImageType.error_outline_black, CMessageBox.CMessageBoxButton.OK); donemessage.ShowDialog(); } //send bugreport via email else { string impact = string.Empty; if (CB_impact.SelectedIndex >= 0) { impact = (CB_impact.SelectedItem as ComboBoxItem).Content.ToString(); } CEmail.SendEmail(addresseeEmail, senderEmail, senderPassword, "Fehlermeldung", TB_email.Text + "\n" + DateTime.Today + "\n" + TB_description.Text + "\n" + CB_os.Text + "\n" + CB_priority.Text + "\n" + TB_version.Text + "\n" + impact + "\n" + TB_product.Text); } Close(); }
public IActionResult CreateCEmail(CEmail cemail) { cemail.Datatime = DateTime.Now; DB.CEmail.Add(cemail); DB.SaveChanges(); return(RedirectToAction("CEmail", "Page")); }
private void SaveMailSettings() { int nodeCount = 0; XmlDocument xmldoc = new XmlDocument(); XmlNode xmlRoot, xmlNode; if (!File.Exists(pathXML.Trim())) { xmlRoot = xmldoc.CreateElement("SoftNetMail_Settings"); nodeCount = 0; } else { xmldoc.Load(pathXML.Trim()); xmlRoot = xmldoc.SelectSingleNode("/SoftNetMail_Settings"); nodeCount = xmldoc.ChildNodes.Count; } nodeCount++; xmldoc.AppendChild(xmlRoot); xmlNode = xmldoc.CreateElement("Port"); xmlRoot.AppendChild(xmlNode); xmlNode.InnerText = Encrypt_Decrypt.Encriptar(TxtPuerto.Text.Trim()); xmldoc.AppendChild(xmlRoot); xmlNode = xmldoc.CreateElement("EnableSSL"); xmlRoot.AppendChild(xmlNode); if (cmbSSL.SelectedIndex == 0) { xmlNode.InnerText = Encrypt_Decrypt.Encriptar("True"); } else { xmlNode.InnerText = Encrypt_Decrypt.Encriptar("False"); } xmldoc.AppendChild(xmlRoot); xmlNode = xmldoc.CreateElement("ApplicationPwd"); xmlRoot.AppendChild(xmlNode); xmlNode.InnerText = Encrypt_Decrypt.Encriptar(txtContraseñaAplicacion.Text.Trim()); xmldoc.Save(pathXML.Trim()); CEmail oCEmail = new CEmail(); oCEmail.LeeConfiguracionEmail(); }