protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { var descripcion = Request.Form["descripcion"]; if (descripcion == null || descripcion == "") return; problemas problema = new problemas(); problema.descripcion = descripcion; Business.ControladorProblemas.addProblema(problema); //El metodo que envia debe contener lo siguiente MailMessage objEmail = new MailMessage(); objEmail.From = new MailAddress("*****@*****.**"); //Destinatario objEmail.To.Add("*****@*****.**"); objEmail.Priority = MailPriority.Normal; objEmail.Subject = "Nuevo Reporte"; objEmail.Body = "Fecha: " + DateTime.Now.ToShortDateString() + "\r\nDetalle: " + descripcion; SmtpClient objSmtp = new SmtpClient(); objSmtp.Host = "localhost"; objSmtp.Send(objEmail); } }
public static void addProblema(problemas problema) { try { admEntities db = Datos.getDB(); db.problemas.Add(problema); db.SaveChanges(); } catch (Exception e) { Logger.Log.write(e.InnerException == null ? e.Message : e.InnerException.Message); throw e; } }
public static void addProblema(problemas problema) { problema.estado = "Reportado"; CatalogoProblemas.addProblema(problema); }