|
|
using System;
|
|
|
using System.Linq;
|
|
|
using System.Web.Mvc;
|
|
|
using DSWeb.MvcShipping.DAL.MsCodeSourceDAL;
|
|
|
using DSWeb.MvcShipping.Models.MsCodeSource;
|
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
using DSWeb.MvcShipping.Comm.Cookie;
|
|
|
using System.Collections.Generic;
|
|
|
using HcUtility.Comm;
|
|
|
using HcUtility.Core;
|
|
|
using DSWeb.SoftMng.Filter;
|
|
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
|
{
|
|
|
[JsonRequestBehavior]
|
|
|
public class MsCodeSourceController : Controller
|
|
|
{
|
|
|
//
|
|
|
// GET:
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
//
|
|
|
// GET: /
|
|
|
public ActionResult Edit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
//
|
|
|
// GET:
|
|
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
|
public ContentResult GetDataList(string condition)
|
|
|
{
|
|
|
var dataList = MsCodeSourceDAL.GetDataList(condition);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
// GET:/TruckMng/MsWlTyreAcc/GetData/
|
|
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
|
public ContentResult GetData(string handle, string condition)
|
|
|
{
|
|
|
MsCodeSource head = null;
|
|
|
|
|
|
if (handle == "edit")
|
|
|
{
|
|
|
var list = MsCodeSourceDAL.GetDataList(condition);
|
|
|
if (list.Count > 0)
|
|
|
head = list[0];
|
|
|
}
|
|
|
|
|
|
if (head == null)
|
|
|
{
|
|
|
head = new MsCodeSource();
|
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
|
public ContentResult GetBodyList(string condition)
|
|
|
{
|
|
|
var dataList = MsCodeSourceDAL.GetBodyList(condition);
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult Save(string opstatus, string data, string body, string bodywork)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<MsCodeSource>(data);
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsCodeSourceDetail>>(body);
|
|
|
|
|
|
|
|
|
if (opstatus == "add")
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
}
|
|
|
else if (opstatus == "edit")
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
|
headData.ModelUIStatus = "E";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
|
}
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
modb.Save(headData);
|
|
|
var OS_ID = headData.SOURCEID;
|
|
|
DBResult result = MsCodeSourceDAL.SaveDetail(headData, bodyList);
|
|
|
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
Data = MsCodeSourceDAL.GetData("SOURCEID='" + OS_ID+ "'")
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
//
|
|
|
// GET:/Import/Cargoinfo/Delete
|
|
|
|
|
|
public ContentResult Delete(string data)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<MsCodeSource>(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) };
|
|
|
}
|
|
|
|
|
|
#region 参照部分
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|