public ActionResult AddSingle() { string month = Request.Params["month"]; if (month == null) { return(Json( new OperateResult { content = "请输入考核月", }, JsonRequestBehavior.AllowGet )); } string data = Request.Params["assessmentData"]; if (data == null) { return(Json( new OperateResult { content = "无考核数据", }, JsonRequestBehavior.AllowGet )); } JavaScriptSerializer js = new JavaScriptSerializer(); AssessmentInfo model = js.Deserialize <AssessmentInfo>(data); if (model == null) { return(Json( new OperateResult { content = "无考核数据", }, JsonRequestBehavior.AllowGet )); } model.month = month; AssessmentManager manager = new AssessmentManager(); OperateResult or = manager.Add(model); return(Json(or, JsonRequestBehavior.AllowGet)); }
public bool EmployeeAssessmentStub(string month) { Random random = new Random(); QueryParam queryParam = new QueryParam { pager = new Pager { page = 1, rows = EmployeeStubSize } }; FilterModel filter = new FilterModel { key = "month", value = month }; Dictionary <string, FilterModel> filterSet = new Dictionary <string, FilterModel>(); filterSet.Add(filter.key, filter); queryParam.filters = filterSet; var or = AssessmentManager.GetEmployeesAll(queryParam); if (or.status == OperateStatus.Error) { return(false); } dynamic listAssessment = or.data; foreach (dynamic ass in listAssessment) { AssessmentInfo e = new AssessmentInfo(); PropertyInfo[] pArray = ass.GetType().GetProperties(); Type t = ass.GetType(); e.billSerial = Convert.ToString(t.GetProperty("billSerial").GetValue(ass)); e.billSerial = t.GetProperty("billSerial").GetValue(ass); e.employeeId = t.GetProperty("employeeId").GetValue(ass); e.month = month; e.benefitScore = random.Next(40, 100); e.performanceScore = random.Next(40, 100); e.shouldWorkTime = 22; e.actualWorkTime = 22; or = AssessmentManager.Add(e); if (or.status == OperateStatus.Error) { StackTrace st = new StackTrace(new StackFrame(true)); string msg = $"App Trace >>> in file: {st.GetFrame(0).GetFileName()} " + $"line {st.GetFrame(0).GetFileLineNumber()} message: {or.content}"; Trace.WriteLine(msg); return(false); } } return(true); }