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/MsWlTyreScrapController.cs

126 lines
4.1 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.Areas.TruckMng.DAL.MsWlTyreScrap;
using DSWeb.Areas.TruckMng.Models.MsWlTyreScrap;
using DSWeb.TruckMng.Comm.Cookie;
using DSWeb.TruckMng.Helper;
using HcUtility.Comm;
using HcUtility.Core;
namespace DSWeb.Areas.TruckMng.Controllers
{
[JsonRequestBehavior]
public class MsWlTyreScrapController : Controller
{
//
// GET: /TruckMng/MsWlTyreScrap
public ActionResult Index()
{
return View();
}
//
// GET: /TruckMng/MsWlTyreScrap/Edit
public ActionResult Edit()
{
return View();
}
//
// GET/TruckMng/MsWlTyreScrap/GetDataList
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
var dataList = MsWlTyreScrapDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request));
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/MsWlTyreScrap/GetData/
public ContentResult GetData(string handle, string condition)
{
MsWlTyreScrap head = null;
if (handle == "edit")
{
var list = MsWlTyreScrapDAL.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 MsWlTyreScrap();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
//
// GET/TruckMng/MsWlTyreScrap/Save
public ContentResult Save(string opstatus, string data)
{
MsWlTyreScrap head = JsonConvert.Deserialize<MsWlTyreScrap>(data);
if (opstatus == "add")
{
head.DbOperationType = DbOperationType.DbotIns;
head.OrgCode = CookieConfig.GetCookie_OrgCode(Request);
}
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 = MsWlTyreScrapDAL.GetData("SerialNo=" + head.SerialNo + "", Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult Delete(string data)
{
var head = JsonConvert.Deserialize<MsWlTyreScrap>(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 参照部分
public ContentResult GetTruckNoList(string condition)
{
var list = MsWlTyreScrapDAL.GetTruckNoList(Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request));
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = list.ToList() });
return new ContentResult() { Content = json };
}
#endregion
}
}