public ActionResult Create(FormCollection collection) { var model = new TrainManagement(); TryUpdateModel(model, collection.ToValueProvider()); if (!ModelState.IsValid) { return View(model); } using (var session = new SessionFactory().OpenSession()) { session.BeginTransaction(); model.CreatedAt = DateTime.Now; model.CreatedBy = CurrentAccountNo; ViewData.Model = model; if (session.Create(model)) { session.Commit(); FlashSuccess("创建记录成功!"); return Close(); } session.Rollback(); FlashFailure("创建记录失败!"); return View(); } }
private bool CanLeaderApprove(TrainManagement management) { if (management == null || string.IsNullOrEmpty(management.Status)) return false; return management.Status.Equals(TrainManStateConst.法规部门负责人已审核); }
private bool CanApprove(TrainManagement management) { if (management == null) return false; return String.IsNullOrEmpty(management.Status); }