using Nancy;
using Learun.Util;
using System.Collections.Generic;
using System;
using Learun.Application.TwoDevelopment.EducationalAdministration;
namespace Learun.Application.WebApi
{
///
/// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
/// Copyright (c) 2013-2018 北京泉江科技有限公司
/// 创 建:超级管理员
/// 日 期:2021-04-30 14:33
/// 描 述:投诉回复
///
public class Sys_ReceiveComplaintApi : BaseApi
{
private Sys_ReceiveComplaintIBLL sys_ReceiveComplaintIBLL = new Sys_ReceiveComplaintBLL();
private Sys_SendComplaintIBLL sys_SendComplaintIBLL = new Sys_SendComplaintBLL();
///
/// 注册接口
///
public Sys_ReceiveComplaintApi()
: base("/Learun/adms/EducationalAdministration/Sys_ReceiveComplaint")
{
Get["/pagelist"] = GetPageList;
Get["/form"] = GetForm;
Post["/delete"] = DeleteForm;
Post["/save"] = SaveForm;
}
#region 获取数据
///
/// 获取页面显示列表分页数据
///
///
///
public Response GetPageList(dynamic _)
{
ReqPageParam parameter = this.GetReqData();
var data = sys_ReceiveComplaintIBLL.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 GetForm(dynamic _)
{
string keyValue = this.GetReqData();
var Sys_ReceiveComplaintData = sys_ReceiveComplaintIBLL.GetSys_ReceiveComplaintEntity( keyValue );
var jsonData = new {
Sys_ReceiveComplaint = Sys_ReceiveComplaintData,
};
return Success(jsonData);
}
#endregion
#region 提交数据
///
/// 删除实体数据
///
///
///
public Response DeleteForm(dynamic _)
{
string keyValue = this.GetReqData();
sys_ReceiveComplaintIBLL.DeleteEntity(keyValue);
return Success("删除成功!");
}
///
/// 保存实体数据(新增、修改)
///
///
///
public Response SaveForm(dynamic _)
{
ReqFormEntity parameter = this.GetReqData();
Sys_ReceiveComplaintEntity entity = parameter.strEntity.ToObject();
//接收投诉意见表
var sys_ReceiveComplaintEntity = sys_ReceiveComplaintIBLL.GetSys_ReceiveComplaintEntity(parameter.keyValue);
sys_ReceiveComplaintEntity.ReplyContents = entity.ReplyContents;
sys_ReceiveComplaintEntity.ReplyFlag = 1;
sys_ReceiveComplaintEntity.ReplyTime = DateTime.Now;
sys_ReceiveComplaintIBLL.SaveEntity(parameter.keyValue, sys_ReceiveComplaintEntity);
//发送投诉意见表
var sys_SendComplaintEntity = sys_SendComplaintIBLL.GetSys_SendComplaintEntity(sys_ReceiveComplaintEntity.SComplaintId);
if (sys_SendComplaintEntity.ReplyFlag == 0) //未回复
{
sys_SendComplaintEntity.ReplyFlag = 1;
sys_SendComplaintIBLL.SaveEntity(sys_SendComplaintEntity.SComplaintId, sys_SendComplaintEntity);
}
return Success("保存成功!");
}
#endregion
#region 私有类
///
/// 表单实体类
///
private class ReqFormEntity {
public string keyValue { get; set; }
public string strEntity{ get; set; }
}
#endregion
}
}