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.

90 lines
2.7 KiB
C#

using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.Models.CodeAll;
using DSWeb.MvcShipping.DAL.MsCodeAll;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Comm.Cookie;
using System.Collections.Generic;
using HcUtility.Comm;
using HcUtility.Core;
using DSWeb.TruckMng.Helper.Repository;
namespace DSWeb.MvcShipping.Controllers
{
[JsonRequestBehavior]
public class MsCodeAllController : Controller
{
public ActionResult Lanes()
{//
return View();
}
#region 查询
public ContentResult GetLanesList ( string condition, string sort )
{
var dataList = MsCodeAllDAL.GetLanesList(condition, sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
#endregion
#region 保存
public ContentResult SaveLanesList ( string data )
{
var dataList = JsonConvert.Deserialize<List<Code_lanesmb>>(data);
foreach (var _d in dataList)
{
if (_d.GID == "" || _d.GID == "*")
{
_d.DbOperationType = DbOperationType.DbotIns;
_d.ModelUIStatus = "I";
_d.GID = System.Guid.NewGuid().ToString(); //获取合同号
}
else
{
_d.DbOperationType = DbOperationType.DbotUpd;
_d.ModelUIStatus = "E";
}
}
var result = new DBResult();
var _L = ModelObjectConvert<Code_lanesmb>.ToModelObjectList(dataList);
//var _DL = ModelObjectConvert<MsWlPcHead_ADLEdit>.ToModelObjectList(DeldataList);
var modb = new ModelObjectRepository();
result = modb.SaveHead(_L);
//刷新父窗口上的父节点
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
#region 删除
public ContentResult DeleteLanes(string data)
{
var headData = JsonConvert.Deserialize<Code_lanesmb>(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) };
}
#endregion
}
}