using Nancy;
using Learun.Util;
using System.Collections.Generic;
using Learun.Application.TwoDevelopment.EducationalAdministration;
using Learun.Application.TwoDevelopment.LogisticsManagement;
using System;
using Learun.Application.WorkFlow;
namespace Learun.Application.WebApi
{
///
/// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
/// Copyright (c) 2013-2018 北京泉江科技有限公司
/// 创 建:超级管理员
/// 日 期:2020-06-03 14:29
/// 描 述:系部数据
///
public class PurchasePrintApplyApi : BaseApi
{
private Purchase_Print_ApplyIBLL purchaseprintIBLL = new Purchase_Print_ApplyBLL();
private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL();
///
/// 注册接口
///
public PurchasePrintApplyApi()
: base("/learun/adms/purchaseprintapply")
{
Get["/pagelist"] = GetPageList;
Get["/form"] = GetForm;
Post["/delete"] = DeleteForm;
Post["/save"] = SaveForm;
Post["/submit"] = Submit;
Get["/shList"] = GetshList;
}
#region 获取数据
///
/// 获取页面显示列表分页数据
///
///
///
public Response GetPageList(dynamic _)
{
ReqPageParam parameter = this.GetReqData();
var data = purchaseprintIBLL.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 Purchase_PrintData = purchaseprintIBLL.GetPurchase_Print_ApplyEntity(keyValue);
var Purchase_Print_DetailsData = purchaseprintIBLL.GetPurchase_Print_ApplydetailsList(Purchase_PrintData.Id);
var jsonData = new
{
Purchase_Print = Purchase_PrintData,
Purchase_Print_Details = Purchase_Print_DetailsData,
};
return Success(jsonData);
}
///
/// 获取页面显示列表数据
///
///
///
public Response GetshList(dynamic _)
{
Purchase_Print_ApplyEntity parameter = this.GetReqData();
var Purchase_PrintData = purchaseprintIBLL.GetEntityByProcessId(parameter.ProcessId);
var Purchase_Print_DetailsData = purchaseprintIBLL.GetPurchase_Print_ApplydetailsList(Purchase_PrintData.Id);
var jsonData = new
{
Purchase_Print = Purchase_PrintData,
Purchase_Print_Details = Purchase_Print_DetailsData,
};
return Success(jsonData);
}
#endregion
#region 提交数据
///
/// 删除实体数据
///
///
///
public Response DeleteForm(dynamic _)
{
string keyValue = this.GetReqData();
purchaseprintIBLL.DeleteEntity(keyValue);
return Success("删除成功!");
}
///
/// 保存实体数据(新增、修改)
///
///
///
public Response SaveForm(dynamic _)
{
//Purchase_PrintEntity entity = strEntity.ToObject();
//List purchase_Print_DetailsList = strpurchase_Print_DetailsList.ToObject>();
//purchase_PrintIBLL.SaveEntity(keyValue, entity, purchase_Print_DetailsList);
ReqFormEntity parameter = this.GetReqData();
Purchase_Print_ApplyEntity entity = parameter.strEntity.ToObject();
List detailList = parameter.DetailList.ToObject>();
//var code = entity.EnCode;
string id= purchaseprintIBLL.SaveEntity(parameter.keyValue, entity, detailList);
var json = new
{
Id = id
};
return Success(json);
}
///
/// 提交
///
///
///
public Response Submit(dynamic _)
{
Purchase_Print_ApplyEntity parameter = this.GetReqData();
//string keyValue = this.GetReqData();
//var processId = Guid.NewGuid().ToString();
purchaseprintIBLL.ModifyStatus(parameter.Id, 1, parameter.ProcessId);
//UserInfo userInfo = LoginUserInfo.Get();
//nWFProcessIBLL.CreateFlow("1-6", processId, "", 1, "", userInfo);
return Success("提交成功!");
}
#endregion
#region 私有类
///
/// 表单实体类
///
private class ReqFormEntity
{
public string keyValue { get; set; }
public string strEntity { get; set; }
public string DetailList { get; set; }
}
#endregion
}
}