using Nancy;
using Learun.Util;
using System.Collections.Generic;
using Learun.Application.TwoDevelopment.EducationalAdministration;
using System.Linq;
using System;
namespace Learun.Application.WebApi
{
///
/// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
/// Copyright (c) 2013-2018 北京泉江科技有限公司
/// 创 建:超级管理员
/// 日 期:2020-04-16 15:52
/// 描 述:班级自诊打卡
///
public class ThermographyApi : BaseApi
{
private ThermographyIBLL thermographyIBLL = new ThermographyBLL();
///
/// 注册接口
///
public ThermographyApi()
: base("/Learun/adms/EducationalAdministration/Thermography")
{
Get["/pagelist"] = GetPageList;
Get["/list"] = GetList;
Get["/listOfStudent"] = GetListOfStudent;
Get["/form"] = GetForm;
Post["/delete"] = DeleteForm;
Post["/save"] = SaveForm;
Post["/save2"] = SaveFormList;
}
#region 获取数据
///
/// 获取页面显示列表分页数据
///
///
///
public Response GetPageList(dynamic _)
{
ReqPageParam parameter = this.GetReqData();
var data = thermographyIBLL.GetPageList(parameter.pagination, parameter.queryJson);
var jsonData = new
{
rows = data,
total = parameter.pagination.total,
page = parameter.pagination.page,
records = parameter.pagination.records
};
return Success(jsonData);
}
///
/// 获取页面显示列表数据
///
///
///
public Response GetList(dynamic _)
{
string queryJson = this.GetReqData();
var data = thermographyIBLL.GetList(queryJson);
return Success(data);
}
///
/// 获取表单数据
///
///
///
public Response GetForm(dynamic _)
{
string keyValue = this.GetReqData();
var ThermographyData = thermographyIBLL.GetThermographyEntity(keyValue);
var jsonData = new
{
Thermography = ThermographyData,
};
return Success(jsonData);
}
///
/// 获取页面显示列表数据
///
///
///
public Response GetListOfStudent(dynamic _)
{
ReqPageParam parameter = this.GetReqData();
var data = thermographyIBLL.GetPageListOfStudentInApp(parameter.queryJson).OrderBy(x => x.PersonBeingMeasured);
return Success(data);
}
#endregion
#region 提交数据
///
/// 删除实体数据
///
///
///
public Response DeleteForm(dynamic _)
{
string keyValue = this.GetReqData();
thermographyIBLL.DeleteEntity(keyValue);
return Success("删除成功!");
}
///
/// 保存实体数据(新增、修改):单个学生提交测温
///
///
///
public Response SaveForm(dynamic _)
{
ReqFormEntity parameter = this.GetReqData();
ThermographyEntity entity = parameter.strEntity.ToObject();
entity.MeasureDate = DateTime.Now;
entity.CreateTime = DateTime.Now;
thermographyIBLL.SaveEntity(this.userInfo, parameter.keyValue, entity);
return Success("保存成功!");
}
///
/// 保存实体数据(新增、修改):整个班级提交测温
///
///
///
public Response SaveFormList(dynamic _)
{
ReqFormEntity parameter = this.GetReqData();
List entities = parameter.strEntity.ToObject>();
thermographyIBLL.SaveEntityList(parameter.measureTime, entities);
return Success("保存成功!");
}
#endregion
#region 私有类
///
/// 表单实体类
///
private class ReqFormEntity
{
public string keyValue { get; set; }
public string strEntity { get; set; }
public string measureTime { get; set; }
}
#endregion
}
}