public MEnterpriseMessage GetMEnterriseMessage(int id) { EMSEntities entity = new EMSEntities(); MEnterpriseMessage item = entity.MEnterpriseMessage.SingleOrDefault(m => m.MessageID == id); return(item); }
public void DeleteMEnterriseMessage(int id) { EMSEntities entity = new EMSEntities(); MEnterpriseMessage item = entity.MEnterpriseMessage.SingleOrDefault(m => m.MessageID == id); entity.MEnterpriseMessage.Remove(item); entity.SaveChanges(); }
public void UpdateMEnterriseMessage(int id, bool read) { EMSEntities entity = new EMSEntities(); MEnterpriseMessage item = entity.MEnterpriseMessage.SingleOrDefault(m => m.MessageID == id); item.MessageIsRead = read; entity.SaveChanges(); }
public void SetMEnterriseMessage(MEnterpriseMessage message) { EMSEntities entity = new EMSEntities(); entity.MEnterpriseMessage.Add(message); entity.SaveChanges(); }
public ActionResult MessageDetail(int id, string read) { ViewBag.MenuGroup = "MI"; ViewBag.MenuTitle = "留言详情"; if (id <= 0) { return(null); } if (!string.IsNullOrEmpty(read)) { BLLMEnterpriseMessage.UpdateMEnterriseMessage(id, read == "是" ? true : false); ViewBag.result = "success"; } MEnterpriseMessage message = BLLMEnterpriseMessage.GetMEnterriseMessage(id); return(View(message)); }
public ActionResult SendMessage(string Mname, string Mtel, string Memail, string Mmessage) { MEnterpriseMessage message = new MEnterpriseMessage(); message.MessageEnterpriseName = Mname; message.MessageEnterpriseTel = Mtel; message.MessageEnterpriseEmail = Memail; message.Message = Mmessage; message.MessageIsRead = false; ViewBag.Menu = "AU"; if (string.IsNullOrEmpty(Mname)) { ViewBag.MnameEorror = "请输入公司名称"; } if (string.IsNullOrEmpty(Mtel)) { ViewBag.MtelEorror = "请输入联系电话"; } if (string.IsNullOrEmpty(Mmessage)) { ViewBag.MmessageEorror = "请输入您的留言"; } if (string.IsNullOrEmpty(Memail)) { ViewBag.MemailEorror = "请输入邮箱地址"; } else { Regex reg = new Regex(@"^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})"); if (!reg.IsMatch(Memail)) { ViewBag.MemailError = "请输入正确的邮箱地址"; } } if (!string.IsNullOrEmpty(ViewBag.MnameEorror) || !string.IsNullOrEmpty(ViewBag.MtelEorror) || !string.IsNullOrEmpty(ViewBag.MmessageEorror) || !string.IsNullOrEmpty(ViewBag.MemailEorror)) { return(View("AboutUs")); } BLLMEnterpriseMessage.SetMEnterriseMessage(message); return(View("AboutUs")); }
public static void SetMEnterriseMessage(MEnterpriseMessage message) { DALMEnterpriseMessage _DAL = new DALMEnterpriseMessage(); _DAL.SetMEnterriseMessage(message); }