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.
DS7/DSWeb/Areas/TruckMng/Controllers/MsWlInsureLtdController.cs

120 lines
3.4 KiB
C#

2 years ago
using System.Linq;
using System.Web.Mvc;
using DSWeb.Areas.TruckMng.DAL.MsWlInsureLtd;
using DSWeb.Areas.TruckMng.Models.MsWlInsureLtd;
using DSWeb.TruckMng.Comm.Cookie;
using DSWeb.TruckMng.Helper;
using HcUtility.Comm;
using HcUtility.Core;
7 months ago
using DSWeb.SoftMng.Filter;
2 years ago
namespace DSWeb.Areas.TruckMng.Controllers
{
[JsonRequestBehavior]
public class MsWlInsureLtdController : Controller
{
//
// GET: /TruckMng/MsWlInsureLtd
public ActionResult Index()
{
return View();
}
//
// GET: /TruckMng/MsWlInsureLtd/Edit
public ActionResult Edit()
{
return View();
}
//
// GET/TruckMng/MsWlInsureLtd/GetDataList
7 months ago
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
2 years ago
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
var dataList = MsWlInsureLtdDAL.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/MsWlInsureLtd/GetData/
7 months ago
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
2 years ago
public ContentResult GetData(string handle, string condition)
{
MsWlInsureLtd head = null;
if (handle == "edit")
{
var list = MsWlInsureLtdDAL.GetDataList(condition);
if (list.Count > 0)
head = list[0];
}
if (head == null)
{
head = new MsWlInsureLtd();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
//
// GET/TruckMng/MsWlInsureLtd/Save
public ContentResult Save(string opstatus, string data)
{
MsWlInsureLtd head = JsonConvert.Deserialize<MsWlInsureLtd>(data);
if (opstatus == "add")
{
head.DbOperationType = DbOperationType.DbotIns;
}
else if (opstatus == "edit")
{
head.DbOperationType = DbOperationType.DbotUpd;
}
else
{
head.DbOperationType = DbOperationType.DbotDel;
}
var modb = new ModelObjectDB();
DBResult result = modb.Save(head);
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsWlInsureLtdDAL.GetData("Code='" + head.Code + "'")
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult Delete(string data)
{
var head = JsonConvert.Deserialize<MsWlInsureLtd>(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) };
}
#region 参照部分
#endregion
}
}