You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/SysMng/Controllers/EnumController.cs

148 lines
4.5 KiB
C#

2 years ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using DSWeb.Areas.SysMng.DAL.Enum;
using DSWeb.Areas.SysMng.Models.Enum;
using DSWeb.TruckMng.Comm.Cookie;
using DSWeb.TruckMng.Helper;
using DSWeb.TruckMng.Helper.Repository;
using HcUtility.Comm;
using HcUtility.Core;
8 months ago
using DSWeb.SoftMng.Filter;
2 years ago
namespace DSWeb.Areas.SysMng.Controllers
{
/// <summary>
/// 配件申领单
/// </summary>
[JsonRequestBehavior]
public class EnumController : Controller
{
//
// GET: /TruckMng/Enum/
public ActionResult Index()
{
return View();
}
//
// GET: /TruckMng/Enum/Edit
public ActionResult Edit()
{
return View();
}
//
// GET/TruckMng/Enum/GetDataList
8 months ago
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
2 years ago
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
var dataList = EnumDAL.GetDataList(condition);
var list = dataList.Skip(start).Take(limit);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
//
// GET/TruckMng/Enum/GetData/
8 months ago
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
2 years ago
public ContentResult GetData(string handle, string condition)
{
SysEnumType headData = null;
if (handle == "edit")
{
var list = EnumDAL.GetDataList(condition);
if (list.Count > 0)
headData = list[0];
}
if (headData == null)
{
headData = new SysEnumType();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = headData });
return new ContentResult() { Content = json };
}
//
// GET/TruckMng/Enum/Save
public ContentResult Save ( string opstatus, string data, string body, string Delbody )
{
var headData = JsonConvert.Deserialize<SysEnumType>(data);
var bodyList = JsonConvert.Deserialize<List<SysEnumValue>>(body);
var DelbodyList = JsonConvert.Deserialize<List<SysEnumValue>>(Delbody);
if (opstatus == "add")
{
headData.DbOperationType = DbOperationType.DbotIns;
headData.ModelUIStatus = "I";
}
else
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
}
var modb = new ModelObjectRepository();
DBResult result = modb.Save(headData,
ModelObjectConvert<SysEnumValue>.ToModelObjectList(bodyList),
ModelObjectConvert<SysEnumValue>.ToModelObjectList(DelbodyList)
);
//if (result.Success) CommMng.DAL.BasicDataRefDAL.PubStore_SetNew("tSysEnumValue");
2 years ago
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = EnumDAL.GetHeadDataByBillNo(Convert.ToString(headData.EnumTypeID))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
//
// GET/TruckMng/Enum/Delete
public ContentResult Delete(string data)
{
var headData = JsonConvert.Deserialize<SysEnumType>(data);
var modb = new ModelObjectDB();
DBResult result = modb.Delete(headData);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
8 months ago
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
2 years ago
public ContentResult GetBodyList(string billno)
{
var condition = " EnumTypeID=" + billno;
List<SysEnumValue> list = EnumDAL.GetBodyList(condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
#region 参照部分
#endregion
}
}