|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Web.Mvc;
|
|
|
using DSWeb.Areas.TruckMng.DAL.MsWlTruck;
|
|
|
using DSWeb.Areas.TruckMng.Models;
|
|
|
using DSWeb.Areas.TruckMng.Models.MsWlTruck;
|
|
|
using DSWeb.Areas.TruckMng.Models.Card;
|
|
|
using DSWeb.TruckMng.Comm.Cookie;
|
|
|
using DSWeb.TruckMng.Helper;
|
|
|
using DSWeb.TruckMng.Helper.Repository;
|
|
|
using HcUtility.Comm;
|
|
|
using HcUtility.Core;
|
|
|
using DSWeb.SoftMng.Filter;
|
|
|
|
|
|
namespace DSWeb.Areas.TruckMng.Controllers
|
|
|
{
|
|
|
[JsonRequestBehavior]
|
|
|
public class MsWlTruckTeamController : Controller
|
|
|
{
|
|
|
//
|
|
|
// GET: /TruckMng/MsWlTruck
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
//
|
|
|
// GET: /TruckMng/MsWlTruck/Edit
|
|
|
public ActionResult Edit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
//
|
|
|
// GET:/TruckMng/MsWlTruck/GetDataList
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
|
public ContentResult GetDataList(int start, int limit, string sort, string condition)
|
|
|
{
|
|
|
var dataList = MsWlTruckDAL.GetTruckTeamList(condition, sort);
|
|
|
|
|
|
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/MsWlTruck/GetData/
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
|
public ContentResult GetData(string handle, string condition)
|
|
|
{
|
|
|
MsWlTruck head = null;
|
|
|
|
|
|
if (handle == "edit")
|
|
|
{
|
|
|
var list = MsWlTruckDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request));
|
|
|
if (list.Count > 0)
|
|
|
head = list[0];
|
|
|
}
|
|
|
|
|
|
if (head == null)
|
|
|
{
|
|
|
head = new MsWlTruck();
|
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
//
|
|
|
// GET:/TruckMng/MsWlTruck/Save
|
|
|
|
|
|
public ContentResult Save ( string ProjectBody, string ProjectDelBody )
|
|
|
{
|
|
|
var ProjectBodyList = JsonConvert.Deserialize<List<MsWlTruckTeam>>(ProjectBody);
|
|
|
var ProjectDelBodyList = JsonConvert.Deserialize<List<MsWlTruckTeam>>(ProjectDelBody);
|
|
|
/*
|
|
|
Database db_t = DatabaseFactory.CreateDatabase();
|
|
|
string strCheckRow = " select USERNAME from [user] where gid= '" + UserID + "' ";
|
|
|
object statusObj = SqlHelper.ExecuteScalar(db_t.ConnectionString, CommandType.Text, strCheckRow, null);
|
|
|
var EnName = statusObj.ToString();
|
|
|
* */
|
|
|
|
|
|
var modb = new ModelObjectRepository();
|
|
|
DBResult result = modb.SaveComm(
|
|
|
ModelObjectConvert<MsWlTruckTeam>.ToModelObjectList(ProjectBodyList),
|
|
|
ModelObjectConvert<MsWlTruckTeam>.ToModelObjectList(ProjectDelBodyList)
|
|
|
);
|
|
|
|
|
|
//刷新父窗口上的父节点
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
/*
|
|
|
public ContentResult Delete(string data)
|
|
|
{
|
|
|
var head = JsonConvert.Deserialize<MsWlTruck>(data);
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Delete(head);
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetBodyList(string billno)
|
|
|
{
|
|
|
var condition = " TruckNo='" + billno + "' ";
|
|
|
List<MsWlTruckFuel> list = MsWlTruckDAL.GetBodyList(condition);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}*/
|
|
|
|
|
|
|
|
|
public ContentResult AddTeamTruck ( string TEAMGID,string TRUCKNO )
|
|
|
{
|
|
|
var _r = MsWlTruckDAL.UpdTeamTruck(TRUCKNO, TEAMGID);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = _r, data = "" });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult DelTeamTruck ( string TRUCKNO )
|
|
|
{
|
|
|
var _r = MsWlTruckDAL.UpdTeamTruck(TRUCKNO, "");
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = _r, data = "" });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
|
public ContentResult GetTruckNoList(string condition)
|
|
|
{
|
|
|
var list = MsWlTruckDAL.GetTruckNoList(Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request),
|
|
|
CookieConfig.GetCookie_OrgCode(Request), condition);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|