using DBUtility; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using SQLHelper; using System; using System.Collections.Generic; using System.Data; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Web; using System.Web.Http; using WebAPI.Code; using WebAPI.Models; namespace WebAPI.Controllers { public class AskPriceBillController : ApiController { public DBUtility.ClsPub.Enum_BillStatus BillStatus; private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill(); DataSet ds; #region 供应商询价单列表 [Route("Sup_AskPriceBill/Sup_AskPriceBillList")] [HttpGet] public object Sup_AskPriceBillList(string sWhere, string user) { try { List columnNameList = new List(); string sql1 = "select * from h_v_Sup_AskPriceBill where 1 = 1 "; string sql = sql1 + sWhere + " order by hmainid desc"; ds = oCN.RunProcReturn(sql, "h_v_Sup_AskPriceBill"); //添加列名 foreach (DataColumn col in ds.Tables[0].Columns) { Type dataType = col.DataType; string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.list = columnNameList; objJsonResult.data = ds.Tables[0]; return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion } }