|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
using DSWeb.Areas.TruckMng.DAL;
|
|
|
|
|
using DSWeb.Areas.TruckMng.Models.WlTruck;
|
|
|
|
|
using DSWeb.TruckMng.Helper;
|
|
|
|
|
using HcUtility.Comm;
|
|
|
|
|
using HcUtility.Core;
|
|
|
|
|
using DSWeb.SoftMng.Filter;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.Areas.TruckMng.Controllers
|
|
|
|
|
{
|
|
|
|
|
[JsonRequestBehavior]
|
|
|
|
|
public class WlTruckController : Controller
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// GET: /WlTruck
|
|
|
|
|
public ActionResult Index()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET: /TruckMng/WlTruck/Edit
|
|
|
|
|
public ActionResult Edit()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET:/TruckMng/WlTruck/GetDataList
|
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
|
|
|
public JsonResult GetDataList(int start, int limit, string sort, string condition)
|
|
|
|
|
{
|
|
|
|
|
var ordYhList = WlTruckDAL.GetDataList(condition);
|
|
|
|
|
|
|
|
|
|
var list = ordYhList.Skip(start).Take(limit);
|
|
|
|
|
|
|
|
|
|
return Json(new { Success = true, Message = "查询成功", totalCount = ordYhList.Count, data = list.ToList() });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET:/TruckMng/WlTruck/GetData/
|
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
|
|
|
public JsonResult GetData(string handle, string condition)
|
|
|
|
|
{
|
|
|
|
|
WlTruck wlTruck = null;
|
|
|
|
|
|
|
|
|
|
if (handle == "edit")
|
|
|
|
|
{
|
|
|
|
|
var list = WlTruckDAL.GetDataList(condition);
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
|
wlTruck = list[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (wlTruck == null)
|
|
|
|
|
{
|
|
|
|
|
wlTruck = new WlTruck();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Json(new {Success = true, Message = "查询成功", data = wlTruck});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET:/TruckMng/WlTruck/Save
|
|
|
|
|
|
|
|
|
|
public JsonResult Save(string opstatus,string data)
|
|
|
|
|
{
|
|
|
|
|
WlTruck wlTruck = JsonConvert.Deserialize<WlTruck>(data);
|
|
|
|
|
if (opstatus == "add")
|
|
|
|
|
{
|
|
|
|
|
wlTruck.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
}
|
|
|
|
|
else if (opstatus == "edit")
|
|
|
|
|
{
|
|
|
|
|
wlTruck.DbOperationType = DbOperationType.DbotUpd;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
wlTruck.DbOperationType = DbOperationType.DbotDel;
|
|
|
|
|
}
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
|
|
DBResult result =modb.Save(wlTruck);
|
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse {Success = result.Success, Message = result.Message};
|
|
|
|
|
return Json(jsonRespose);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public JsonResult Delete(string data)
|
|
|
|
|
{
|
|
|
|
|
var wlTruck = JsonConvert.Deserialize<WlTruck>(data);
|
|
|
|
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
|
|
DBResult result = modb.Delete(wlTruck);
|
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
|
|
return Json(jsonRespose);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 参照部分
|
|
|
|
|
public JsonResult GetDrvCodeList()
|
|
|
|
|
{
|
|
|
|
|
var list = WlTruckDAL.GetDrvCodeList();
|
|
|
|
|
|
|
|
|
|
return Json(new { Success = true, Message = "查询成功",data = list.ToList() });
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|