using Learun.Util;
using System.Data;
using Learun.Application.TwoDevelopment.AssetManagementSystem;
using System.Web.Mvc;
using System.Collections.Generic;
namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers
{
///
/// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
/// Copyright (c) 2013-2018 北京泉江科技有限公司
/// 创 建:超级管理员
/// 日 期:2019-03-29 11:27
/// 描 述:在册登记明细
///
public class Ass_AssetsInfoItemController : MvcControllerBase
{
private Ass_AssetsInfoItemIBLL ass_AssetsInfoItemIBLL = new Ass_AssetsInfoItemBLL();
#region 视图功能
///
/// 主页面
///
///
[HttpGet]
public ActionResult Index()
{
return View();
}
///
/// 主页面
///
///
[HttpGet]
public ActionResult IndexTwo()
{
return View();
}
[HttpGet]
public ActionResult IndexOfMy()
{
return View();
}
///
/// 表单页
///
///
[HttpGet]
public ActionResult Form()
{
ViewBag.NewCode = CommonHelper.CreateNo();
return View();
}
[HttpGet]
public ActionResult FormView()
{
return View();
}
[HttpGet]
public ActionResult IndexScrap()
{
return View();
}
[HttpGet]
public ActionResult QRPrint()
{
return View();
}
#endregion
#region 获取数据
///
/// 获取页面显示列表数据
///
/// 查询参数
///
[HttpGet]
[AjaxOnly]
public ActionResult GetPageList(string pagination, string queryJson)
{
Pagination paginationobj = pagination.ToObject();
var data = ass_AssetsInfoItemIBLL.GetPageList(paginationobj, queryJson);
var jsonData = new
{
rows = data,
total = paginationobj.total,
page = paginationobj.page,
records = paginationobj.records
};
return Success(jsonData);
}
///
/// 获取左侧树形数据
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetTree()
{
var data = ass_AssetsInfoItemIBLL.GetTree();
return Success(data);
}
///
/// 获取资产类别树
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetTypeTree()
{
var data = ass_AssetsInfoItemIBLL.GetAssTypeTree();
return Success(data);
}
///
/// 获取列表不带分页
///
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetList(string queryJson)
{
var data = ass_AssetsInfoItemIBLL.GetList(queryJson);
return Success(data);
}
///
/// 获取表单数据
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetFormData(string keyValue)
{
var Ass_AssetsInfoItemData = ass_AssetsInfoItemIBLL.GetAss_AssetsInfoItemEntity(keyValue);
var jsonData = new
{
Ass_AssetsInfoItem = Ass_AssetsInfoItemData,
};
return Success(jsonData);
}
///
/// 获取表单数据
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetData(string keyValue)
{
var result = ass_AssetsInfoItemIBLL.GetAss_AssetsInfoByAIId(keyValue);
return Success(result);
}
///
/// 获取表单数据
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetDatas(string keyValue)
{
var result = ass_AssetsInfoItemIBLL.GetDatas(keyValue);
List list = new List();
foreach (var item in result)
{
var entity = new Ass_ScrapItemEntity();
entity.AAIAId = item.AIId;
entity.AAICode = item.AICode;
entity.AAIName = item.AIASSName;
entity.AAIStorage = item.AIIStorageId;
entity.AAILocation = item.AIIStoragePosition;
entity.AAITId = item.AIASSClass;
entity.AAIModel = item.AISpecificationtype;
entity.AAIManufacturer = item.AIBrand;
entity.AAIContent = item.AIAssValue.ToString();
list.Add(entity);
}
return Success(list);
}
#endregion
#region 提交数据
///
/// 删除实体数据
/// 主键
///
///
[HttpPost]
[AjaxOnly]
public ActionResult DeleteForm(string keyValue)
{
ass_AssetsInfoItemIBLL.DeleteEntity(keyValue);
return Success("删除成功!");
}
[HttpPost]
[AjaxOnly]
public ActionResult ScrapForm(string keyValue)
{
ass_AssetsInfoItemIBLL.ScrapEntity(keyValue);
return Success("报废成功!");
}
[HttpPost]
[AjaxOnly]
public ActionResult UnScrapForm(string keyValue)
{
ass_AssetsInfoItemIBLL.UnScrap(keyValue);
return Success("报废成功!");
}
///
/// 保存实体数据(新增、修改)
/// 主键
///
///
[HttpPost]
[ValidateAntiForgeryToken]
[AjaxOnly]
public ActionResult SaveForm(string keyValue, string strEntity)
{
Ass_AssetsInfoItemEntity entity = strEntity.ToObject();
ass_AssetsInfoItemIBLL.SaveEntity(keyValue, entity);
return Success("保存成功!");
}
#endregion
}
}