public ActionResult Edit(RateSatisfactionViewModel model) { try { if (ModelState.IsValid) { var item = dao.GetEntity("STAT_MO", model.STAT_MO, "HALL_NO", model.HALL_NO); item.MODIFY_DTIME = DateTime.Now; item.MODIFY_ID = UserState.UserID; item.COR_EVAL_DISSATISFY_CNT = model.COR_EVAL_DISSATISFY_CNT; item.COR_VALID_EVAL_CNT = (int)model.COR_VALID_EVAL_CNT; CHK_HALL_STAT_M_DAL.UpdateObject(item); var mo = Convert.ToInt32(item.STAT_MO.ToString().Substring(4, 2)); if (mo != DateTime.Now.Month) { Stored_DAL.UpdateDataByHall(item.STAT_MO, item.HALL_NO, UserState.UserID); } Alter("修改成功!", util.Enum.AlterTypeEnum.Success, false, true); return(Redirect("/Home/Blank")); } ModelState.AddModelError("", "修改失败。"); return(View(model)); } catch (Exception ex) { LogHelper.ErrorLog("修改出错!", ex); ModelState.AddModelError("", "修改失败!" + ex.Message); return(RedirectToAction("Error", "Home")); } }
public ActionResult Edit(string id, string staffId) { ViewBag.HALL_NAM = Halldao.GetEntity("HALL_NO", staffId).HALL_NAM; ViewBag.STAT_MO = id; try { var item = CHK_HALL_STAT_M_DAL.GetRateSatisfaction(Convert.ToInt32(id), staffId); var model = new RateSatisfactionViewModel() { COR_EVAL_DISSATISFY_CNT = (int)item.COR_EVAL_DISSATISFY_CNT, COR_VALID_EVAL_CNT = item.COR_VALID_EVAL_CNT == null?0:(int)item.COR_VALID_EVAL_CNT, HALL_NO = item.HALL_NO, STAT_MO = item.STAT_MO }; return(View(model)); } catch (Exception ex) { LogHelper.ErrorLog("查看出错", ex); return(RedirectToAction("Error", "Home")); } }