public ActionResult Create(FormCollection collection) { var view = new TrainExperienceView(); TryUpdateModel(view, collection.ToValueProvider()); if (!ModelState.IsValid) { return View(view); } using (var session = new SessionFactory().OpenSession()) { session.BeginTransaction(); var model = new TrainExperience { CreatedAt = DateTime.Now, CreatedBy = CurrentAccountNo, TrainManItemId = view.TrainManItemId, Experience = view.Experience, Status = "", ApproveStatus = "" }; if (null != session.Load<TrainExperience>(m => m.TrainManItemId.Equals(model.TrainManItemId))) { ModelState.AddModelError("TrainManName", "该培训心得已经存在!"); return View(view); } ViewData.Model = view; if (session.Create(model)) { session.Commit(); FlashSuccess("创建记录成功!"); return Close(); } session.Rollback(); FlashFailure("创建记录失败!"); return View(); } }
private static bool CanSubmit(TrainExperience e) { if (e == null) return false; return string.IsNullOrEmpty(e.Status); }
private static bool CanSubmit(TrainExperience e) { if (e == null) return false; return e.Status.Equals(TrainExperienceConst.已提交培训管理部门); }
private static bool CanSubmit(TrainExperience e) { if (e == null) return false; return e.Status.Equals(TrainExperienceConst.已提交部门负责人) && e.ApproveStatus.Equals(ApproveStateConst.已审核); }