Пример #1
0
    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;
    }
Пример #2
0
    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;
    }