/// <summary> /// 新增修改 /// </summary> /// <returns></returns> public ActionResult SaveForm(SelfEvaluateEntity entity) { var userNow = OperatorProvider.Provider.Current(); var bll = new SelfEvaluateBLL(); try { if (string.IsNullOrEmpty(entity.Id)) //新增自我评估 { entity.Id = Guid.NewGuid().ToString(); } entity.CreateUser = userNow.UserName; entity.CreateUserId = userNow.UserId; entity.DeptCode = userNow.DeptCode; entity.DeptId = userNow.DeptId; entity.DeptName = userNow.DeptName; if (string.IsNullOrEmpty(entity.A.Id)) //新增自我评估 { entity.A.Id = Guid.NewGuid().ToString(); } if (string.IsNullOrEmpty(entity.B.Id)) //新增自我评估 { entity.B.Id = Guid.NewGuid().ToString(); } if (string.IsNullOrEmpty(entity.C.Id)) //新增自我评估 { entity.C.Id = Guid.NewGuid().ToString(); } if (string.IsNullOrEmpty(entity.D.Id)) //新增自我评估 { entity.D.Id = Guid.NewGuid().ToString(); } if (string.IsNullOrEmpty(entity.E.Id)) //新增自我评估 { entity.E.Id = Guid.NewGuid().ToString(); } entity.A.EvaId = entity.Id; entity.B.EvaId = entity.Id; entity.C.EvaId = entity.Id; entity.D.EvaId = entity.Id; entity.E.EvaId = entity.Id; if (entity.IsSubmit == "1") { entity.IsFill = "1"; } bll.SaveForm(entity); return(Success("操作完成")); } catch (Exception ex) { return(Error("操作失败:" + ex.Message)); } }
public object SaveSelfEvaluate() { try { var bll = new SelfEvaluateBLL(); string res = HttpContext.Current.Request["json"]; dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); string userid = dy.userid; OperatorProvider.AppUserId = userid; //设置当前用户 Operator curUser = OperatorProvider.Provider.Current(); if (null == curUser) { return(new { code = -1, count = 0, info = "请求失败,请登录!", data = new object() }); } string dataJson = JsonConvert.SerializeObject(dy.data); SelfEvaluateEntity entity = JsonConvert.DeserializeObject <SelfEvaluateEntity>(dataJson); if (string.IsNullOrEmpty(entity.Id)) //新增自我评估 { entity.Id = Guid.NewGuid().ToString(); } entity.CreateUser = curUser.UserName; entity.CreateUserId = curUser.UserId; entity.DeptCode = curUser.DeptCode; entity.DeptId = curUser.DeptId; entity.DeptName = curUser.DeptName; if (string.IsNullOrEmpty(entity.A.Id)) //新增自我评估 { entity.A.Id = Guid.NewGuid().ToString(); } if (string.IsNullOrEmpty(entity.B.Id)) //新增自我评估 { entity.B.Id = Guid.NewGuid().ToString(); } if (string.IsNullOrEmpty(entity.C.Id)) //新增自我评估 { entity.C.Id = Guid.NewGuid().ToString(); } if (string.IsNullOrEmpty(entity.D.Id)) //新增自我评估 { entity.D.Id = Guid.NewGuid().ToString(); } if (string.IsNullOrEmpty(entity.E.Id)) //新增自我评估 { entity.E.Id = Guid.NewGuid().ToString(); } entity.A.EvaId = entity.Id; entity.B.EvaId = entity.Id; entity.C.EvaId = entity.Id; entity.D.EvaId = entity.Id; entity.E.EvaId = entity.Id; if (entity.IsSubmit == "1") { entity.IsFill = "1"; } bll.SaveForm(entity); return(new { code = 0, count = 0, info = "获取成功", data = 0 }); } catch (Exception ex) { return(new { code = -1, count = 0, info = "获取数据失败:" + ex.Message, data = new object() }); } }