public string ModelListEntity(string sqlwhere) { if (string.IsNullOrEmpty(sqlwhere)) { sqlwhere += "1=1"; } else sqlwhere += " and 1=1"; ModelListBll ob = new ModelListBll(); List<ModelList> orderList = new List<ModelList>(); //转换 List<ConvertEntity> ce = new List<ConvertEntity>(); orderList = ob.GetModelList(sqlwhere); foreach (ModelList item in orderList) { ConvertEntity ceSingle = new ConvertEntity(); ceSingle.ModalName = item.ModelName; ceSingle.RemarkD = item.Remark; ceSingle.eg3 = item.ModelPrice; ceSingle.eg4 = item.StationPrice; ceSingle.Unit = item.Unit; ceSingle.ModelProfit = item.ModelProfit; ceSingle.StationProfit = item.StationProfit; ce.Add(ceSingle); } int rows = ob.GetRecordCount(sqlwhere); string output = JsonConvert.SerializeObject(ce); string json = @"{""Rows"":" + output + @",""Total"":""" + rows + @"""}"; return json; }
public string ModelListList(string sqlwhere) { if (string.IsNullOrEmpty(sqlwhere)) { sqlwhere += "1=1"; } else sqlwhere += " and 1=1"; ModelListBll ob = new ModelListBll(); List<ModelList> orderList = new List<ModelList>(); orderList = ob.GetModelList(sqlwhere); int rows = ob.GetRecordCount(sqlwhere); string output = JsonConvert.SerializeObject(orderList); string json = @"{""Rows"":" + output + @",""Total"":""" + rows + @"""}"; return json; }
public string _UpdateModelList(string jsonData) { // String s = (new System.IO.StreamReader(HttpContext.Current.Request.InputStream)).ReadToEnd(); ModelListBll ob = new ModelListBll(); List<ModelList> we = JsonConvert.DeserializeObject(jsonData, typeof(List<ModelList>)) as List<ModelList>; string Flag = "success"; foreach (ModelList wd in we) { bool SuccessFlag = ob.Update(wd); if (!SuccessFlag) { Flag = "error"; } } return Flag; }
public bool _DelModelList(string jsonData) { ModelListBll ob = new ModelListBll(); List<ModelList> we = JsonConvert.DeserializeObject(jsonData, typeof(List<ModelList>)) as List<ModelList>; return ob.DeleteList(we); }
public string _AddModelList(string jsonData) { ModelListBll ob = new ModelListBll(); List<ModelList> we = JsonConvert.DeserializeObject(jsonData, typeof(List<ModelList>)) as List<ModelList>; string Flag = "success"; foreach (ModelList wd in we) { int SuccessFlag = ob.Add(wd); if (SuccessFlag <= 0) { Flag = "error"; } } return Flag; }