50 lines
1.7 KiB
C#
50 lines
1.7 KiB
C#
using DataServer.api;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Text;
|
|
using System.Web.Http;
|
|
|
|
namespace JinanCementFactoryAPI.Controllers.api
|
|
{
|
|
/// <summary>
|
|
/// 能效管理2-能效对标(定额管理)
|
|
/// </summary>
|
|
public class GetEfficiencyIndexController : ApiController
|
|
{
|
|
DataServer.BLL.efficiency_index bll=new DataServer.BLL.efficiency_index();
|
|
// GET api/<controller>
|
|
public HttpResponseMessage Get()
|
|
{
|
|
var res = new get_efficiency_index();
|
|
try
|
|
{
|
|
var list = bll.GetModelList("");
|
|
var data = new List<efficiency_indexData>();
|
|
var now = DateTime.Now;
|
|
foreach (var item in list)
|
|
{
|
|
var model = new efficiency_indexData();
|
|
model.EfficiencyName = item.EfficiencyName;
|
|
model.AdvancedValue =Convert.ToInt32(item.AdvancedValue);
|
|
model.Enterprise = Convert.ToInt32(item.Enterprise);
|
|
model.Year = item.YearValue;
|
|
data.Add(model);
|
|
}
|
|
res.code = 200;
|
|
res.msg = "成功";
|
|
res.data = data;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.code = 500;
|
|
res.msg = ex.Message;
|
|
}
|
|
HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(res), Encoding.GetEncoding("UTF-8"), "application/json") };
|
|
return result;
|
|
}
|
|
}
|
|
} |