public Newtonsoft.Json.Linq.JArray processer(string jsonStr) { String userID = null; String pTypeID = null; String attribute = null; String authorID = null; String writeTime = null; JArray jsa = JArray.Parse(jsonStr); JObject json = JObject.Parse(jsa[0].ToString()); userID = json["userID"].ToString(); pTypeID = json["pTypeID"].ToString(); attribute = json["attribute"].ToString(); ProductDao pd = new ProductDao(); ProductModel m = new ProductModel(pTypeID, attribute, authorID, writeTime); // pd.addModel(m); String result = pd.addModel(m, userID) == -1 ? "false" : "true"; JArray jsaa = new JArray(); JObject jsn = new JObject(); jsn.Add("isOk", result); jsaa.Add(jsn); return jsaa; }
public Model mappingRow(System.Data.DataRow rs) { ProductModel m = null; m = new ProductModel(rs["pTypeID"].ToString(), rs["attribute"].ToString().Replace("defaultNum", "" + num++), rs["typeName"].ToString(), rs["father"].ToString() ); return m; }