|
- using Nancy;
- using Learun.Util;
- using System.Collections.Generic;
- using Learun.Application.TwoDevelopment.EducationalAdministration;
- using static Learun.Application.WebApi.Modules.StuInfoFreshApi;
- using System;
- using System.IO;
- using System.Linq;
- using Learun.Application.Base.SystemModule;
- using Learun.Application.OA;
- using Learun.Application.OA.File.FileInfo;
- using Learun.Application.TwoDevelopment.LogisticsManagement;
- using Learun.Application.TwoDevelopment.LR_Desktop;
- using Learun.Application.WorkFlow;
- using Microsoft.Ajax.Utilities;
-
- namespace Learun.Application.WebApi
- {
- /// <summary>
- /// 版 本 Learun-ADMS-Ultimate V7.0.0 力软敏捷开发框架
- /// Copyright (c) 2013-2018 上海力软信息技术有限公司
- /// 创 建:超级管理员
- /// 日 期:2019-08-19 17:50
- /// 描 述:教师注册
- /// </summary>
-
- public class StuInfoBasicApi : BaseApi
- {
-
- private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL();
- private CdMajorIBLL cdMajorIBLL = new CdMajorBLL();
- private ClassInfoIBLL classInfoIbll=new ClassInfoBLL();
- private AccommodationIBLL accommodationIBLL=new AccommodationBLL();
-
- /// <summary>
- /// 注册接口
- /// <summary>
- public StuInfoBasicApi()
- : base("/Learun/adms/EducationalAdministration/StuInfoBasic")
- {
- Get["/pagelist"] = GetPageList;
- Get["/form"] = GetForm;
- Post["/delete"] = DeleteForm;
- Post["/save"] = SaveForm;
- Get["/stuinfo"] = GetStuInfo;
- Get["/stuinfoDetail"] = GetStuDetail;
- }
- #region 获取数据
-
- /// <summary>
- /// 获取页面显示列表分页数据
- /// <summary>
- /// <param name="_"></param>
- /// <returns></returns>
- public Response GetPageList(dynamic _)
- {
- ReqPageParam parameter = this.GetReqData<ReqPageParam>();
- var data = stuInfoBasicIBLL.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 GetStuInfo(dynamic _)
- {
- string stuNo = this.GetReqData();
- var stuInfo = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(stuNo);
- return Success(stuInfo);
- }
- public Response GetStuDetail(dynamic _)
- {
- string stuNo = this.GetReqData();
- var stuInfo = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(stuNo);
- var roomInfo = accommodationIBLL.GetDormitoryInfoByStuNo(stuInfo.StuNo);
- if (stuInfo != null)
- {
- var classInfo = classInfoIbll.GetClassInfoEntityByClassNo(stuInfo.ClassNo);
- var majorInfo = cdMajorIBLL.GetCdMajorEntityByMajorNo(stuInfo.MajorNo);
- return Success(new {stuInfo, majorInfo,classInfo,roomInfo});
-
- }
- return Fail("没有找到此人");
- }
- /// <summary>
- /// 获取表单数据
- /// <summary>
- /// <param name="_"></param>
- /// <returns></returns>
- public Response GetForm(dynamic _)
- {
- string keyValue = this.GetReqData();
- var StuInfoBasicData = stuInfoBasicIBLL.GetStuInfoBasicEntity(keyValue);
- var jsonData = new
- {
- StuInfoBasic = StuInfoBasicData,
- };
- return Success(jsonData);
- }
-
-
-
- #endregion
-
- #region 提交数据
-
- /// <summary>
- /// 删除实体数据
- /// <param name="_"></param>
- /// <summary>
- /// <returns></returns>
- public Response DeleteForm(dynamic _)
- {
- string keyValue = this.GetReqData();
- stuInfoBasicIBLL.DeleteEntity(keyValue);
- return Success("删除成功!");
- }
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// <param name="_"></param>
- /// <summary>
- /// <returns></returns>
- public Response SaveForm(dynamic _)
- {
- ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
- StuInfoBasicEntity entity = parameter.strEntity.ToObject<StuInfoBasicEntity>();
- stuInfoBasicIBLL.SaveEntity(parameter.keyValue, entity);
- return Success("保存成功!");
- }
- #endregion
-
- #region 私有类
-
- /// <summary>
- /// 表单实体类
- /// <summary>
- private class ReqFormEntity
- {
- public string keyValue { get; set; }
- public string strEntity { get; set; }
- }
- #endregion
-
- }
-
- }
|