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.

144 lines
4.2 KiB
C#

11 months 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.MvcShipping.Comm.Cookie;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Helper.Repository;
using HcUtility.Comm;
using HcUtility.Core;
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
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/
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)
);
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) };
}
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
}
}