Beispiel #1
0
        public ActionResult ParaAdd(XD_Parameter obj)
        {
            XD_RuleList rule = ruleListService.GetByWhere(" where R_No=@R_No", new { R_No = obj.R_No }).ToList()[0];

            obj.R_Name   = rule.R_Name;
            obj.M_No     = rule.M_No;
            obj.M_Name   = rule.M_Name;
            obj.CreateOn = DateTime.Now;
            var result = parameterService.CreateModel(obj) ? SuccessTip("新增成功!") : ErrorTip("新增失败!");

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public ActionResult Edit(XD_RuleList obj)
        {
            PageInfo page = new PageInfo();

            page.limit = 10;
            page.page  = 1;
            Module module = new Module();

            module.No = obj.M_No;

            JsonResult js   = Json(moduleService.GetListByFilter(module, page));
            string     json = Newtonsoft.Json.JsonConvert.SerializeObject(js);
            JObject    jo   = JObject.Parse(json);

            dynamic[] arr = jo.Values().Values().Values().Children().ToArray();

            obj.M_Name = arr[0]["Name"];

            var result = ruleListService.UpdateModel(obj) ? SuccessTip("编辑成功!") : ErrorTip("编辑失败!");

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #3
0
        public JsonResult List(XD_RuleList filter, PageInfo pageInfo)
        {
            //将规则和参数数据整理返回
            JsonResult js   = Json(ruleListService.GetListByFilter(filter, pageInfo));
            string     json = Newtonsoft.Json.JsonConvert.SerializeObject(js);
            JObject    jo   = JObject.Parse(json);

            IEnumerable <dynamic> dynamics = jo.Values().Values().Values().Children();

            dynamic[] arrays = dynamics.ToArray();

            string       list = "[";
            int          i = 0, j = 0;
            XD_Parameter pa   = new XD_Parameter();
            PageInfo     page = new PageInfo();

            page.limit = 10;
            page.page  = 1;
            JsonResult jspara;
            string     jsonpara;
            JObject    jopara;

            dynamic[] arrayspara;

            for (i = 0; i < arrays.Length - 1; i++)
            {
                pa.R_No = arrays[i]["R_No"];

                jspara   = Json(parameterService.GetListByFilter(pa, page));
                jsonpara = Newtonsoft.Json.JsonConvert.SerializeObject(jspara);
                jopara   = JObject.Parse(jsonpara);

                arrayspara = jopara.Values().Values().Values().Children().ToArray();
                if (arrayspara.Length == 0)
                {
                    list += "{\"M_Name\":\"" + arrays[i]["M_Name"] + "\",\"R_No\":" + arrays[i]["R_No"] + ",\"R_Name\":\"" + arrays[i]["R_Name"] + "\"},";
                }
                else
                {
                    list += "{\"M_Name\":\"" + arrays[i]["M_Name"] + "\",\"R_No\":" + arrays[i]["R_No"] + ",\"R_Name\":\"" + arrays[i]["R_Name"] + "\",\"friend\": [";
                    for (j = 0; j < arrayspara.Length - 1; j++)
                    {
                        list += "{\"P_No\":" + arrayspara[j]["P_No"] + ",\"P_Name\":\"" + arrayspara[j]["P_Name"] + "\",\"P_Type\":\"" + arrayspara[j]["P_Type"] + "\",\"P_Max\":\"" + arrayspara[j]["P_Max"] + "\",\"P_Min\":\"" + arrayspara[j]["P_Min"] + "\"},";
                    }
                    list += "{\"P_No\":" + arrayspara[j]["P_No"] + ",\"P_Name\":\"" + arrayspara[j]["P_Name"] + "\",\"P_Type\":\"" + arrayspara[j]["P_Type"] + "\",\"P_Max\":\"" + arrayspara[j]["P_Max"] + "\",\"P_Min\":\"" + arrayspara[j]["P_Min"] + "\"}]},";
                }
            }

            pa.R_No = arrays[i]["R_No"];

            jspara   = Json(parameterService.GetListByFilter(pa, page));
            jsonpara = Newtonsoft.Json.JsonConvert.SerializeObject(jspara);
            jopara   = JObject.Parse(jsonpara);

            arrayspara = jopara.Values().Values().Values().Children().ToArray();
            if (arrayspara.Length == 0)
            {
                list += "{\"M_Name\":\"" + arrays[i]["M_Name"] + "\",\"R_No\":" + arrays[i]["R_No"] + ",\"R_Name\":\"" + arrays[i]["R_Name"] + "\"}]";
            }
            else
            {
                list += "{\"M_Name\":\"" + arrays[i]["M_Name"] + "\",\"R_No\":" + arrays[i]["R_No"] + ",\"R_Name\":\"" + arrays[i]["R_Name"] + "\",\"friend\": [";
                for (j = 0; j < arrayspara.Length - 1; j++)
                {
                    list += "{\"P_No\":" + arrayspara[j]["P_No"] + ",\"P_Name\":\"" + arrayspara[j]["P_Name"] + "\",\"P_Type\":\"" + arrayspara[j]["P_Type"] + "\",\"P_Max\":\"" + arrayspara[j]["P_Max"] + "\",\"P_Min\":\"" + arrayspara[j]["P_Min"] + "\"},";
                }
                list += "{\"P_No\":" + arrayspara[j]["P_No"] + ",\"P_Name\":\"" + arrayspara[j]["P_Name"] + "\",\"P_Type\":\"" + arrayspara[j]["P_Type"] + "\",\"P_Max\":\"" + arrayspara[j]["P_Max"] + "\",\"P_Min\":\"" + arrayspara[j]["P_Min"] + "\"}]}]";
            }

            var result = new { code = 0, count = arrays.Length, data = list };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }