public JsonResult UpdatePlanInfo([FromBody] JObject param_plan) { bool updatestatus = false; try { t_plan_line planinfo = new t_plan_line(); planinfo.planid = param_plan["planid"].ToString(); planinfo.planname = param_plan["planname"].ToString(); planinfo.plantype = int.Parse(param_plan["type"].ToString()); planinfo.linename = param_plan["linename"].ToString(); planinfo.lineguid = param_plan["lineguid"].ToString(); planinfo.createtime = DateTime.Now; planinfo.creator = param_plan["creator"].ToString(); int direct = int.Parse(param_plan["direction"].ToString()); updatestatus = myPostRepo.Update_T_PlanInfo(planinfo); //var cur=myPostRepo.GetSingle_T_PlanInfo(planinfo.planid); if (updatestatus) { return(Json(new { success = "200", data = planinfo })); } else { return(Json(new { success = "404", data = updatestatus })); } } catch (Exception ex) { return(Json(new { success = "404", error = ex.ToString() })); } }
public JsonResult AddPlanInfoResult([FromBody] JObject param_plan) { bool addstatus = false; try { t_plan_line planinfo = new t_plan_line(); planinfo.planid = Guid.NewGuid().ToString(); planinfo.planname = param_plan["planname"].ToString(); planinfo.plantype = int.Parse(param_plan["type"].ToString()); planinfo.linename = param_plan["linename"].ToString(); planinfo.lineguid = param_plan["lineguid"].ToString(); planinfo.createtime = DateTime.Now; planinfo.creator = param_plan["creator"].ToString(); int direct = int.Parse(param_plan["direction"].ToString()); addstatus = myPostRepo.AddSingle_T_PlanInfo(planinfo); if (planinfo.plantype == 1) { //查询lineguid的站点列表和line线路 bool addstatus1 = myPostRepo.AddPlanPointListFromCurrentPoint(planinfo.planid, planinfo.lineguid, direct); bool addstatus2 = myPostRepo.AddPlanLineShapeFromCurrentLineShape(planinfo.planid, planinfo.lineguid, direct); addstatus = addstatus1 && addstatus2; } //var cur=myPostRepo.GetSingle_T_PlanInfo(planinfo.planid); if (addstatus) { return(Json(new { success = "200", data = planinfo })); } else { return(Json(new { success = "404", data = addstatus })); } } catch (Exception ex) { return(Json(new { success = "404", error = ex.ToString() })); } }