public ActionResult Withdraw(int Id) { AbstractManager manager = new AbstractManager(); if (manager.Withdraw(Id)) { TempData["AlertType"] = "SUCCESS"; TempData["AlertContent"] = "Your abstract has been successfully withdrawn."; } else { TempData["AlertType"] = "DANGER"; TempData["AlertContent"] = "Oops! Something Wrong! Please Try Again!"; } MailBrief brief = manager.GetMailBrief(Id); MailManager mail = new MailManager(); string html = "<h2>The abstract you submitted has been <strong>withdraw by yourself</strong>.</h2><hr />" + "Title:" + brief.Title + "<br />" + "Id:" + brief.GroupId + "-" + brief.Id + "<br />" + "Creation Time:" + brief.SubmitTime + "<br />" + "Operation Time:" + DateTime.Now + "<hr />" + "Operation IP Address:" + Request.UserHostAddress + "<hr />" + "Any requests please get in touch:<a href=\"mailto: incise2018 @sustc.edu.cn\">[email protected]</a>"; mail.ReciveUserAddress = brief.MailAddress; mail.MailTitle = "Abstract‘s Status Update"; mail.MailContent = html; mail.UseHtml = true; mail.Send(); return(View("MyAbstract", GetMyAbstract())); }
public ActionResult Delete(int Id, int GroupId) { if (!PermissionCheck()) { return(View("Blocking")); } AbstractManager manager = new AbstractManager(); if (manager.Delete(Id)) { TempData["AlertType"] = "SUCCESS"; TempData["AlertContent"] = "Set Abstract (" + GroupId + "-" + Id + ") Statement to [Fail]."; } else { TempData["AlertType"] = "DANGER"; TempData["AlertContent"] = "Oops! Something Wrong! Please Try Again!"; } MailBrief brief = manager.GetMailBrief(Id); MailManager mail = new MailManager(); string html = "<h2>The abstract you submitted has been <strong>withdraw by administrator</strong>.</h2>" + "<p>Please revise and resubmit or contact us via email..</p><hr />" + "Title:" + brief.Title + "<br />" + "Id:" + brief.GroupId + "-" + brief.Id + "<br />" + "Creation Time:" + brief.SubmitTime + "<br />" + "Operation Time:" + DateTime.Now + "<hr />" + "Any requests please get in touch:<a href=\"mailto: incise2018 @sustc.edu.cn\">[email protected]</a>"; mail.ReciveUserAddress = brief.MailAddress; mail.MailTitle = "Abstract‘s Status Update"; mail.MailContent = html; mail.UseHtml = true; mail.Send(); return(RedirectToAction("Console")); }
public MailBrief GetMailBrief(int Id) { MailBrief brief = new MailBrief(); using (SqlConnection conn = new SqlConnection(ConnectionString)) { conn.Open(); string sql = "select t1.UserName,t2.* from AbstractGroups as t1 " + "left join AbstractNodes as t2 on t2.GroupId = t1.GroupId " + "where Id = @p1; "; SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.AddWithValue("@p1", Id); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { brief.MailAddress = dr.GetString(0); brief.Id = dr.GetInt32(1); brief.GroupId = dr.GetInt32(2); brief.SubmitTime = dr.GetDateTime(4); brief.Title = dr.GetString(7); } return(brief); } }