public ActionResult Edit(string id) { long idParse; WebNotice model = new WebNotice(); if (long.TryParse(id, out idParse)) { model = webNoticeBll.GetModelById(idParse); } return(View(model)); }
public WebNoticeViewModel(WebNotice WebNotice) { Subject = WebNotice.Subject; // Fix if doesn't have html/html5 wrapper (to set correctly the CSS) if (WebNotice.Article.Length < 14 || !WebNotice.Article.ToUpper().StartsWith("<!DOCTYPE HTML")) { Article = "<!DOCTYPE html><html><body>" + WebNotice.Article + "</body></html>"; } else { Article = WebNotice.Article; } Date = new DateTime(WebNotice.Year, WebNotice.Month, WebNotice.Day).ToString(LauncherSettings.APP_WEBNOTICE_TIME_FORMAT); }
public AjaxResult Edit(WebNotice model, long @operator) { AjaxResult result = new AjaxResult(); var procResult = dal.Edit(model, @operator); result.flag = procResult.IsSuccess; if (result.flag) { result.message = "修改成功!"; } else { result.message = procResult.ProcMsg; } return(result); }
public AjaxResult Add(WebNotice model) { AjaxResult result = new AjaxResult(); var procResult = dal.Add(model); result.flag = procResult.IsSuccess; if (result.flag) { result.message = "新增成功!"; } else { result.message = procResult.ProcMsg; } return(result); }
public ProcResult Add(WebNotice model) { ProcResult result = new ProcResult(); try { db.WebNotice.Add(model); result.IsSuccess = db.SaveChanges() > 0; } catch (Exception ex) { result.ProcMsg = ex.InnerException.Message; LogUtil.Exception("ExceptionLogger", ex); } return(result); }
public ProcResult Edit(WebNotice model, long currentOperator) { ProcResult result = new ProcResult(); try { model.Creator = currentOperator; model.CreateTime = DateTime.Now; db.Set <WebNotice>().Attach(model); db.Entry(model).State = System.Data.Entity.EntityState.Modified; result.IsSuccess = db.SaveChanges() > 0; return(result); } catch (Exception ex) { result.ProcMsg = ex.InnerException.Message; LogUtil.Exception("ExceptionLogger", ex); } return(result); }
public ActionResult Edit(WebNotice model) { var currentUser = HttpContext.Session[Constants.USER_KEY] as USP.Models.POCO.User; model.Creator = currentUser.SysOperator.ID; model.CreateTime = DateTime.Now; model.Auditor = null; model.AuditTime = null; if (ModelState.IsValid) { var result = webNoticeBll.Edit(model, currentUser.SysOperator.ID); if (result.flag) { TempData["isSuccess"] = "true"; TempData["MessageInfo"] = "完善信息成功!"; return(View("Index")); } } TempData["isSuccess"] = "false"; TempData["MessageInfo"] = "完善信息失败!"; return(View(model)); }
public ProcResult Auditor(WebNotice model, long auditor) { ProcResult result = new ProcResult(); try { var entity = GetModelById(model.ID); if (entity != null) { entity.Auditor = auditor; entity.AuditTime = DateTime.Now; } db.Entry <WebNotice>((WebNotice)entity).State = System.Data.Entity.EntityState.Modified; result.IsSuccess = db.SaveChanges() > 0; } catch (Exception ex) { result.ProcMsg = ex.InnerException.Message; LogUtil.Exception("ExceptionLogger", ex); } return(result); }
public ActionResult Add(WebNotice model) { var currentUser = HttpContext.Session[Constants.USER_KEY] as USP.Models.POCO.User; model.Creator = currentUser.SysOperator.ID; model.CreateTime = DateTime.Now; if (ModelState.IsValid) { AjaxResult result = webNoticeBll.Add(model); if (result.flag) { TempData["returnMsgType"] = "success"; TempData["returnMsg"] = "添加成功"; return(View("Index")); } else { TempData["returnMsgType"] = "error"; TempData["returnMsg"] = result.message; } } return(View(model)); }