public bool AddPlug7Configure(string id, string Suppliers, int priority, string WeightList) { JavaScriptSerializer jss = new JavaScriptSerializer(); var Sections = jss.Deserialize <List <_WeightList> >(WeightList); var suppliers = Suppliers.Split(new char[] { ',', ',' }); SeaWashesWeightParam param = new SeaWashesWeightParam { WeightList = Sections, Suppliers = suppliers.Select(x => int.Parse(x)).ToList(), Priority = priority }; var plug = AdminCarriageClient.Instance.GetPlugConfigure(7); var ret = jss.Deserialize <Myzj.OPC.UI.Model.AdminCarriage.SeaWashesWeight>(plug); ret.SeaWashesWeightParams.Add(param); return(AdminCarriageClient.Instance.UpdatePlugConfigure(7, jss.Serialize(ret))); }
public ActionResult Detail7Operation(int rowindex = -1) { var plug = AdminCarriageClient.Instance.GetPlugConfigure(7); JavaScriptSerializer jss = new JavaScriptSerializer(); var ret = jss.Deserialize <SeaWashesWeight>(plug); SeaWashesWeightParam param = new SeaWashesWeightParam(); if (rowindex >= 0) { param = ret.SeaWashesWeightParams[rowindex]; } else { param.Priority = 1; param.Suppliers = new List <int>(); param.WeightList = new List <_WeightList>(); } ViewBag.rowindex = rowindex; return(View(param)); }