|
- using Learun.Util;
- using System.Data;
- using Learun.Application.TwoDevelopment.ReceiveSendFeeManagement;
- using System.Web.Mvc;
- using System.Collections.Generic;
- using System;
- using System.Linq;
-
- namespace Learun.Application.Web.Areas.ReceiveSendFeeManagement.Controllers
- {
- /// <summary>
- /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
- /// Copyright (c) 2013-2018 北京泉江科技有限公司
- /// 创 建:超级管理员
- /// 日 期:2019-06-05 16:52
- /// 描 述:收退费类别管理
- /// </summary>
- public class FinaRefundItemController : MvcControllerBase
- {
- private FinaRefundItemIBLL finaRefundItemIBLL = new FinaRefundItemBLL();
-
- #region 视图功能
-
- /// <summary>
- /// 主页面
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Index()
- {
- return View();
- }
- /// <summary>
- /// 表单页
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Form()
- {
- return View();
- }
-
- /// <summary>
- /// 主页面
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult ShowIndex()
- {
- var keyword = string.Empty;
- var data = finaRefundItemIBLL.GetList(keyword);
- var result = new modelTemp()
- {
- FinaRefundItemList = data.ToList(),
- TotalNum = data.Count()
- };
- return View(result);
- }
- /// <summary>
- /// 页面临时模型
- /// </summary>
- public class modelTemp
- {
- public List<FinaRefundItemEntity> FinaRefundItemList { get; set; }
- public int TotalNum { get; set; }
- }
- #endregion
-
- #region 获取数据
-
- /// <summary>
- /// 获取页面显示列表数据
- /// <summary>
- /// <param name="queryJson">查询参数</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetPageList(string pagination, string queryJson)
- {
- Pagination paginationobj = pagination.ToObject<Pagination>();
- var data = finaRefundItemIBLL.GetPageList(paginationobj, queryJson);
- var jsonData = new
- {
- rows = data,
- total = paginationobj.total,
- page = paginationobj.page,
- records = paginationobj.records
- };
- return Success(jsonData);
- }
- /// <summary>
- /// 获取页面显示列表数据
- /// <summary>
- /// <param name="keyword">搜索关键字</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetList(string keyword)
- {
- var data = finaRefundItemIBLL.GetList(keyword);
- return Success(data);
- }
- /// <summary>
- /// 获取表单数据
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetFormData(string keyValue)
- {
- var FinaRefundItemData = finaRefundItemIBLL.GetFinaRefundItemEntity( keyValue );
- var jsonData = new {
- FinaRefundItem = FinaRefundItemData,
- };
- return Success(jsonData);
- }
- #endregion
-
- #region 提交数据
-
- /// <summary>
- /// 删除实体数据
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult DeleteForm(string keyValue)
- {
- finaRefundItemIBLL.DeleteEntity(keyValue);
- return Success("删除成功!");
- }
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult SaveForm(string keyValue, string strEntity)
- {
- var loginUserInfo = LoginUserInfo.Get();
-
- FinaRefundItemEntity entity = strEntity.ToObject<FinaRefundItemEntity>();
-
- var model = finaRefundItemIBLL.GetFinaRefundItemEntityByRefundItemName(entity.RefundItemName);
- if (model != null)
- {
- if (string.IsNullOrEmpty(keyValue))
- {
- return Fail("费用类别名称不能相同!");
- }
- else
- {
- if (model.RefundItemId != Convert.ToInt32(keyValue))
- {
- return Fail("费用类别名称不能相同!");
- }
- }
- }
-
- entity.CreateDate = DateTime.Now;
- entity.CreateUserId = loginUserInfo.userId;
- entity.CreateUserName = loginUserInfo.realName;
- finaRefundItemIBLL.SaveEntity(keyValue,entity);
- return Success("保存成功!");
- }
- #endregion
-
- }
- }
|